shithub: freetype+ttf2subf

Download patch

ref: 8651f37ad5d64fa2122e42a212ba4eac4d99b8c9
parent: 52aad9dfc6568b7eafefead5b49bad7e61f7938c
author: Werner Lemberg <[email protected]>
date: Wed Sep 30 06:26:10 EDT 2015

[truetype] Adjust number of glyphs for malformed `loca' tables.

* src/truetype/ttpload.c (tt_face_load_loca): Implement it.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-09-30  Werner Lemberg  <[email protected]>
+
+	[truetype] Adjust number of glyphs for malformed `loca' tables.
+
+	* src/truetype/ttpload.c (tt_face_load_loca): Implement it.
+
 2015-09-29  Werner Lemberg  <[email protected]>
 
 	[pshinter] Avoid harmless overflow (#45984).
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -152,6 +152,14 @@
           FT_TRACE2(( "adjusting num_locations to %d\n",
                       face->num_locations ));
         }
+        else
+        {
+          face->root.num_glyphs = face->num_locations
+                                    ? (FT_Long)face->num_locations - 1 : 0;
+
+          FT_TRACE2(( "adjusting num_glyphs to %d\n",
+                      face->root.num_glyphs ));
+        }
       }
     }