ref: dea712b4eb4d33e293d44c8e736064f48ae050e3
parent: b8fdcd68d23d1e414df2e5c9c31bd43fad9887bd
author: Werner Lemberg <[email protected]>
date: Sat Aug 7 11:08:33 EDT 2004
`Activate' gray-scale specifing hinting within the TrueType bytecode interpreter. This is an experimental feature which should probably be made optional. * src/truetype/ttgload.c (TT_Process_Simple_Glyph, load_truetype_glyph): Move the code to set the pedantic_hinting flag to... (TT_Load_Glyph): Here. Set `grayscale' flag except for `FT_LOAD_TARGET_MONO'. * src/truetyep/ttinterp.c (Ins_GETINFO): Return MS rasterizer version 1.7. Return rotation and stretching info only if glyph is rotated or stretched, respectively. Handle grayscale info. * src/truetype/ttinterp.h (TT_ExecContextRec): Add `grayscale' member.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2004-08-05 David Turner <[email protected]>
+
+ `Activate' gray-scale specifing hinting within the TrueType
+ bytecode interpreter. This is an experimental feature which
+ should probably be made optional.
+
+ * src/truetype/ttgload.c (TT_Process_Simple_Glyph,
+ load_truetype_glyph): Move the code to set the pedantic_hinting flag
+ to...
+ (TT_Load_Glyph): Here.
+ Set `grayscale' flag except for `FT_LOAD_TARGET_MONO'.
+
+ * src/truetyep/ttinterp.c (Ins_GETINFO): Return MS rasterizer
+ version 1.7.
+ Return rotation and stretching info only if glyph is rotated or
+ stretched, respectively.
+ Handle grayscale info.
+
+ * src/truetype/ttinterp.h (TT_ExecContextRec): Add `grayscale'
+ member.
+
2004-08-02 George Williams <[email protected]>
* src/base/ftobjs.c (FT_Attach_File): Initialize `open.stream'.
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -818,8 +818,6 @@
goto Exit;
load->exec->is_composite = FALSE;
- load->exec->pedantic_hinting = (FT_Bool)( load->load_flags &
- FT_LOAD_PEDANTIC );
load->exec->pts = *zone;
load->exec->pts.n_points += 4;
@@ -1548,8 +1546,6 @@
if ( IS_HINTED( loader->load_flags ) && n_ins > 0 )
{
exec->is_composite = TRUE;
- exec->pedantic_hinting =
- (FT_Bool)( loader->load_flags & FT_LOAD_PEDANTIC );
error = TT_Run_Context( exec, ((TT_Size)loader->size)->debug );
if ( error && exec->pedantic_hinting )
goto Fail;
@@ -1973,6 +1969,12 @@
/* load default graphics state - if needed */
if ( size->GS.instruct_control & 2 )
loader.exec->GS = tt_default_graphics_state;
+
+ loader.exec->pedantic_hinting =
+ FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
+
+ loader.exec->grayscale =
+ FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != FT_LOAD_TARGET_MONO );
}
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -6617,8 +6617,6 @@
/* Opcode range: 0x88 */
/* Stack: uint32 --> uint32 */
/* */
- /* XXX: According to Apple specs, bits 1 & 2 of the argument ought to be */
- /* consulted before rotated/stretched info is returned. */
static void
Ins_GETINFO( INS_ARG )
{
@@ -6627,18 +6625,21 @@
K = 0;
- /* We return then Windows 3.1 version number */
- /* for the font scaler */
+ /* We return MS rasterizer version 1.7 for the font scaler. */
if ( ( args[0] & 1 ) != 0 )
- K = 3;
+ K = 35;
- /* Has the glyph been rotated ? */
- if ( CUR.tt_metrics.rotated )
+ /* Has the glyph been rotated? */
+ if ( ( args[0] & 2 ) != 0 && CUR.tt_metrics.rotated )
K |= 0x80;
- /* Has the glyph been stretched ? */
- if ( CUR.tt_metrics.stretched )
- K |= 0x100;
+ /* Has the glyph been stretched? */
+ if ( ( args[0] & 4 ) != 0 && CUR.tt_metrics.stretched )
+ K |= 1 << 8;
+
+ /* Are we hinting for grayscale? */
+ if ( ( args[0] & 32 ) != 0 && CUR.grayscale )
+ K |= (1 << 12);
args[0] = K;
}
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -4,7 +4,7 @@
/* */
/* TrueType bytecode interpreter (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -218,6 +218,8 @@
FT_ULong loadSize;
TT_SubGlyph_Stack loadStack; /* loading subglyph stack */
+
+ FT_Bool grayscale; /* are we hinting for grayscale? */
} TT_ExecContextRec;