if (!encoding || command.empty()) {
command = it->second.textcommand();
needsTermination = !it->second.textnotermination();
- addTextCmd(c);
}
if (mathmode)
addMathSym(c);
+ else
+ addTextCmd(c);
}
return use_math;
}
}
-bool Encodings::isKnownScriptChar(char_type const c, string & preamble)
+string const Encodings::isKnownScriptChar(char_type const c)
{
CharInfoMap::const_iterator const it = unicodesymbols.find(c);
if (it == unicodesymbols.end())
- return false;
+ return string();
+ // FIXME: parse complex textpreamble (may be list or alternatives,
+ // e.g., "subscript,textgreek" or "textcomp|textgreek")
+ if (it->second.textpreamble() == "textgreek"
+ || it->second.textpreamble() == "textcyrillic")
+ return it->second.textpreamble();
+ return string();
+}
- if (it->second.textpreamble() != "textgreek" && it->second.textpreamble() != "textcyr")
- return false;
- if (preamble.empty()) {
- preamble = it->second.textpreamble();
- return true;
- }
- return it->second.textpreamble() == preamble;
+bool Encodings::fontencSupportsScript(string const & fontenc, string const & script)
+{
+ if (script == "textgreek")
+ return (fontenc == "LGR" || fontenc == "TU");
+ if (script == "textcyrillic")
+ return (fontenc == "T2A" || fontenc == "T2B" || fontenc == "T2C"
+ || fontenc == "X2" || fontenc == "TU");
+ return false;
}
flags |= CharInfoForce;
forced.insert(symbol);
} else if (prefixIs(flag, "force=")) {
- vector<string> encodings =
+ vector<string> encs =
getVectorFromString(flag.substr(6), ";");
- for (size_t i = 0; i < encodings.size(); ++i)
- forcedselected[encodings[i]].insert(symbol);
+ for (size_t i = 0; i < encs.size(); ++i)
+ forcedselected[encs[i]].insert(symbol);
flags |= CharInfoForceSelected;
} else if (prefixIs(flag, "force!=")) {
- vector<string> encodings =
+ vector<string> encs =
getVectorFromString(flag.substr(7), ";");
- for (size_t i = 0; i < encodings.size(); ++i)
- forcednotselected[encodings[i]].insert(symbol);
+ for (size_t i = 0; i < encs.size(); ++i)
+ forcednotselected[encs[i]].insert(symbol);
flags |= CharInfoForceSelected;
} else if (flag == "mathalpha") {
mathalpha.insert(symbol);