shithub: freetype+ttf2subf

Download patch

ref: 91959bf24c3ecf9c46cec9916e787e5e3457fafd
parent: 2bad8ffbdf3ff386abfe9077f1157343c048934d
author: Werner Lemberg <[email protected]>
date: Wed Nov 22 05:36:55 EST 2006

Fix Savannah bug #15553.

* src/truetype/ttgload.c (tt_loader_init): Re-execute the CVT
program after a change from mono to grayscaling (and vice versa).
Use correct constant for comparison to get `exec->grayscale'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-11-22  Werner Lemberg  <[email protected]>
+
+	Fix Savannah bug #15553.
+
+	* src/truetype/ttgload.c (tt_loader_init): Re-execute the CVT
+	program after a change from mono to grayscaling (and vice versa).
+	Use correct constant for comparison to get `exec->grayscale'.
+
 2006-11-18  Werner Lemberg  <[email protected]>
 
 	Because FT_Load_Glyph expects CID values for CID-keyed fonts, the
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1720,6 +1720,7 @@
     /* load execution context */
     {
       TT_ExecContext  exec;
+      FT_Bool         grayscale;
 
 
       /* query new execution context */
@@ -1728,8 +1729,25 @@
       if ( !exec )
         return TT_Err_Could_Not_Find_Context;
 
+      grayscale =
+        FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != FT_RENDER_MODE_MONO );
+
       TT_Load_Context( exec, face, size );
 
+      /* a change from mono to grayscale rendering (and vice versa) */
+      /* requires a re-execution of the CVT program                 */
+      if ( grayscale != exec->grayscale )
+      {
+        FT_UInt  i;
+
+
+        exec->grayscale = grayscale;
+
+        for ( i = 0; i < size->cvt_size; i++ )
+          size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
+        tt_size_run_prep( size );
+      }
+
       /* see if the cvt program has disabled hinting */
       if ( exec->GS.instruct_control & 1 )
         load_flags |= FT_LOAD_NO_HINTING;
@@ -1739,9 +1757,6 @@
         exec->GS = tt_default_graphics_state;
 
       exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
-      exec->grayscale =
-        FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != FT_LOAD_TARGET_MONO );
-
       loader->exec = exec;
       loader->instructions = exec->glyphIns;
     }