[rrd-developers] [rrd] Re: pango / fontconfig / cairo performance with rrdtool

Tobias Oetiker tobi at oetiker.ch
Thu Sep 4 23:38:11 CEST 2008


Hi Behdad,

> No, unless you:
>
>   - Use a different fontmap each time (that is, you use
> pango_cairo_font_map_new())
>
>   - Call pango_fc_font_map_clear_cache()
>
>   - Use more than 64 different font descriptions
>
> none of which you seem to be doing.

drawing from the don'ts, I have modified my system as follows.

    static PangoFontMap *fontmap = NULL;

    surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100, 100);
    cr = cairo_create(surface);

    if (fontmap == NULL){
        fontmap = pango_cairo_font_map_get_default();
    }

    context = pango_cairo_font_map_create_context((PangoCairoFontMap*)fontmap);

    pango_cairo_context_set_resolution(context, 100);

    pango_cairo_update_context(cr,context);

    layout = pango_layout_new(context);

this seems to work and I like to think that it is because I
preserve the font map across multiple graphs ...

cheers and thanks for the help

tobi


-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-developers mailing list