[cairo] New API: cairo_surface_set_fallback_resolution

Keith Packard keithp at keithp.com
Sat Jun 10 13:02:46 PDT 2006


On Sat, 2006-06-10 at 12:09 -0700, Carl Worth wrote:

> * My first attempt at providing support for fallback resolution (patch
>   #6: 6efeb1e1) resulted in shrinking line widths and font sizes as
>   the resolution increased (as can be seen by checking out #7:
>   ebb53b25). The fix for the line width (#8: 74857181) was
>   straightforward, just multiply the scale into the CTM at the
>   surface_stroke level before handing things off to the backend. The
>   similar fix for font size (#9: 100b30d1) actually involves creating
>   a new scaled_font based on an existing one by changing the ctm. What
>   I'm unsure of in this change is if using the different scaled font
>   when replaying to the image fallback will cause things to render
>   incorrectly, (since the glyphs were layed out with a different
>   scaled_font). Or maybe this works correctly and is why the
>   font_matrix (which I am not changing) is separate from the font's
>   CTM?

Alas, creating a new scaled font at the new resolution will generate
different looking output when hinting is applied. The font matrix is
separate from the CTM only to separate font transformations from world
transformations, permitting things like font size changes and slanting
without affecting the measurement units. At our typically high output
resolutions, there should be no visible effect though -- most hinting
programs disable themselves at printer resolutions.

The font backends themselves always multiply these two matrices into a
unified transform before applying it to the font. In fact, the FreeType
backend extracts the scaling factors from the unified matrix, applies
those as font size adjustments, then takes the remaining transform and
applies that to the resulting hinted outlines before rasterization, this
leaves us with glyphs which are hinted at their scaled size and yet
remain invarient under rotation or other non-scaling transforms. This is
"good" in our 2D world, and "bad" in a 3D world.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060610/5e199b73/attachment.pgp


More information about the cairo mailing list