added support to synthetic Type 1 fonts. Why didn't this thing get committed ??
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
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index dc06e42..21c88a3 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -1049,7 +1049,21 @@
switch ( slot->format )
{
case ft_glyph_format_outline:
- /* first of all, copy the outline points in the loader's current */
+
+ /* translate glyph outline if we need to */
+ if (hinter->transformed)
+ {
+ FT_UInt n = slot->outline.n_points;
+ FT_Vector* point = slot->outline.points;
+
+ for ( ; n > 0; point++, n-- )
+ {
+ point->x += hinter->trans_delta.x;
+ point->y += hinter->trans_delta.y;
+ }
+ }
+
+ /* copy the outline points in the loader's current */
/* extra points, which is used to keep original glyph coordinates */
error = ah_loader_check_points( gloader, slot->outline.n_points + 2,
slot->outline.n_contours );
@@ -1270,6 +1284,9 @@
{
FT_BBox bbox;
+ /* transform the hinted outline if needed */
+ if ( hinter->transformed )
+ FT_Outline_Transform( &gloader->base.outline, &hinter->trans_matrix );
/* we must translate our final outline by -pp1.x, and compute */
/* the new metrics */
@@ -1318,7 +1335,6 @@
FT_Fixed y_scale = size->metrics.y_scale;
AH_Face_Globals* face_globals = FACE_GLOBALS( face );
-
/* first of all, we need to check that we're using the correct face and */
/* global hints to load the glyph */
if ( hinter->face != face || hinter->globals != face_globals )
@@ -1344,6 +1360,23 @@
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;
+
+ FT_Matrix_Invert( &imatrix );
+ FT_Vector_Transform( &hinter->trans_delta, &imatrix );
+ }
+ }
+
error = ah_hinter_load( hinter, glyph_index, load_flags, 0 );
Exit:
diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h
index ef3fef9..66cb2f6 100644
--- a/src/autohint/ahtypes.h
+++ b/src/autohint/ahtypes.h
@@ -488,6 +488,10 @@
FT_Vector pp1;
FT_Vector pp2;
+ FT_Bool transformed;
+ FT_Vector trans_delta;
+ FT_Matrix trans_matrix;
+
} AH_Hinter;