[cairo] Rendering underlines / overbars with pangocairo

Peter Clifton pcjc2 at cam.ac.uk
Thu Dec 18 07:45:40 PST 2008


On Thu, 2008-12-18 at 01:36 -0500, Behdad Esfahbod wrote:
> Peter Clifton wrote:
> 
> > However, it appears that the overbar doesn't fade out. When zoomed far
> > out, you see very bold pixel aligned overbars, with some faded
> > anti-aliased text in the few pixels below.
> > 
> > Poking in Pango, (and I'm a complete noob there), I'm wondering if the
> > font metrics are coming through pangogc-font.c 's get_face_metrics()
> > function. (The platform is Linux, and text is being rendered via
> > cairo). 
> 
> Hi Peter,
> 
> I think you are hitting this bug:
> 
>   http://bugzilla.gnome.org/show_bug.cgi?id=457990
> 
> It's a very ugly bug.  I'll see if I can fix it soon.
> 
> One way to work around it is to make sure your ctm is identity and modify the
> font matrix instead.  Ugly, I know.

I think my CTM is identity already.. my user spece coodinates are in
pixels, since that was easiest for transitioning away from the old GDK
drawing routines, and because we do hinting of lines to the pixel grid.

Is pangofc-font.c likely to be involved for the cairo backend? If so,
then I can't hope to get an underline thickness metric less than
PANGO_SCALE due to the quantisation here:

  if (fcfont->is_hinted)
    {
      pango_quantize_line_geometry (&metrics->underline_thickness,
                                    &metrics->underline_position);
      pango_quantize_line_geometry (&metrics->strikethrough_thickness,
                                    &metrics->strikethrough_position);
    }

It would appear that the strokes in the font aren't being quantized at
small sizes though, since they fade as the font becomes unreadably
small.


-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



More information about the cairo mailing list