Question about gstate transitions and scaled fonts

Martin Robinson <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
I noticed recently that when rendering some text with the Cairo GL
backend, I was always getting glyph cache misses from the in-texture
cache. After some tracing I realized the issue was that I had code like
this:

cairo_select_font_face(...);
for (...) {
    cairo_save(...);
    cairo_show_text(...);
    cairo_restore(...);
}

It seems that _cairo_gstate_ensure_scaled_font and
_cairo_gstate_ensure_font_face are only called until after
cairo_save(...). Now it's quite possible to simply copy back the lazily
initialized fonts when they haven't been invalidated by adding a simple
check to _cairo_gstate_restore.

The problem with this is that, judging by the code, scaled fonts are
often invalidated. For instance, translating the CTM will clear the
scaled font completely. Is this necessary to properly handle subpixel
antialiasing or can we avoid clearing the font in this case?

The main problem with texture glyph cache misses in the GL backend is
that they involve uploading a bunch of bitmap data to texture memory,
which carries some overhead. Avoiding it would be great.

It's possible I've completely misunderstood this entire bundle of ideas
though, so feel free to correct me!

--Martin


--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.