[rrd-developers] [rrd] Re: pango / fontconfig / cairo performance with rrdtool
tobi at oetiker.ch
Mon Sep 1 01:58:31 CEST 2008
Yesterday Behdad Esfahbod wrote:
> Tobias Oetiker wrote:
> > Behdad,
> >> Hi Tobias,
> >> The part creating the layout looks good. Any *interesting* thing will be
> >> hidden in other parts of the code, namely the code calling this function. In
> >> general I'm quite surprised that you are hitting the load_fontset() path all
> >> the time as the fontsets should be cached and simply reused. One way to debug
> >> it is to run with FC_DEBUG=1 and look for all different Sort Patterns passed
> >> to fontconfig and see how they differ (I'm guessing minor difference in the size).
> > I just finished modifying the code, so that I am keeping multiple
> > sets of PangoFontDescriptions for each combination of font and
> > size. I then pass the FontDescription into the text function. This
> > magically resolved the problem ... now the load_fontset gets only
> > called 3 times or so ...
> > Does this match expectations ?
> Not really. As I said, most probably you have been creating
> slightly-different font descriptions. You can run the old code and print out
> the font descriptions to see what has been causing it. In general you should
> not need to cache much to make Pango behave. Just use the default font map
> (which you are) and it should work reasonably.
I am using the same font name across the board in 4 different sizes.
DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier 7
DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier 8
DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier 9
DejaVu Sans Mono,Bitstream Vera Sans Mono,monospace,Courier 5.5
Is there a way to figure what font pango picked based on my
description and then tell it to use this one again ?
Could it be that when I ask for font
that pango finds
and then when I ask again for
it goes looking again ?
Could it be that I am doing something that makes pango forget about
the fonts (flush its cache).
How should I be structuring my program for optimal results.
Have a separate layout for each font I am going to use and then
switch layout according to the font ?
As I said, I have shuffled my code around and suddenly the time
for generating a second graph has gone down dramatically. I just
don't know exactly why.
shuffled code with separate PangoFontDescription structures for
each font/size which I then apply to the layout as required:
rrd 1.2 code with libart/freetype:
> > cheers
> > 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