[cairo-commit] 2 commits - Makefile.am src/cairo-ft-font.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Feb 22 20:14:58 PST 2007


 Makefile.am         |    2 +-
 src/cairo-ft-font.c |   15 +++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
diff-tree 3b168e45510e02caf54e4b3cd0df76df6420d304 (from 0ff5192e4cb5b1113bed3c9cf1c0275065aafd14)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 23:14:58 2007 -0500

    [FreeType] Truely return unhinted advance width if metrics hinting is off
    
    David Turner said:
    The returned 26.6 advance is always rounded, even with FT_LOAD_NO_HINTING.
    You can however retrieve the linearly scaled value as a 16.16 fixed float
    number through face->glyph->linearHoriAdvance. This works even with hinted
    glyphs.

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 6791231..7650f47 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1824,6 +1824,8 @@ _cairo_ft_scaled_glyph_init (void			*abs
 	_cairo_ft_scaled_glyph_vertical_layout_bearing_fix (scaled_font, glyph);
 
     if (info & CAIRO_SCALED_GLYPH_INFO_METRICS) {
+
+	cairo_bool_t hint_metrics = scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF;
 	/*
 	 * Compute font-space metrics
 	 */
@@ -1849,8 +1851,7 @@ _cairo_ft_scaled_glyph_init (void			*abs
 	 * 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 (hint_metrics && (load_flags & FT_LOAD_NO_HINTING))
 	{
 	    FT_Pos x1, x2;
 	    FT_Pos y1, y2;
@@ -1897,14 +1898,20 @@ _cairo_ft_scaled_glyph_init (void			*abs
 		fs_metrics.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) * x_factor;
 		fs_metrics.y_bearing = DOUBLE_FROM_26_6 (-metrics->horiBearingY) * y_factor;
 		
-		fs_metrics.x_advance = DOUBLE_FROM_26_6 (metrics->horiAdvance) * x_factor;
+		if (hint_metrics || glyph->format != FT_GLYPH_FORMAT_OUTLINE)
+		    fs_metrics.x_advance = DOUBLE_FROM_26_6 (metrics->horiAdvance) * x_factor;
+		else
+		    fs_metrics.x_advance = DOUBLE_FROM_16_16 (glyph->linearHoriAdvance) * x_factor;
 		fs_metrics.y_advance = 0 * y_factor;
 	    } else {
 		fs_metrics.x_bearing = DOUBLE_FROM_26_6 (metrics->vertBearingX) * x_factor;
 		fs_metrics.y_bearing = DOUBLE_FROM_26_6 (metrics->vertBearingY) * y_factor;
 		
 		fs_metrics.x_advance = 0 * x_factor;
-		fs_metrics.y_advance = DOUBLE_FROM_26_6 (metrics->vertAdvance) * y_factor;
+		if (hint_metrics || glyph->format != FT_GLYPH_FORMAT_OUTLINE)
+		    fs_metrics.y_advance = DOUBLE_FROM_26_6 (metrics->vertAdvance) * y_factor;
+		else
+		    fs_metrics.y_advance = DOUBLE_FROM_26_6 (glyph->linearVertAdvance) * y_factor;
 	    }
 	 }
 
diff-tree 0ff5192e4cb5b1113bed3c9cf1c0275065aafd14 (from 1bc1f8ef46a27aa21f8d29b39e645ee5a0e95cda)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Feb 21 15:57:21 2007 -0500

    [Makefile.am] Include boilerplate/ in SUBDIRS

diff --git a/Makefile.am b/Makefile.am
index 3525812..cb21578 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ DIST_SUBDIRS = pixman src boilerplate te
 SUBDIRS = pixman src doc
 # libpng is required for our test programs
 if CAIRO_HAS_PNG_FUNCTIONS
-SUBDIRS += test
+SUBDIRS += boilerplate test
 endif
 
 


More information about the cairo-commit mailing list