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'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
diff --git a/ChangeLog b/ChangeLog
index 37be0cb..17b8329 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-11-22 Werner Lemberg <wl@gnu.org>
+
+ 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 <wl@gnu.org>
Because FT_Load_Glyph expects CID values for CID-keyed fonts, the
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 3d901ac..13b6577 100644
--- 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;
}