From 14f6e2bcab3830c642ee4cf3591dc38831485fb1 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 8 Mar 2013 12:52:07 +0100 Subject: Restore CSS generic faux faces. (bzr r12182) --- src/libnrtype/FontFactory.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/libnrtype') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index a1a9ddc89..bb8b0887f 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -741,16 +741,23 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) continue; } - // Disable synthesized (faux) font faces - if (pango_font_face_is_synthesized(faces[currentFace]) ) { - continue; - } - PangoFontDescription *faceDescr = pango_font_face_describe(faces[currentFace]); if (faceDescr) { Glib::ustring familyUIName = GetUIFamilyString(faceDescr); Glib::ustring styleUIName = GetUIStyleString(faceDescr); + // Disable synthesized (faux) font faces except for CSS generic faces + if (pango_font_face_is_synthesized(faces[currentFace]) ) { + if( familyUIName.compare( "sans-serif" ) != 0 && + familyUIName.compare( "serif" ) != 0 && + familyUIName.compare( "monospace" ) != 0 && + familyUIName.compare( "fantasy" ) != 0 && + familyUIName.compare( "cursive" ) != 0 ) { + //std::cout << "faux: " << familyUIName << " | " << styleUIName << std::endl; + continue; + } + } + if (!familyUIName.empty() && !styleUIName.empty()) { // Find the right place to put the style information, adding -- cgit v1.2.3 From f8e68d9b5bf61f2c68e766c4d75cb50240d93364 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 8 Mar 2013 13:31:05 +0100 Subject: Use font-weight names rather than numerical values. Fixes bug when scrolling to URW Chancery L. (bzr r12183) --- src/libnrtype/font-lister.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/libnrtype') diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index 1e3ba01e9..712c17915 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -556,13 +556,13 @@ namespace Inkscape PangoWeight weight = pango_font_description_get_weight( desc ); switch ( weight ) { case PANGO_WEIGHT_THIN: - sp_repr_css_set_property (css, "font-weight", "100" ); + sp_repr_css_set_property (css, "font-weight", "thin" ); break; case PANGO_WEIGHT_ULTRALIGHT: - sp_repr_css_set_property (css, "font-weight", "200" ); + sp_repr_css_set_property (css, "font-weight", "extra light" ); break; case PANGO_WEIGHT_LIGHT: - sp_repr_css_set_property (css, "font-weight", "300" ); + sp_repr_css_set_property (css, "font-weight", "light" ); break; case PANGO_WEIGHT_BOOK: sp_repr_css_set_property (css, "font-weight", "380" ); @@ -571,19 +571,19 @@ namespace Inkscape sp_repr_css_set_property (css, "font-weight", "normal" ); break; case PANGO_WEIGHT_MEDIUM: - sp_repr_css_set_property (css, "font-weight", "500" ); + sp_repr_css_set_property (css, "font-weight", "medium" ); break; case PANGO_WEIGHT_SEMIBOLD: - sp_repr_css_set_property (css, "font-weight", "600" ); + sp_repr_css_set_property (css, "font-weight", "semi bold" ); break; case PANGO_WEIGHT_BOLD: sp_repr_css_set_property (css, "font-weight", "bold" ); break; case PANGO_WEIGHT_ULTRABOLD: - sp_repr_css_set_property (css, "font-weight", "800" ); + sp_repr_css_set_property (css, "font-weight", "extra bold" ); break; case PANGO_WEIGHT_HEAVY: - sp_repr_css_set_property (css, "font-weight", "900" ); + sp_repr_css_set_property (css, "font-weight", "black" ); break; case PANGO_WEIGHT_ULTRAHEAVY: sp_repr_css_set_property (css, "font-weight", "1000" ); -- cgit v1.2.3