]> git.lyx.org Git - lyx.git/blobdiff - src/Encoding.cpp
adjust
[lyx.git] / src / Encoding.cpp
index 6f009046a3ede0bcf08f0d6e1089cd165d01cf09..9e7f139cd3aa70ac6df69ff1c7fc95ed8ffdf277 100644 (file)
@@ -401,6 +401,25 @@ bool Encodings::isCombiningChar(char_type c)
 }
 
 
+bool Encodings::isKnownLangChar(char_type c, string & preamble)
+{
+       CharInfoMap::const_iterator const it = unicodesymbols.find(c);
+
+       if (it == unicodesymbols.end())
+               return false;
+
+       if (it->second.preamble != "textgreek" &&
+           it->second.preamble != "textcyr")
+               return false;
+
+       if (preamble.empty()) {
+               preamble = it->second.preamble;
+               return true;
+       }
+       return it->second.preamble == preamble;
+}
+
+
 Encoding const * Encodings::getFromLyXName(string const & name) const
 {
        EncodingList::const_iterator it = encodinglist.find(name);
@@ -519,26 +538,30 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
                        string const iconvname = lex.getString();
                        lex.next();
                        string const width = lex.getString();
-                       bool fixedwidth;
+                       bool fixedwidth = false;
                        if (width == "fixed")
                                fixedwidth = true;
                        else if (width == "variable")
                                fixedwidth = false;
-                       else
+                       else {
                                lex.printError("Encodings::read: "
                                               "Unknown width: `$$Token'");
+                        }
+                        
                        lex.next();
                        string const p = lex.getString();
-                       Encoding::Package package;
+                       Encoding::Package package = Encoding::none;
                        if (p == "none")
-                               package = Encoding::none;
+                                package = Encoding::none;
                        else if (p == "inputenc")
                                package = Encoding::inputenc;
                        else if (p == "CJK")
                                package = Encoding::CJK;
-                       else
+                       else {
                                lex.printError("Encodings::read: "
                                               "Unknown package: `$$Token'");
+                        }
+                        
                        LYXERR(Debug::INFO) << "Reading encoding " << name << endl;
                        encodinglist[name] = Encoding(name, latexname,
                                                      iconvname, fixedwidth,