diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-12 10:14:45 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-12 10:14:45 +0100 |
| commit | f1cb36dddd59ea8430af367f7498da1062ad0e68 (patch) | |
| tree | b8fc470d8057f7ac4f523c756770fa68b5b2534d | |
| parent | 81e47e78fcc426e2afe6468e3b2044653ea79bdf (diff) | |
Forward-port some STL fixes from libsub.
| -rw-r--r-- | src/iso6937.cc | 16 | ||||
| -rw-r--r-- | test/dcp_to_stl_binary_test.cc | 50 |
2 files changed, 66 insertions, 0 deletions
diff --git a/src/iso6937.cc b/src/iso6937.cc index 2b75116..21637b3 100644 --- a/src/iso6937.cc +++ b/src/iso6937.cc @@ -98,6 +98,22 @@ sub::utf16_to_iso6937 (wstring s) } } } + + if (s[i] == 0x201e) { + /* ISO6397 does not support German (lower) quotation mark (UTF 0x201e) so use + a normal opening one (0x201c, which is 170 in ISO6937). + */ + o += (char) 170; + } else if (s[i] == 0x2013 || s[i] == 0x2014) { + /* ISO6397 does not support en- or em-dashes, so use a horizontal bar (0x2015, + which is 208 in ISO6937). + */ + o += (char) 208; + } else if (s[i] == 0x2010 || s[i] == 0x2011 || s[i] == 0x2012) { + /* Similar story with hyphen, non-breaking hyphen, figure dash */ + o += '-'; + } + } return o; diff --git a/test/dcp_to_stl_binary_test.cc b/test/dcp_to_stl_binary_test.cc index 6199c69..bf15bc6 100644 --- a/test/dcp_to_stl_binary_test.cc +++ b/test/dcp_to_stl_binary_test.cc @@ -152,3 +152,53 @@ BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test5) "build/test/065d39ff-6723-4dbf-a94f-849cde82f5e1_sub.stl" ); } + +BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test6) +{ + if (private_test.empty ()) { + return; + } + + boost::filesystem::path p = private_test / "Paddington_FTR_FullSubs_DE_24fps.xml"; + sub::write_stl_binary ( + sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()), + 24, + sub::LANGUAGE_GERMAN, + "", "", + "", "", + "", "", + "300514", "300514", 0, + "GBR", + "", + "", "", + "build/test/Paddington_FTR_FullSubs_DE_24fps.stl" + ); + + check_file ( + private_test / "Paddington_FTR_FullSubs_DE_24fps.stl", + "build/test/Paddington_FTR_FullSubs_DE_24fps.stl" + ); +} + +BOOST_AUTO_TEST_CASE (dcp_to_stl_binary_test7) +{ + boost::filesystem::path p = "test/data/test3.xml"; + sub::write_stl_binary ( + sub::collect<list<sub::Subtitle> > (sub::InteropDCPReader(p).subtitles ()), + 24, + sub::LANGUAGE_GERMAN, + "", "", + "", "", + "", "", + "300514", "300514", 0, + "GBR", + "", + "", "", + "build/test/test3.stl" + ); + + check_file ( + "test/ref/test3.stl", + "build/test/test3.stl" + ); +} |
