shithub: freetype+ttf2subf

Download patch

ref: b0522701f890372ff9f3d921cf212bccd1f64400
parent: 37580053b491b69284988ed25cbbf6e884151eb0
author: Werner Lemberg <[email protected]>
date: Thu May 16 08:52:57 EDT 2019

[truetype] Actually scale varied CVT values.

Up to now, only the unscaled CVT values were varied; in other words,
the `CVAR' data was never used for bytecode hinting.

* src/truetype/ttgxvar.c (tt_cvt_ready_iterator): New auxiliary
function.
(tt_face_vary_cvt): Use it to trigger rescaling of CVT values.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2019-05-16  Werner Lemberg  <[email protected]>
 
+	[truetype] Actually scale varied CVT values.
+
+	Up to now, only the unscaled CVT values were varied; in other words,
+	the `CVAR' data was never used for bytecode hinting.
+
+	* src/truetype/ttgxvar.c (tt_cvt_ready_iterator): New auxiliary
+	function.
+	(tt_face_vary_cvt): Use it to trigger rescaling of CVT values.
+
+2019-05-16  Werner Lemberg  <[email protected]>
+
 	[truetype] Use 26.6 format for storing unscaled CVT values.
 
 	If `CVAR' data is applied to variation fonts, fractional values are
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -3,7 +3,10 @@
 
   I. IMPORTANT BUG FIXES
 
+  - The bytecode hinting of OpenType variation fonts was flawed, since
+    the data in the `CVAR' table wasn't correctly applied.
 
+
   II. MISCELLANEOUS
 
   - Auto-hinter support for Mongolian.
@@ -18,6 +21,9 @@
   - If  `FT_Set_Named_Instance' was  called  with  the same  arguments
     twice in a row, the function  returned an incorrect error code the
     second time.
+
+  - Increased  precision  while  computing  OpenType  font   variation
+    instances.
 
 
 ======================================================================
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -3113,6 +3113,21 @@
   /*************************************************************************/
 
 
+  static FT_Error
+  tt_cvt_ready_iterator( FT_ListNode  node,
+                         void*        user )
+  {
+    TT_Size  size = (TT_Size)node->data;
+
+    FT_UNUSED( user );
+
+
+    size->cvt_ready = -1;
+
+    return FT_Err_Ok;
+  }
+
+
   /**************************************************************************
    *
    * @Function:
@@ -3143,6 +3158,8 @@
     FT_Error   error;
     FT_Memory  memory = stream->memory;
 
+    FT_Face  root = &face->root;
+
     FT_ULong  table_start;
     FT_ULong  table_len;
 
@@ -3450,6 +3467,12 @@
     FT_FREE( im_start_coords );
     FT_FREE( im_end_coords );
     FT_FREE( cvt_deltas );
+
+    /* iterate over all FT_Size objects and set `cvt_ready' to -1 */
+    /* to trigger rescaling of all CVT values                     */
+    FT_List_Iterate( &root->sizes_list,
+                     tt_cvt_ready_iterator,
+                     NULL );
 
     return error;
   }