odocstringstream ods;
otexstream os(ods);
runparams.nice = true;
- runparams.flavor = OutputParams::LATEX;
+ runparams.flavor = OutputParams::XETEX;
runparams.linelen = 10000; //lyxrc.plaintext_linelen;
// No side effect of file copying and image conversion
runparams.dryrun = true;
} else {
OutputParams runparams(&buffer.params().encoding());
runparams.nice = true;
- runparams.flavor = OutputParams::LATEX;
+ runparams.flavor = OutputParams::XETEX;
runparams.linelen = 10000; //lyxrc.plaintext_linelen;
runparams.dryrun = true;
runparams.for_search = true;
void resetOpenedP(int openPos);
void addIntervall(int upper);
void addIntervall(int low, int upper); /* if explicit */
+ void removeAccents();
void setForDefaultLang(KeyInfo &defLang);
int findclosing(int start, int end, char up, char down, int repeat);
void handleParentheses(int lastpos, bool closingAllowed);
}
}
+typedef map<string, string> AccentsMap;
+static AccentsMap accents = map<string, string>();
+
+static void buildaccent(string name, string param, string values)
+{
+ size_t start = 0;
+ for (size_t i = 0; i < param.size(); i++) {
+ string key = name + "{" + param[i] + "}";
+ // get the corresponding utf8-value
+ if ((values[start] & 0xc0) != 0xc0) {
+ // should not happen, utf8 encoding starts at least with 11xxxxxx
+ start++;
+ continue;
+ }
+ for (int j = 1; ;j++) {
+ if (start + j >= values.size())
+ break;
+ if ((values[start+j] & 0xc0) == 0xc0) {
+ // This is the first byte of following utf8 char
+ accents[key] = values.substr(start, j);
+ start += j;
+ break;
+ }
+ }
+ }
+}
+
+static void buildAccentsMap()
+{
+ accents["imath"] = "ı";
+ accents["ddot{\\imath}"] = "ï";
+ accents["acute{\\imath}"] = "í";
+ accents["lyxmathsym{ß}"] = "ß";
+ buildaccent("ddot", "aeouyAEOUY", "äëöüÿÄËÖÜŸ");
+ buildaccent("dot", "aeoyzAEOYZ", "ȧėȯẏżȦĖȮẎŻ");
+ buildaccent("acute", "aeouyAEOUY", "äëöüÿÄËÖÜŸ");
+ /*
+ buildaccent("dacute", "oOuU", "őŐűŰ");
+ buildaccent("H", "oOuU", "őŐűŰ"); // dacute in text
+ */
+ buildaccent("mathring", "uU", "ůŮ");
+ buildaccent("r", "uU", "ůŮ"); //mathring in text
+ buildaccent("check", "cdnrszCDNRSZ", "čďřňšžČĎŘŇŠŽ");
+ buildaccent("hat", "cCoOgGhHsS", "ĉĈôÔĝĜĥĤŝŜ");
+ buildaccent("bar", "aAeE", "āĀēĒ");
+}
+
+/*
+ * Created accents in math or regexp environment
+ * are macros, but we need the utf8 equivalent
+ */
+void Intervall::removeAccents()
+{
+ if (accents.empty())
+ buildAccentsMap();
+ static regex const accre("\\\\((lyxmathsym|ddot|dot|acute|mathring|r|check|check|hat|bar)\\{[^\\{\\}]+\\}|imath)");
+ smatch sub;
+ for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) {
+ sub = *itacc;
+ string key = sub.str(1);
+ if (accents.find(key) != accents.end()) {
+ string val = accents[key];
+ size_t pos = sub.position(0);
+ for (size_t i = 0; i < val.size(); i++) {
+ par[pos+i] = val[i];
+ }
+ addIntervall(pos+val.size(), pos + sub.str(0).size());
+ }
+ else {
+ LYXERR0("Not added accent for \"" << key << "\"");
+ }
+ }
+}
+
void Intervall::handleOpenP(int i)
{
actualdeptindex++;
size_t math_pos = 10000;
string math_end;
+ interval.removeAccents();
+
for (sregex_iterator itmath(interval.par.begin(), interval.par.end(), rmath), end; itmath != end; ++itmath) {
submath = *itmath;
if (math_end_waiting) {
found.parenthesiscount = 0;
found.head = interval.par.substr(found._tokenstart, found._tokensize);
}
- else
+ else {
continue;
+ }
}
else {
if (evaluatingMath) {
int(par.size()) : cur.pos() + len;
OutputParams runparams(&cur.buffer()->params().encoding());
runparams.nice = true;
- runparams.flavor = OutputParams::LATEX;
+ runparams.flavor = OutputParams::XETEX;
runparams.linelen = 10000; //lyxrc.plaintext_linelen;
// No side effect of file copying and image conversion
runparams.dryrun = true;
otexstream os(ods);
OutputParams runparams(&buf.params().encoding());
runparams.nice = false;
- runparams.flavor = OutputParams::LATEX;
+ runparams.flavor = OutputParams::XETEX;
runparams.linelen = 8000; //lyxrc.plaintext_linelen;
// No side effect of file copying and image conversion
runparams.dryrun = true;
otexstream os(ods);
OutputParams runparams(&repl_buffer.params().encoding());
runparams.nice = false;
- runparams.flavor = OutputParams::LATEX;
+ runparams.flavor = OutputParams::XETEX;
runparams.linelen = 8000; //lyxrc.plaintext_linelen;
runparams.dryrun = true;
TeXOnePar(repl_buffer, repl_buffer.text(), 0, os, runparams);