Changed functions ah_hinter_load and ah_hinter_load_glyph so that synthetic fonts render correctly. Previously, the first glyph rendered from such a font did not have the FontMatrix applied.
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index 187b72c..d39bb6f 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -1010,14 +1010,15 @@
FT_UInt load_flags,
FT_UInt depth )
{
- FT_Face face = hinter->face;
- FT_GlyphSlot slot = face->glyph;
- FT_Fixed x_scale = face->size->metrics.x_scale;
- FT_Fixed y_scale = face->size->metrics.y_scale;
+ FT_Face face = hinter->face;
+ FT_GlyphSlot slot = face->glyph;
+ FT_Slot_Internal internal = slot->internal;
+ FT_Fixed x_scale = face->size->metrics.x_scale;
+ FT_Fixed y_scale = face->size->metrics.y_scale;
FT_Glyph_Metrics metrics; /* temporary metrics */
FT_Error error;
- AH_Outline* outline = hinter->glyph;
- AH_Loader* gloader = hinter->loader;
+ AH_Outline* outline = hinter->glyph;
+ AH_Loader* gloader = hinter->loader;
FT_Bool no_horz_hints =
( load_flags & AH_HINT_NO_HORZ_EDGES ) != 0;
FT_Bool no_vert_hints =
@@ -1029,6 +1030,21 @@
if ( error )
goto Exit;
+ /* Set `hinter->transformed' after loading with FT_LOAD_NO_RECURSE. */
+ hinter->transformed = internal->glyph_transformed;
+
+ if ( hinter->transformed )
+ {
+ FT_Matrix imatrix;
+
+ imatrix = internal->glyph_matrix;
+ hinter->trans_delta = internal->glyph_delta;
+ hinter->trans_matrix = imatrix;
+
+ FT_Matrix_Invert( &imatrix );
+ FT_Vector_Transform( &hinter->trans_delta, &imatrix );
+ }
+
/* save current glyph metrics */
metrics = slot->metrics;
@@ -1338,9 +1354,22 @@
error = ah_hinter_new_face_globals( hinter, face, 0 );
if ( error )
goto Exit;
+
}
hinter->globals = FACE_GLOBALS( face );
face_globals = FACE_GLOBALS( face );
+
+ /* Immediately call ourself. Fixes weird problem whereby computation */
+ /* of global hints throws off the rendering of the first glyph shown */
+ /* in a synthetic font. */
+
+ /*
+ error = ah_hinter_load_glyph( hinter, slot, size,
+ glyph_index, load_flags );
+ if ( error )
+ goto Exit;
+ */
+
}
/* now, we must check the current character pixel size to see if we */
@@ -1349,29 +1378,10 @@
face_globals->y_scale != y_scale )
ah_hinter_scale_globals( hinter, x_scale, y_scale );
- load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_RECURSE;
-
ah_loader_rewind( hinter->loader );
- {
- FT_Slot_Internal internal = slot->internal;
-
-
- hinter->transformed = internal->glyph_transformed;
- if ( hinter->transformed )
- {
- FT_Matrix imatrix;
-
-
- imatrix = internal->glyph_matrix;
- hinter->trans_delta = internal->glyph_delta;
- hinter->trans_matrix = imatrix;
+ load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_RECURSE;
- FT_Matrix_Invert( &imatrix );
- FT_Vector_Transform( &hinter->trans_delta, &imatrix );
- }
- }
-
error = ah_hinter_load( hinter, glyph_index, load_flags, 0 );
Exit: