[type42] Fix glyph access. This is a severe bug: We've missed one level of indirection, as described in the Type 42 specification. As a result, ftview sometimes showed incorrect glyphs for given glyph names, and even displayed `error 0x0006' (invalid argument!) in case the number of glyph indices differed between the Type 42 font and the embedded TTF. Apparently, noone ever noticed it; this shows how much Type 42 fonts are in use... * src/type42/t42objs.c (T42_GlyphSlot_Load): Map Type 42 glyph index to embedded TTF's glyph index.
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
diff --git a/ChangeLog b/ChangeLog
index d7e6951..0e70767 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2015-08-08 Werner Lemberg <wl@gnu.org>
+ [type42] Fix glyph access.
+
+ This is a severe bug: We've missed one level of indirection, as
+ described in the Type 42 specification. As a result, ftview
+ sometimes showed incorrect glyphs for given glyph names, and even
+ displayed `error 0x0006' (invalid argument!) in case the number of
+ glyph indices differed between the Type 42 font and the embedded
+ TTF.
+
+ Apparently, noone ever noticed it; this shows how much Type 42 fonts
+ are in use...
+
+ * src/type42/t42objs.c (T42_GlyphSlot_Load): Map Type 42 glyph index
+ to embedded TTF's glyph index.
+
+2015-08-08 Werner Lemberg <wl@gnu.org>
+
[type42] Minor clean-up.
* src/type42/t42parse.c (t42_parse_font_matrix): Remove unused
diff --git a/docs/CHANGES b/docs/CHANGES
index 113fbdf..022e6b4 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -8,6 +8,10 @@ CHANGES BETWEEN 2.6 and 2.6.1
you are using CFFs; otherwise you get cropped glyphs with GUI
interfaces like GTK or Qt.
+ - Accessing Type 42 fonts returned incorrect results if the glyph
+ order of the embedded TrueType font differs from the glyph order
+ of the Type 42 charstrings table.
+
II. IMPORTANT CHANGES
@@ -30,6 +34,15 @@ CHANGES BETWEEN 2.6 and 2.6.1
don't need any change to the source code.
+ III. MISCELLANEOUS
+
+ - The auto-hinter's Arabic script support has been enhanced.
+
+ - The TrueType bytecode interpreter now runs slightly faster.
+
+ - Improved support for builds with cmake.
+
+
======================================================================
CHANGES BETWEEN 2.5.5 and 2.6
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index 2756adf..01b271f 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -652,11 +652,16 @@
FT_Error error;
T42_GlyphSlot t42slot = (T42_GlyphSlot)glyph;
T42_Size t42size = (T42_Size)size;
+ T42_Face t42face = (T42_Face)size->face;
FT_Driver_Class ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz;
FT_TRACE1(( "T42_GlyphSlot_Load: glyph index %d\n", glyph_index ));
+ /* map T42 glyph index to embedded TTF's glyph index */
+ glyph_index = (FT_UInt)ft_atol(
+ (const char *)t42face->type1.charstrings[glyph_index] );
+
t42_glyphslot_clear( t42slot->ttslot );
error = ttclazz->load_glyph( t42slot->ttslot,
t42size->ttsize,