[type42] Fix auto-hinting. The autohinter could not access the base (unscaled) outline in the child TrueType glyph slot. We now share the internal parts between the parent and child glyph slots. Fixes #1057. * src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts of `T42_GlyphSlot' and replace it with the child TrueType structure. (T42_GlyphSlot_Done): Updated accordingly.
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
diff --git a/ChangeLog b/ChangeLog
index 01c4d70..cecb207 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2021-05-27 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [type42] Fix auto-hinting.
+
+ The autohinter could not access the base (unscaled) outline in the
+ child TrueType glyph slot. We now share the internal parts between
+ the parent and child glyph slots. Fixes #1057.
+
+ * src/type42/t42objs.c (T42_GlyphSlot_Init): Remove the internal parts
+ of `T42_GlyphSlot' and replace it with the child TrueType structure.
+ (T42_GlyphSlot_Done): Updated accordingly.
+
2021-05-25 Werner Lemberg <wl@gnu.org>
[psaux] Guard and trace AFM kern data allocation.
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index 59b6540..dd23e73 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -583,6 +583,7 @@
FT_Face face = t42slot->face;
T42_Face t42face = (T42_Face)face;
FT_GlyphSlot ttslot;
+ FT_Memory memory = face->memory;
FT_Error error = FT_Err_Ok;
@@ -598,6 +599,11 @@
slot->ttslot = ttslot;
}
+ /* share the loader so that the autohinter can see it */
+ FT_GlyphLoader_Done( t42slot->internal->loader );
+ FT_FREE( t42slot->internal );
+ t42slot->internal = slot->ttslot->internal;
+
return error;
}
@@ -609,6 +615,7 @@
FT_Done_GlyphSlot( slot->ttslot );
+ t42slot->internal = NULL;
}