shithub: freetype+ttf2subf

Download patch

ref: ffa496574ae715630a466a810986e212d2de59e0
parent: c938131856e288d7dd5d9e7c0437d0097b2ccc0c
author: Werner Lemberg <[email protected]>
date: Sun May 25 08:43:57 EDT 2008

* src/truetype/ttgload.c (load_truetype_glyph): Move initialization
of the graphics state for subglyphs to...
(TT_Hint_Glyph): This function.
Hinting instructions for a composite glyph apparently refer to the
just hinted subglyphs, not the unhinted, unscaled outline.  This
seems to fix Savannah bugs #20973 and (at least partially) #23310.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,13 @@
 	* src/raster/ftraster.c (fc_black_render): Return 0 when we are
 	trying to render into a zero-width/height bitmap, not an error code.
 
+	* src/truetype/ttgload.c (load_truetype_glyph): Move initialization
+	of the graphics state for subglyphs to...
+	(TT_Hint_Glyph): This function.
+	Hinting instructions for a composite glyph apparently refer to the
+	just hinted subglyphs, not the unhinted, unscaled outline.  This
+	seems to fix Savannah bugs #20973 and (at least partially) #23310.
+
 2008-05-20  suzuki toshiya  <[email protected]>
 
 	* src/base/ftmac.c (FT_New_Face_From_Suitcase): Check if valid
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -643,6 +643,24 @@
     /* save original point position in org */
     if ( n_ins > 0 )
       FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
+
+    /* Reset graphics state. */
+    loader->exec->GS = ((TT_Size)loader->size)->GS;
+
+    /* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */
+    /*      completely refer to the (already) hinted subglyphs.     */
+    if ( is_composite )
+    {
+      loader->exec->metrics.x_scale = 1 << 16;
+      loader->exec->metrics.y_scale = 1 << 16;
+
+      FT_ARRAY_COPY( zone->orus, zone->cur, zone->n_points );
+    }
+    else
+    {
+      loader->exec->metrics.x_scale = loader->size->metrics.x_scale;
+      loader->exec->metrics.y_scale = loader->size->metrics.y_scale;
+    }
 #endif
 
     /* round pp2 and pp4 */
@@ -1407,14 +1425,7 @@
 
         FT_Stream         old_stream     = loader->stream;
 
-#ifdef TT_USE_BYTECODE_INTERPRETER
-        TT_GraphicsState  saved_GS;
 
-
-        if ( loader->exec )
-          saved_GS = loader->exec->GS;
-#endif
-
         FT_GlyphLoader_Add( gloader );
 
         /* read each subglyph independently */
@@ -1422,12 +1433,6 @@
         {
           FT_Vector  pp[4];
 
-
-#ifdef TT_USE_BYTECODE_INTERPRETER
-          /* reinitialize graphics state */
-          if ( loader->exec )
-            loader->exec->GS = saved_GS;
-#endif
 
           /* Each time we call load_truetype_glyph in this loop, the   */
           /* value of `gloader.base.subglyphs' can change due to table */