Extend unicodesymbols force flag

As suggested by Günter Milde.
This commit is contained in:
Georg Baum 2013-02-19 22:19:10 +01:00
parent b353a0b037
commit 9f93983b61
2 changed files with 20 additions and 2 deletions

View File

@ -35,9 +35,11 @@
# Therefore it may depend on the whole document contents which feature is chosen.
# Known flags:
# - combining This is a combining char that will get combined with a base char
# - force Always output replacement command except for encodings
# with iconv name "UTF-8"
# - force Always output replacement command
# - force=enc1;enc2... Always output replacement command in the specified encodings.
# - force!=en1;en2... Always output replacement command in all but the specified encodings.
# Symbols are never forced in encodings with iconv name
# UTF-8 and package none (currently only utf8-plain).
# - mathalpha This character is considered as a math variable in mathmode
# - notermination=text Do not terminate this textcommand (by {} or space).
# This is set by default if textcommand ends with }.

View File

@ -896,6 +896,7 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
{
// We must read the symbolsfile first, because the Encoding
// constructor depends on it.
CharSetMap forcednotselected;
Lexer symbolslex;
symbolslex.setFile(symbolsfile);
bool getNextToken = true;
@ -947,6 +948,12 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
for (size_t i = 0; i < encodings.size(); ++i)
forcedselected[encodings[i]].insert(symbol);
info.flags |= CharInfoForceSelected;
} else if (prefixIs(flag, "force!=")) {
vector<string> encodings =
getVectorFromString(flag.substr(7), ";");
for (size_t i = 0; i < encodings.size(); ++i)
forcednotselected[encodings[i]].insert(symbol);
info.flags |= CharInfoForceSelected;
} else if (flag == "mathalpha") {
mathalpha.insert(symbol);
} else if (flag == "notermination=text") {
@ -1094,6 +1101,15 @@ void Encodings::read(FileName const & encfile, FileName const & symbolsfile)
break;
}
}
// Move all information from forcednotselected to forcedselected
for (CharSetMap::const_iterator it1 = forcednotselected.begin(); it1 != forcednotselected.end(); ++it1) {
for (CharSetMap::iterator it2 = forcedselected.begin(); it2 != forcedselected.end(); ++it2) {
if (it2->first != it1->first)
it2->second.insert(it1->second.begin(), it1->second.end());
}
}
}