]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeXFeatures.cpp
The logic of the endParagraph() routine is wrong. We should first
[lyx.git] / src / LaTeXFeatures.cpp
index 41db004897b44fd6450feee013dd46310482098d..f1d315cae84e3341ebea09efdff2715cce1b9aeb 100644 (file)
@@ -576,6 +576,7 @@ char const * simplefeatures[] = {
        "mathrsfs",
        "mathabx",
        "mathtools",
+       "cancel",
        "ascii",
        "url",
        "covington",
@@ -1155,6 +1156,15 @@ docstring const getFloatI18nPreamble(docstring const & type,
                        docstring const & name, Language const * lang,
                        Encoding const & enc, bool const polyglossia)
 {
+       // Check whether name can be encoded in the buffer encoding
+       bool encodable = true;
+       for (size_t i = 0; i < name.size(); ++i) {
+               if (!enc.encodable(name[i])) {
+                       encodable = false;
+                       break;
+               }
+       }
+
        docstring const language = polyglossia ? from_ascii(lang->polyglossia())
                                               : from_ascii(lang->babel());
        docstring const langenc = from_ascii(lang->encoding()->iconvName());
@@ -1162,7 +1172,7 @@ docstring const getFloatI18nPreamble(docstring const & type,
        docstring const bufenc = from_ascii(enc.iconvName());
        docstring const s1 = docstring(1, 0xF0000);
        docstring const s2 = docstring(1, 0xF0001);
-       docstring const translated = (langenc == bufenc) ? name
+       docstring const translated = encodable ? name
                : from_ascii("\\inputencoding{") + texenc + from_ascii("}")
                        + s1 + langenc + s2 + name + s1 + bufenc + s2;