shithub: freetype+ttf2subf

Download patch

ref: 5c7f5500e89824dad3888a02cd9770e58c44230e
parent: 55cd7e0a05fcfe78b6946341956861857528d005
author: Werner Lemberg <[email protected]>
date: Fri Jan 3 05:48:26 EST 2014

[autofit] Better ftgrid support.

* src/autofit/afhints.c (af_glyph_hints_get_segment_offset): Add
parameters `is_blue' and `blue_offset'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-01-03  Werner Lemberg  <[email protected]>
+
+	[autofit] Better ftgrid support.
+
+	* src/autofit/afhints.c (af_glyph_hints_get_segment_offset): Add
+	parameters `is_blue' and `blue_offset'.
+
 2014-01-01  Werner Lemberg  <[email protected]>
 
 	[autofit] Remove some styles.
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Auto-fitter hinting routines (body).                                 */
 /*                                                                         */
-/*  Copyright 2003-2007, 2009-2013 by                                      */
+/*  Copyright 2003-2007, 2009-2014 by                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -345,7 +345,9 @@
   af_glyph_hints_get_segment_offset( AF_GlyphHints  hints,
                                      FT_Int         dimension,
                                      FT_Int         idx,
-                                     FT_Pos*        offset )
+                                     FT_Pos        *offset,
+                                     FT_Bool       *is_blue,
+                                     FT_Pos        *blue_offset )
   {
     AF_Dimension  dim;
     AF_AxisHints  axis;
@@ -362,9 +364,18 @@
     if ( idx < 0 || idx >= axis->num_segments )
       return FT_THROW( Invalid_Argument );
 
-    seg     = &axis->segments[idx];
-    *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->ox
-                                           : seg->first->oy;
+    seg      = &axis->segments[idx];
+    *offset  = ( dim == AF_DIMENSION_HORZ ) ? seg->first->ox
+                                            : seg->first->oy;
+    if ( seg->edge )
+      *is_blue = (FT_Bool)( seg->edge->blue_edge != 0 );
+    else
+      *is_blue = FALSE;
+
+    if ( *is_blue )
+      *blue_offset = seg->edge->blue_edge->cur;
+    else
+      *blue_offset = 0;
 
     return FT_Err_Ok;
   }