FindAdv: Amend b21c8b21: Expand the list for handled latin characters

1.) Added for 'breve' and 'grave' accents
2.) Corrected handling for 'i'-accents (allowed \hat{i} _and_ \hat{\imath})
	because of problems with ignoring case
3.) Spaces: Changed some indents in source
This commit is contained in:
Kornel Benko 2019-03-04 14:05:44 +01:00
parent fd106637be
commit cd4ae51f77

View File

@ -1262,19 +1262,22 @@ static void buildaccent(string n, string param, string values)
string key = name + "{" + param[i] + "}"; string key = name + "{" + param[i] + "}";
// get the corresponding utf8-value // get the corresponding utf8-value
if ((values[start] & 0xc0) != 0xc0) { if ((values[start] & 0xc0) != 0xc0) {
// should not happen, utf8 encoding starts at least with 11xxxxxx // should not happen, utf8 encoding starts at least with 11xxxxxx
start++; start++;
continue; continue;
} }
for (int j = 1; ;j++) { for (int j = 1; ;j++) {
if (start + j >= values.size()) if (start + j >= values.size()) {
break; accents[key] = values.substr(start, j);
if ((values[start+j] & 0xc0) == 0xc0) { start = values.size() - 1;
// This is the first byte of following utf8 char break;
accents[key] = values.substr(start, j); }
start += j; else if ((values[start+j] & 0xc0) == 0xc0) {
break; // This is the first byte of following utf8 char
} accents[key] = values.substr(start, j);
start += j;
break;
}
} }
} }
} }
@ -1283,32 +1286,39 @@ static void buildaccent(string n, string param, string values)
static void buildAccentsMap() static void buildAccentsMap()
{ {
accents["imath"] = "ı"; accents["imath"] = "ı";
accents["i"] = "ı";
accents["jmath"] = "ȷ"; accents["jmath"] = "ȷ";
accents["lyxmathsym{ß}"] = "ß"; accents["lyxmathsym{ß}"] = "ß";
accents["ddot{\\imath}"] = "ï"; accents["ddot{\\imath}"] = "ï";
buildaccent("ddot", "aAeEIoOuUyY", buildaccent("ddot", "aAeEiIoOuUyY",
"äÄëËÏöÖüÜÿŸ"); // umlaut "äÄëËïÏöÖüÜÿŸ"); // umlaut
buildaccent("dot|.", "cCeEgGIzZaAoObBdDfFyY", buildaccent("dot|.", "cCeEgGiIzZaAoObBdDfFyY",
"ċĊėĖġĠİżŻȧȦȯȮḃḂḋḊḟḞẏẎ"); "ċĊėĖġĠiİżŻȧȦȯȮḃḂḋḊḟḞẏẎ");
accents["acute{\\imath}"] = "í"; accents["acute{\\imath}"] = "í";
buildaccent("acute", "aAcCeElLoOnNrRsSuUyYzZI", buildaccent("acute", "aAcCeElLoOnNrRsSuUyYzZiI",
"áÁćĆéÉĺĹóÓńŃŕŔśŚúÚýÝźŹÍ"); "áÁćĆéÉĺĹóÓńŃŕŔśŚúÚýÝźŹíÍ");
buildaccent("dacute|H|h", "oOuU", "őŐűŰ"); // double acute buildaccent("dacute|H|h", "oOuU", "őŐűŰ"); // double acute
buildaccent("mathring|r", "uU", "ůŮ"); buildaccent("mathring|r", "uU", "ůŮ");
accents["check{\\imath}"] = "ǐ"; accents["check{\\imath}"] = "ǐ";
accents["check{\\jmath}"] = "ǰ"; accents["check{\\jmath}"] = "ǰ";
buildaccent("check|v", "cCdDaAeEIoOuUgGkKhHlLnNrRsSTzZ", buildaccent("check|v", "cCdDaAeEiIoOuUgGkKhHlLnNrRsSTzZ",
"čČďĎǎǍěĚǏǒǑǔǓǧǦǩǨȟȞľĽňŇřŘšŠŤžŽ"); // caron "čČďĎǎǍěĚǐǏǒǑǔǓǧǦǩǨȟȞľĽňŇřŘšŠŤžŽ"); // caron
accents["hat{\\imath}"] = "î"; accents["hat{\\imath}"] = "î";
accents["hat{\\jmath}"] = "ĵ"; accents["hat{\\jmath}"] = "ĵ";
buildaccent("hat|^", "aAeEiIcCgGhHJsSwWyYzZoOuU", buildaccent("hat|^", "aAeEiIcCgGhHjJsSwWyYzZoOuU",
"âÂêÊîÎĉĈĝĜĥĤĴŝŜŵŴŷŶẑẐôÔûÛ"); // circ "âÂêÊîÎĉĈĝĜĥĤĵĴŝŜŵŴŷŶẑẐôÔûÛ"); // circ
accents["bar{\\imath}"] = "ī"; accents["bar{\\imath}"] = "ī";
buildaccent("bar|=", "aAeEIoOuUyY", buildaccent("bar|=", "aAeEiIoOuUyY",
"āĀēĒĪōŌūŪȳȲ"); // macron "āĀēĒīĪōŌūŪȳȲ"); // macron
accents["tilde{\\imath}"] = "ĩ"; accents["tilde{\\imath}"] = "ĩ";
buildaccent("tilde", "aAnNoOIuU", buildaccent("tilde", "aAnNoOiIuU",
"ãÃñÑõÕĨũŨ"); // tilde "ãÃñÑõÕĩĨũŨ"); // tilde
accents["breve{\\imath}"] = "ĭ";
buildaccent("breve|u", "aAeEgGiIoOuU",
"ăĂĕĔğĞĭĬŏŎŭŬ"); // breve
accents["grave{\\imath}"] = "ì";
buildaccent("grave|`", "aAeEiIoOuUnNwWyY",
"àÀèÈìÌòÒùÙǹǸẁẀỳỲ"); // grave
} }
/* /*
@ -1319,7 +1329,7 @@ void Intervall::removeAccents()
{ {
if (accents.empty()) if (accents.empty())
buildAccentsMap(); buildAccentsMap();
static regex const accre("\\\\((lyxmathsym|ddot|dot|.|acute|dacute|h|H|mathring|r|check|v|hat|^|bar|=|tilde)\\{[^\\{\\}]+\\}|imath|jmath)"); static regex const accre("\\\\((.|grave|breve|u|lyxmathsym|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde)\\{[^\\{\\}]+\\}|i|imath|jmath)");
smatch sub; smatch sub;
for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) { for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) {
sub = *itacc; sub = *itacc;
@ -2569,14 +2579,14 @@ static string correctlanguagesetting(string par, bool isPatternString, bool with
missed = 0; missed = 0;
if (withformat) { if (withformat) {
regex_f = identifyFeatures(result); regex_f = identifyFeatures(result);
string features = ""; string features = "";
for (auto it = regex_f.cbegin(); it != regex_f.cend(); ++it) { for (auto it = regex_f.cbegin(); it != regex_f.cend(); ++it) {
string a = it->first; string a = it->first;
regex_with_format = true; regex_with_format = true;
features += " " + a; features += " " + a;
// LYXERR0("Identified regex format:" << a); // LYXERR0("Identified regex format:" << a);
} }
LYXERR(Debug::FIND, "Identified Features" << features); LYXERR(Debug::FIND, "Identified Features" << features);
} }
} else if (regex_with_format) { } else if (regex_with_format) {