From c511312e7e5af0816ddd6f1c60a93cb02ae24ff9 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 8 Jul 2012 12:14:07 +0900 Subject: Fix for 168658 : Font substitution warning dialog - CSS font fallbacks (bzr r11533) --- src/ui/dialog/font-substitution.cpp | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index 086798f19..d449bad67 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -209,16 +209,34 @@ GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring * std::map::const_iterator mapIter; for (mapIter = mapFontStyles.begin(); mapIter != mapFontStyles.end(); mapIter++) { SPItem *item = mapIter->first; - Glib::ustring font = mapIter->second; - std::set::const_iterator found = setFontSpans.find(font); - if (found == setFontSpans.end()) { - Glib::ustring subName = getSubstituteFontName(font); - if (font != Glib::ustring("sans-serif") && font != Glib::ustring("Sans")) { - Glib::ustring err = Glib::ustring::compose( - "Font '%1' substituted with '%2'", font.c_str(), subName.c_str()); - setErrors.insert(err); - outList = g_slist_prepend (outList, item); + Glib::ustring fonts = mapIter->second; + + // CSS font fallbacks can have more that one font listed, split the font list + std::vector vFonts = Glib::Regex::split_simple("," , fonts); + bool fontFound = false; + for(size_t i=0; i::const_iterator iter = setFontSpans.find(font); + if (iter != setFontSpans.end() || + font == Glib::ustring("sans-serif") || + font == Glib::ustring("Sans")) { + fontFound = true; + break; + } + } + if (fontFound == false) { + Glib::ustring subName = getSubstituteFontName(fonts); + Glib::ustring err = Glib::ustring::compose( + "Font '%1' substituted with '%2'", fonts.c_str(), subName.c_str()); + setErrors.insert(err); + outList = g_slist_prepend (outList, item); } } -- cgit v1.2.3