[cairo] [PATCH] Improve handling of degenerate font matrices

Andrea Canciani ranma42 at gmail.com
Sat Feb 5 02:20:03 PST 2011


A first step towards the handling of degenerate matrices can be the handling of
degenerate font scale matrices.

This should be relatively easy, because cairo already supports 0-size fonts and
because this drawing operation always degenerates in either a noop or a clear
operation (depending on the mask-boundedness of the operator).

The two 0001 attachments conflict (intentionally). Both change set_font_size
to reuse the code from set_font_matrix, but one in cairo-gstate.c, the other
one in cairo.c. I like the change in cairo.c better, because it
effectively makes
set_font_size an utility function wrapping set_font_matrix and avoids any
special-case for it in the "real code" (it just provides the utility
function in the
public API).

0002 makes it possible to create scaled fonts with 1 rank matrices. This
needs to be tested (as in "tests for it should be added"). It currently adds
a failure in invalid-matrix, but this is expected, because the "invalid" matrix
is now considered ok.

0003 is the "real" thing.

0004 is just a cleanup patch.

I don't completely understand what
_cairo_matrix_compute_basis_scale_factors is supposed to do.
It is only used in font code and its documentation seems to be font-oriented
and incorrect. Was it supposed to be an SVD?

Degenerate matrices should be mostly ok for paint, mask and fill if we
extend pattern_is_solid_color to also handle them (ok, I'm cheating,
we need a new "simplify_pattern" function, because degenerate matrices
could produce non-solid gradients).

Stroking will be harder, because we will need to make sure that degenerate
pens work correctly. On the lucky side, degenerate pens are actually easier
to stroke with than generic pens.

Andrea
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Make-cairo_set_font_size-a-wrapper-of-cairo_set_font.patch
Type: application/octet-stream
Size: 2386 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110205/157f6310/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Reuse-_cairo_state_set_font_matrix-logic-in-_cairo_g.patch
Type: application/octet-stream
Size: 1183 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110205/157f6310/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Handle-fonts-with-degenerate-matrices.patch
Type: application/octet-stream
Size: 4558 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110205/157f6310/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-gstate-Degenerate-font-drawing-is-a-noop.patch
Type: application/octet-stream
Size: 1210 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110205/157f6310/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-quartz-font-Remove-unused-variables.patch
Type: application/octet-stream
Size: 1927 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110205/157f6310/attachment-0004.obj>


More information about the cairo mailing list