shithub: freetype+ttf2subf

Download patch

ref: 5e225b7c15e6c6ff8b4b7059597319b26271bc67
parent: 7e4b0fbfdd1e15780ff1899bb442f70ffc83791b
author: Werner Lemberg <[email protected]>
date: Wed Nov 6 03:41:59 EST 2013

[truetype] Fix handling of phantom points in composite glyphs.
Problem reported by Nigel Tao <[email protected]>.

This is a follow-up commit to the previous one.

* src/truetype/ttgload.c (load_truetype_glyph): Call
`tt_get_metrics' after loading the glyph header.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2013-11-06  Werner Lemberg  <[email protected]>
 
+	[truetype] Fix handling of phantom points in composite glyphs.
+	Problem reported by Nigel Tao <[email protected]>.
+
+	This is a follow-up commit to the previous one.
+
+	* src/truetype/ttgload.c (load_truetype_glyph): Call
+	`tt_get_metrics' after loading the glyph header.
+
+2013-11-06  Werner Lemberg  <[email protected]>
+
 	[truetype] Improve emulation of vertical metrics.
 
 	This commit also improves the start values of vertical phantom
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1387,8 +1387,6 @@
       y_scale = 0x10000L;
     }
 
-    tt_get_metrics( loader, glyph_index );
-
     /* Set `offset' to the start of the glyph relative to the start of */
     /* the `glyf' table, and `byte_len' to the length of the glyph in  */
     /* bytes.                                                          */
@@ -1448,8 +1446,16 @@
 
       /* read glyph header first */
       error = face->read_glyph_header( loader );
-      if ( error || header_only )
+      if ( error )
         goto Exit;
+
+      /* the metrics must be computed after loading the glyph header */
+      /* since we need the glyph's `yMax' value in case the vertical */
+      /* metrics must be emulated                                    */
+      tt_get_metrics( loader, glyph_index );
+
+      if ( header_only )
+        goto Exit;
     }
 
     if ( loader->byte_len == 0 || loader->n_contours == 0 )
@@ -1458,6 +1464,8 @@
       loader->bbox.xMax = 0;
       loader->bbox.yMin = 0;
       loader->bbox.yMax = 0;
+
+      tt_get_metrics( loader, glyph_index );
 
       if ( header_only )
         goto Exit;