Fix handling of \N, \n and \h in the fonts collector

Originally committed to SVN as r6922.
This commit is contained in:
Thomas Goyne 2012-06-26 01:50:41 +00:00
parent 33f475ff3a
commit 400520daa4
1 changed files with 13 additions and 2 deletions

View File

@ -86,8 +86,19 @@ void FontCollector::ProcessDialogueLine(AssDialogue *line, int index) {
if (overriden) if (overriden)
used_styles[style].lines.insert(index); used_styles[style].lines.insert(index);
std::set<wxUniChar>& chars = used_styles[style].chars; std::set<wxUniChar>& chars = used_styles[style].chars;
for (size_t j = 0; j < text.size(); ++j) for (wxString::const_iterator it = text.begin(); it != text.end(); ++it) {
chars.insert(text[j]); wxUniChar cur = *it;
if (cur == L'\\' && it + 1 != text.end()) {
wxUniChar next = *++it;
if (next == 'N' || next == 'n')
continue;
if (next == 'h')
cur = 0xA0;
else
--it;
}
chars.insert(cur);
}
} }
// Do nothing with drawing blocks // Do nothing with drawing blocks
} }