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

Behdad Esfahbod behdad at behdad.org
Sat Feb 5 15:26:55 PST 2011


On 02/05/11 05:20, Andrea Canciani wrote:
> 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).

Completely agree.


Can you post a branch?

behdad

> 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
> 
> 
> 
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list