* 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/ChangeLog b/ChangeLog
index 056d205..a3460e8 100644
--- 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 <mpsuzuki@hiroshima-u.ac.jp>
* src/base/ftmac.c (FT_New_Face_From_Suitcase): Check if valid
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 8f1c61b..6e826f0 100644
--- 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,13 +1425,6 @@
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 );
@@ -1423,12 +1434,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 */
/* reallocations. We thus need to recompute the subglyph */