diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2014-04-24 12:04:31 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2014-04-24 12:04:31 +0000 |
| commit | 67c3fc5586ae05506f75bb30fe46a071e20613d2 (patch) | |
| tree | 8469b6ad6668ba9852930950833db245eb70da00 /src/libnrtype | |
| parent | Add missing style-internal.cpp (diff) | |
| download | inkscape-67c3fc5586ae05506f75bb30fe46a071e20613d2.tar.gz inkscape-67c3fc5586ae05506f75bb30fe46a071e20613d2.zip | |
Clean up of style code, removal of SPFontStyle. Step 2.
(bzr r13300)
Diffstat (limited to 'src/libnrtype')
| -rw-r--r-- | src/libnrtype/FontFactory.cpp | 10 | ||||
| -rw-r--r-- | src/libnrtype/Layout-TNG-Input.cpp | 5 | ||||
| -rw-r--r-- | src/libnrtype/font-lister.cpp | 14 |
3 files changed, 14 insertions, 15 deletions
diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 7c0b4ffba..4ae408397 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -825,17 +825,17 @@ font_instance* font_factory::FaceFromStyle(SPStyle const *style) if (style) { // First try to use the font specification if it is set - if (style->text->font_specification.set - && style->text->font_specification.value - && *style->text->font_specification.value) { + if (style->font_specification.set + && style->font_specification.value + && *style->font_specification.value) { - font = FaceFromFontSpecification(style->text->font_specification.value); + font = FaceFromFontSpecification(style->font_specification.value); } // If that failed, try using the CSS information in the style if (!font) { - font = Face(style->text->font_family.value, font_style_to_pos(*style)); + font = Face(style->font_family.value, font_style_to_pos(*style)); // That was a hatchet job... so we need to check if this font exists!! Glib::ustring fontSpec = font_factory::Default()->ConstructFontSpecification(font); diff --git a/src/libnrtype/Layout-TNG-Input.cpp b/src/libnrtype/Layout-TNG-Input.cpp index cb3e6f620..fa1e8c11b 100644 --- a/src/libnrtype/Layout-TNG-Input.cpp +++ b/src/libnrtype/Layout-TNG-Input.cpp @@ -286,16 +286,15 @@ font_instance *Layout::InputStreamTextSource::styleGetFontInstance() const PangoFontDescription *Layout::InputStreamTextSource::styleGetFontDescription() const { - if (style->text == NULL) return NULL; PangoFontDescription *descr = pango_font_description_new(); // Pango can't cope with spaces before or after the commas - let's remove them. // this code is not exactly unicode-safe, but it's similar to what's done in // pango, so it's not the limiting factor Glib::ustring family; - if (style->text->font_family.value == NULL) { + if (style->font_family.value == NULL) { family = "sans-serif"; } else { - gchar **families = g_strsplit(style->text->font_family.value, ",", -1); + gchar **families = g_strsplit(style->font_family.value, ",", -1); if (families) { for (gchar **f = families ; *f ; ++f) { g_strstrip(*f); diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index dde0ee4a9..98589d9d7 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -358,8 +358,8 @@ namespace Inkscape sp_desktop_query_style (SP_ACTIVE_DESKTOP, query, QUERY_STYLE_PROPERTY_FONT_SPECIFICATION); //std::cout << " Attempting selected style" << std::endl; - if( result != QUERY_STYLE_NOTHING && query->text->font_specification.set ) { - fontspec = query->text->font_specification.value; + if( result != QUERY_STYLE_NOTHING && query->font_specification.set ) { + fontspec = query->font_specification.value; //std::cout << " fontspec from query :" << fontspec << ":" << std::endl; } @@ -693,15 +693,15 @@ std::pair<Glib::ustring, Glib::ustring> FontLister::new_font_family (Glib::ustri if (style) { // First try to use the font specification if it is set - if (style->text->font_specification.set - && style->text->font_specification.value - && *style->text->font_specification.value) { + if (style->font_specification.set + && style->font_specification.value + && *style->font_specification.value) { - fontspec = style->text->font_specification.value; + fontspec = style->font_specification.value; } else { - fontspec = style->text->font_family.value; + fontspec = style->font_family.value; fontspec += ","; switch (style->font_weight.computed) { |
