From 400520daa42b5d0eb907a8843341d5588d429da5 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 26 Jun 2012 01:50:41 +0000 Subject: [PATCH] Fix handling of \N, \n and \h in the fonts collector Originally committed to SVN as r6922. --- aegisub/src/font_file_lister.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/aegisub/src/font_file_lister.cpp b/aegisub/src/font_file_lister.cpp index 706e2792b..98a1856e2 100644 --- a/aegisub/src/font_file_lister.cpp +++ b/aegisub/src/font_file_lister.cpp @@ -86,8 +86,19 @@ void FontCollector::ProcessDialogueLine(AssDialogue *line, int index) { if (overriden) used_styles[style].lines.insert(index); std::set& chars = used_styles[style].chars; - for (size_t j = 0; j < text.size(); ++j) - chars.insert(text[j]); + for (wxString::const_iterator it = text.begin(); it != text.end(); ++it) { + 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 }