[cairo] patch for check glyphs overlapping

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 13 11:56:16 PDT 2012


On Tue, 13 Mar 2012 15:53:31 +0000, "Henry (Yu) Song - SISA" <hsong at sisa.samsung.com> wrote:
> It seems to me that checking overlapping in cairo-scaled-font.c is not correct.  Here is patch
> 
> Date:   Mon Mar 12 09:49:38 2012 -0700
> 
>     checkut overlap in cairo-scaled-font.c
> 
> diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
> index 062e895..e32e975 100644
> --- a/src/cairo-scaled-font.c
> +++ b/src/cairo-scaled-font.c
> @@ -2102,10 +2102,16 @@ _range_contains_glyph (const cairo_box_t *extents,
>                                       cairo_fixed_t right,
>                                       cairo_fixed_t bottom)
> {
> -    return right > extents->p1.x &&
> -                 left < extents->p2.x &&
> -                 bottom > extents->p1.y &&
> -                 top < extents->p2.y;
> +    return right  < extents->p2.x &&
> +                left   > extents->p1.x &&
> +                top    > extents->p1.y &&
> +                bottom < extents->p2.y;

That turns it into a query as to whether the next glyph is wholly
contained within the bbox of the proceeding glyphs. Whereas what we need
to detect is if any pixel of this glyph overdraws any pixel of another
glyph.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list