summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-07-08 03:14:07 +0000
committerJohn Smith <john.smith7545@yahoo.com>2012-07-08 03:14:07 +0000
commitc511312e7e5af0816ddd6f1c60a93cb02ae24ff9 (patch)
treef93b64441036ff1c00d78cf8caff7f575c6a9787 /src
parentFix for 181473 : Layer label edit keyboard shortcuts (diff)
downloadinkscape-c511312e7e5af0816ddd6f1c60a93cb02ae24ff9.tar.gz
inkscape-c511312e7e5af0816ddd6f1c60a93cb02ae24ff9.zip
Fix for 168658 : Font substitution warning dialog - CSS font fallbacks
(bzr r11533)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/font-substitution.cpp36
1 files changed, 27 insertions, 9 deletions
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<SPItem *, Glib::ustring>::const_iterator mapIter;
for (mapIter = mapFontStyles.begin(); mapIter != mapFontStyles.end(); mapIter++) {
SPItem *item = mapIter->first;
- Glib::ustring font = mapIter->second;
- std::set<Glib::ustring>::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<Glib::ustring> vFonts = Glib::Regex::split_simple("," , fonts);
+ bool fontFound = false;
+ for(size_t i=0; i<vFonts.size(); i++) {
+ Glib::ustring font = vFonts[i];
+ // trim whitespace
+ size_t startpos = font.find_first_not_of(" \n\r\t");
+ size_t endpos = font.find_last_not_of(" \n\r\t");
+ if(( std::string::npos == startpos ) || ( std::string::npos == endpos)) {
+ continue; // empty font name
}
+ font = font.substr( startpos, endpos-startpos+1 );
+ std::set<Glib::ustring>::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);
}
}