[cairo] Early Initialization?

Behdad Esfahbod behdad at behdad.org
Mon Apr 9 10:18:29 PDT 2007


On Fri, 2007-03-23 at 17:39 +0100, Johannes Schmid wrote:
> Hi Owen, Behdad!
> 
> Thanks for your help! I think I found a quite good solution now. I still
> have to bother with the default font but the rest seems to give me a
> nice speed-up.
> 
> See https://maemo.org/bugzilla/show_bug.cgi?id=952 for details!

It's doing one small thing wrong: Instead of pango_context_load_font()
you should do pango_context_set_font_description().


> Thanks,
> Johannes
> 
> Owen Taylor schrieb:
> > On Wed, 2007-03-21 at 14:28 +0100, Johannes Schmid wrote:
> >> Hi Behded!
> >>
> >> Behdad Esfahbod schrieb:
> >>>> Create an image surface and render something in the default language and
> >>>> default font ("Sans"?) to it using pangocairo.
> >>> For extra, do it for all font-descriptions that your UI uses (all
> >>> "default" font face+size combinations).
> >> I am not very familiar to cairo but I tried this without any speed-up:
> >>
> >> context = pango_cairo_font_map_create_context (
> >> 	PANGO_CAIRO_FONT_MAP(pango_cairo_font_map_get_default()));
> >> pango_context_load_font (context, 	
> >> 	pango_font_description_from_string("Sans"));
> > 
> > Hmm, I would have actually thought that this would work, but I'd 
> > certainly trust Behdad's suggestion - "render something" - more.
> > 
> >> Maybe someone could point me to the methods I should use to render
> >> something to the pango image surface because I could not figure out yet
> >> with the reference documentation.
> > 
> > http://svn.gnome.org/viewcvs/pango/trunk/examples/cairosimple.c?view=markup
> > 
> > may help. (Obviously, it can get a lot simpler than that, but it shows
> > the basics of rendering to an image surface)
> > 
> > It could just be that the fontconfig memmap'ed cache stuff has dropped
> > startup overhead low enough that the advantage of pre-initializing
> > things is small.
> > 						- Owen
> > 
> > 
> 
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list