* src/cairo-ft-font.c (_cairo_ft_scaled_glyph_init): Hint the metrics regardless of whether the glyph is hinted. Also Hint with more care. Index: src/cairo-ft-font.c =================================================================== RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v retrieving revision 1.115 diff -u -r1.115 cairo-ft-font.c --- src/cairo-ft-font.c 21 Dec 2005 16:19:47 -0000 1.115 +++ src/cairo-ft-font.c 11 Feb 2006 06:32:01 -0000 @@ -1768,24 +1768,26 @@ * * Scale metrics back to glyph space from the scaled glyph space returned * by FreeType - * - * If we want hinted metrics but aren't asking for hinted glyphs from - * FreeType, then we need to do the metric hinting ourselves. */ - if ((scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF) && - (load_flags & FT_LOAD_NO_HINTING)) + if (scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF) { FT_Pos x1, x2; FT_Pos y1, y2; FT_Pos advance; + int adj = 1; - x1 = (metrics->horiBearingX) & -64; + if (metrics->horiBearingX + metrics->width > metrics->horiAdvance) + adj = 0; + x2 = (metrics->horiBearingX + metrics->width + 63) & -64; - y1 = (-metrics->horiBearingY) & -64; + x1 = (metrics->horiBearingX) & -64; y2 = (-metrics->horiBearingY + metrics->height + 63) & -64; + y1 = (-metrics->horiBearingY) & -64; advance = ((metrics->horiAdvance + 32) & -64); + if (adj && advance < x2) + advance = x2; fs_metrics.x_bearing = DOUBLE_FROM_26_6 (x1) * x_factor; fs_metrics.y_bearing = DOUBLE_FROM_26_6 (y1) * y_factor;