Hi all,

LuaTeX stops with an error when reading version 0 OS/2 table, and this
is is because it unconditionally reads ulCodePageRange1 and
ulCodePageRange2 fields that were not defined in version 0. Such fonts
can be found here [1] (from the question [2]).

I’m attaching a patch that makes this conditional, it also fixed reading
version 2 specific fields that would be skipped for tables with versions
greater than 2. It does not look like these fields are used anywhere, so
another fix is to only read the fields LuaTeX actually needs.

Regards,
Khaled

1. 
https://mp.uu.se/documents/432512/911262/18350_Typsnitt_PC.zip/4c0954cf-84b5-4816-89f4-12f0671d83dd
2. https://tex.stackexchange.com/q/430837/729
diff --git a/source/texk/web2c/luatexdir/font/tt_table.c 
b/source/texk/web2c/luatexdir/font/tt_table.c
index dfcd4d650..05323c1b8 100644
--- a/source/texk/web2c/luatexdir/font/tt_table.c
+++ b/source/texk/web2c/luatexdir/font/tt_table.c
@@ -328,9 +328,11 @@ struct tt_os2__table *tt_read_os2__table(sfnt * sfont)
     table->sTypoLineGap = sfnt_get_short(sfont);
     table->usWinAscent = sfnt_get_ushort(sfont);
     table->usWinDescent = sfnt_get_ushort(sfont);
-    table->ulCodePageRange1 = sfnt_get_ulong(sfont);
-    table->ulCodePageRange2 = sfnt_get_ulong(sfont);
-    if (table->version == 0x0002) {
+    if (table->version >= 0x0001) {
+        table->ulCodePageRange1 = sfnt_get_ulong(sfont);
+        table->ulCodePageRange2 = sfnt_get_ulong(sfont);
+    }
+    if (table->version >= 0x0002) {
         table->sxHeight = sfnt_get_short(sfont);
         table->sCapHeight = sfnt_get_short(sfont);
         table->usDefaultChar = sfnt_get_ushort(sfont);
_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-luatex

Reply via email to