diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2014-10-03 18:04:47 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2014-10-03 18:04:47 +0000 |
| commit | d8abd3bf6c942e0fec619ce21723c1a10b3b0bae (patch) | |
| tree | 251042809d7dc9b6c67c42077002bae53009c6a1 /src/libnrtype | |
| parent | Removal of unused code dealing with PangoStringToDescrMap and UIStringToPango... (diff) | |
| download | inkscape-d8abd3bf6c942e0fec619ce21723c1a10b3b0bae.tar.gz inkscape-d8abd3bf6c942e0fec619ce21723c1a10b3b0bae.zip | |
Allow one style entry per unique CSS style for each family.
(bzr r13341.1.240)
Diffstat (limited to 'src/libnrtype')
| -rw-r--r-- | src/libnrtype/FontFactory.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 19117629a..c8f5e1fef 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -260,10 +260,10 @@ static int StyleNameValue( const Glib::ustring &style ) } // Determines order in which styles are presented (sorted by CSS style values) -static bool StyleNameCompareInternal(const StyleNames &style1, const StyleNames &style2) -{ - return( StyleNameValue( style1.CssName ) < StyleNameValue( style2.CssName ) ); -} +//static bool StyleNameCompareInternal(const StyleNames &style1, const StyleNames &style2) +//{ +// return( StyleNameValue( style1.CssName ) < StyleNameValue( style2.CssName ) ); +//} static gint StyleNameCompareInternalGlib(gconstpointer a, gconstpointer b) { @@ -366,7 +366,19 @@ GList* font_factory::GetUIStyles(PangoFontFamily * in) styleUIName.replace( f, 11, "Heavy" ); } - if (!familyUIName.empty() && !styleUIName.empty()) { + bool exists = false; + for(GList *temp = ret; temp; temp = temp->next) { + if( ((StyleNames*)temp->data)->CssName.compare( styleUIName ) == 0 ) { + exists = true; + std::cerr << "Warning: Font face with same CSS values already added: " + << familyUIName << " " << styleUIName + << " (" << ((StyleNames*)temp->data)->DisplayName + << ", " << displayName << ")" << std::endl; + break; + } + } + + if (!exists && !familyUIName.empty() && !styleUIName.empty()) { // Add the style information ret = g_list_append(ret, new StyleNames(styleUIName, displayName)); } @@ -375,6 +387,7 @@ GList* font_factory::GetUIStyles(PangoFontFamily * in) } g_free(faces); + // Sort the style lists ret = g_list_sort( ret, StyleNameCompareInternalGlib ); return ret; } |
