]> git.lyx.org Git - lyx.git/blobdiff - src/Encoding.cpp
Paragraph::inInset() shall not be used if the owner inset was not initialized. Make...
[lyx.git] / src / Encoding.cpp
index 7aee70c9b8b3d5e9cdf06810b77ecc06333167a2..99d216f418c2048e70b2422bd49574d4613d13e1 100644 (file)
@@ -333,7 +333,7 @@ void Encoding::init() const
 }
 
 
-docstring Encoding::latexChar(char_type c) const
+docstring Encoding::latexChar(char_type c, bool for_mathed) const
 {
        // assure the used encoding is properly initialized
        init();
@@ -344,6 +344,8 @@ docstring Encoding::latexChar(char_type c) const
                return docstring(1, c);
        if (encodable_.find(c) != encodable_.end())
                return docstring(1, c);
+       if (for_mathed)
+               return docstring();
 
        // c cannot (or should not) be encoded in this encoding
        CharInfoMap::const_iterator const it = unicodesymbols.find(c);
@@ -375,8 +377,14 @@ vector<char_type> Encoding::symbolsList() const
 }
 
 
-bool Encodings::latexMathChar(char_type c, docstring & command)
+bool Encodings::latexMathChar(char_type c, Encoding const * encoding,
+                               docstring & command)
 {
+       if (encoding) {
+               command = encoding->latexChar(c, true);
+               if (!command.empty())
+                       return false;
+       }
        CharInfoMap::const_iterator const it = unicodesymbols.find(c);
        if (it == unicodesymbols.end())
                throw EncodingException(c);
@@ -437,7 +445,7 @@ docstring Encodings::fromLaTeXCommand(docstring const & cmd, docstring & rem)
 
                CharInfoMap::const_iterator it = unicodesymbols.begin();
                size_t unicmd_size = 0;
-               char_type c;
+               char_type c = 0;
                for (; it != uniend; ++it) {
                        docstring const math = it->second.mathcommand;
                        docstring const text = it->second.textcommand;
@@ -753,6 +761,8 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
                                package = Encoding::inputenc;
                        else if (p == "CJK")
                                package = Encoding::CJK;
+                       else if (p == "japanese")
+                               package = Encoding::japanese;
                        else
                                lex.printError("Unknown package");