Logo Search packages:      
Sourcecode: inkscape version File versions

enum CRStatus cr_style_set_props_to_initial_values ( CRStyle *  a_this  ) 

Sets the style properties to their initial value according to the css2 spec. This function should be used to initialize the style of the root element of an xml tree. Some properties are user agent dependant like font-family, and are not initialized, read the spec to make you renderer compliant.

Parameters:
a_this the current instance of CRStyle.
Returns:
CR_OK upon successfull completion, an error code otherwise.

Definition at line 1839 of file cr-style.c.

Referenced by cr_style_new().

{
        glong i = 0;

        g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR);

        for (i = 0; i < NB_NUM_PROPS; i++) {
                switch (i) {
                case NUM_PROP_WIDTH:
                        cr_num_set (&a_this->num_props[i].sv, 800,
                                    NUM_LENGTH_PX) ;
                        break ;
                case NUM_PROP_TOP:
                case NUM_PROP_RIGHT:
                case NUM_PROP_BOTTOM:
                case NUM_PROP_LEFT:
                        cr_num_set (&a_this->num_props[i].sv, 0, NUM_AUTO);
                        break;

                case NUM_PROP_PADDING_TOP:
                case NUM_PROP_PADDING_RIGHT:
                case NUM_PROP_PADDING_BOTTOM:
                case NUM_PROP_PADDING_LEFT:
                case NUM_PROP_BORDER_TOP:
                case NUM_PROP_BORDER_RIGHT:
                case NUM_PROP_BORDER_BOTTOM:
                case NUM_PROP_BORDER_LEFT:
                case NUM_PROP_MARGIN_TOP:
                case NUM_PROP_MARGIN_RIGHT:
                case NUM_PROP_MARGIN_BOTTOM:
                case NUM_PROP_MARGIN_LEFT:
                        cr_num_set (&a_this->num_props[i].sv,
                                    0, NUM_LENGTH_PX);
                        break;

                default:
                        cr_utils_trace_info ("Unknown property");
                        break;
                }
        }

        for (i = 0; i < NB_RGB_PROPS; i++) {

                switch (i) {
                        /*default foreground color is black */
                case RGB_PROP_COLOR:
                        cr_rgb_set (&a_this->rgb_props[i].sv, 0, 0, 0, FALSE);
                        break;

                        /*default background color is white */
                case RGB_PROP_BACKGROUND_COLOR:
                        cr_rgb_set (&a_this->rgb_props[i].sv,
                                    255, 255, 255, FALSE);
                        cr_rgb_set_to_transparent (&a_this->rgb_props[i].sv,
                                                   TRUE) ;                        
                        break;
                default:
                        cr_rgb_set (&a_this->rgb_props[i].sv, 0, 0, 0, FALSE);
                        break;
                }
        }

        for (i = 0; i < NB_BORDER_STYLE_PROPS; i++) {
                a_this->border_style_props[i] = BORDER_STYLE_NONE;
        }

        a_this->display = DISPLAY_BLOCK;
        a_this->position = POSITION_STATIC;
        a_this->float_type = FLOAT_NONE;
        a_this->font_style = FONT_STYLE_NORMAL;
        a_this->font_variant = FONT_VARIANT_NORMAL;
        a_this->font_weight = FONT_WEIGHT_NORMAL;
        a_this->font_stretch = FONT_STRETCH_NORMAL;
      a_this->white_space = WHITE_SPACE_NORMAL;
        cr_font_size_set_predefined_absolute_font_size
                (&a_this->font_size.sv, FONT_SIZE_MEDIUM) ;
        a_this->inherited_props_resolved = FALSE ;

        return CR_OK;
}


Generated by  Doxygen 1.6.0   Back to index