Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

static void sp_style_merge_font_size_from_parent ( SPIFontSize child,
SPIFontSize const &  parent 
) [static]

Todo:
fixme: SVG and CSS do not specify clearly, whether we should use user or screen coordinates (Lauris)

Definition at line 1281 of file style.cpp.

References SPIFontSize::computed, SPIFontSize::inherit, SPIFontSize::set, SPIFontSize::type, and SPIFontSize::value.

Referenced by sp_style_merge_from_parent().

{
    /* 'font-size' */
    if (!child.set || child.inherit) {
        /* Inherit the computed value.  Reference: http://www.w3.org/TR/SVG11/styling.html#Inheritance */
        child.computed = parent.computed;
    } else if (child.type == SP_FONT_SIZE_LITERAL) {
        /** \todo
         * fixme: SVG and CSS do not specify clearly, whether we should use
         * user or screen coordinates (Lauris)
         */
        if (child.value < SP_CSS_FONT_SIZE_SMALLER) {
            child.computed = font_size_table[child.value];
        } else if (child.value == SP_CSS_FONT_SIZE_SMALLER) {
            child.computed = parent.computed / 1.2;
        } else if (child.value == SP_CSS_FONT_SIZE_LARGER) {
            child.computed = parent.computed * 1.2;
        } else {
            /* Illegal value */
        }
    } else if (child.type == SP_FONT_SIZE_PERCENTAGE) {
        /* Unlike most other lengths, percentage for font size is relative to parent computed value
         * rather than viewport. */
        child.computed = parent.computed * SP_F8_16_TO_FLOAT(child.value);
    }
}


Generated by  Doxygen 1.6.0   Back to index