[cairo] Userfont hinting

Behdad Esfahbod behdad at behdad.org
Sat May 10 05:00:17 PDT 2008


On Sat, 2008-05-10 at 01:33 +0100, Peter Clifton wrote:
> On Fri, 2008-05-09 at 13:58 +0200, Behdad Esfahbod wrote:
> > On Fri, 2008-05-09 at 12:55 +0100, Peter Clifton wrote:
> > > 
> > > Could the meta-surface / analysis surface be using fixed point with an
> > > inappropriate precision?
> > 
> > Possible.  analysis-surface does use the fixed box model.  I'm finishing
> > the patch split.  Will look into this after.
> 
> Might be the wrong thing, but this patch fixes it for me:

I pushed a fix already.  Please try that.  The rounding issue remains,
but you need to go to sizes much higher to see it.  Working on a fix for
that too.


> diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
> index 6422d1b..b006b43 100644
> --- a/src/cairo-user-font.c
> +++ b/src/cairo-user-font.c
> @@ -119,12 +119,12 @@ _cairo_user_scaled_glyph_init (void                        *abstract_font,
>             cairo_surface_t *analysis_surface = _cairo_analysis_surface_create (null_surface, -1, -1);
>             cairo_surface_destroy (null_surface);
>  
> -           _cairo_analysis_surface_set_ctm (analysis_surface, &scaled_font->base.scale_inverse);
>             status = _cairo_meta_surface_replay (meta_surface, analysis_surface);
>             _cairo_analysis_surface_get_bounding_box (analysis_surface, &bbox);
>             cairo_surface_destroy (analysis_surface);
>  
>             _cairo_box_to_doubles (&bbox, &x1, &y1, &x2, &y2);
> +           _cairo_matrix_transform_bounding_box (&scaled_font->base.scale_inverse, &x1, &y1, &x2, &y2, NULL);
>  
>             extents.x_bearing = x1;
>             extents.y_bearing = y1;

This kinda fixes it, but is the wrong way to compute the extents.  I'll
write about why it's wrong later (when I produce a graph showing the
difference).

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



More information about the cairo mailing list