]> git.lyx.org Git - lyx.git/blobdiff - src/Encoding.cpp
Safer temp file creation with regards to double slash.
[lyx.git] / src / Encoding.cpp
index 7aee70c9b8b3d5e9cdf06810b77ecc06333167a2..cfdc6ebd837fb1c23a21653fb52d9b58fe6e713b 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;