[cairo] Early Initialization?
Owen Taylor
otaylor at redhat.com
Wed Mar 21 07:07:39 PDT 2007
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
More information about the cairo
mailing list