Logo Search packages:      
Sourcecode: inkscape version File versions

double sp_desktop_get_font_size_tool ( SPDesktop desktop  ) 

Returns the font size (in SVG pixels) of the text tool style (if text tool uses its own style) or desktop style (otherwise).

Definition at line 357 of file desktop-style.cpp.

References Inkscape::XML::Node::attribute(), SPIFontSize::computed, SPStyle::font_size, sp_style_merge_from_style_string(), sp_style_new(), and sp_style_unref().

{
    (void)desktop; // TODO cleanup
    gchar const *desktop_style = inkscape_get_repr(INKSCAPE, "desktop")->attribute("style");
    gchar const *style_str = NULL;
    if ((prefs_get_int_attribute("tools.text", "usecurrent", 0) != 0) && desktop_style) {
        style_str = desktop_style;
    } else {
        Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, "tools.text");
        if (tool_repr) {
            style_str = tool_repr->attribute("style");
        }
    }

    double ret = 12;
    if (style_str) {
        SPStyle *style = sp_style_new(SP_ACTIVE_DOCUMENT);
        sp_style_merge_from_style_string(style, style_str);
        ret = style->font_size.computed;
        sp_style_unref(style);
    }
    return ret;
}


Generated by  Doxygen 1.6.0   Back to index