freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] Experimental grayscale native TrueType hinting support


From: David Turner
Subject: [Devel] Experimental grayscale native TrueType hinting support
Date: Thu, 10 Apr 2003 15:29:48 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210

Hello,

  Here's a small patch against the current FreeType 2 sources that "activates"
  gray-scale specific hinting within the TrueType bytecode interpreter. The
  changes can be summarized as:

    - the GETINFO bytecode now returns a scaler value (35) corresponding to
      the Microsoft Scaler v. 1.7, according to the information found in the
      OpenType spec

    - it also sets the "grayscale" bit, except when FT_LOAD_TARGET_MONO is
      used when loading the glyph (note: NOT when FT_LOAD_MONOCHROME only
      is used)

    - various changes to the glyph loader so that the information flows
      from FT_Load_Glyph to the TrueType interpreter adequately.

  I've been using it with the fonts that come with my Windows 2000 setup and
  some fonts seem to change (e.g. Andale Mono), while others do not
  (Times New Roman Italic, still exhibiting the disappearing diagonal in
   "z" in AA mode). It seems that some fonts become slightly distorted, even
  in Monochrome mode (like Tahoma Bold or Trebuchet) with this patch, I
  suspect it has something to do with the scaler value begin changed.

  Note that it seems, but it's very subjective because I didn't really
  compare it thoroughly, to improve the LCD-optimized rendering in ftview
  or certain fonts.

  I'm submitting this patch so that you can experiment with it as well as
  test it with the Windows XP version of these fonts..

  It is *not* commited in the official FT2 tree, and you cannot toggle the
  feature at runtime or even compile time for now, though we'll probably
  try to add an option to do just that..

  I'm waiting for your opinions :-)


Best Regards,

- David Turner
- The FreeType Project  (www.freetype.org)

Index: src/truetype/ttgload.c
===================================================================
RCS file: /cvs/freetype/freetype2/src/truetype/ttgload.c,v
retrieving revision 1.111
diff -r1.111 ttgload.c
718,719d717
<         load->exec->pedantic_hinting = (FT_Bool)( load->load_flags &
<                                                   FT_LOAD_PEDANTIC );
1318,1319c1316
<             exec->pedantic_hinting =
<               (FT_Bool)( loader->load_flags & FT_LOAD_PEDANTIC );
---
>
1735a1733,1738
>
>       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 );
Index: src/truetype/ttinterp.c
===================================================================
RCS file: /cvs/freetype/freetype2/src/truetype/ttinterp.c,v
retrieving revision 1.55
diff -r1.55 ttinterp.c
6395c6395
<       K = 3;
---
>       K = 35;
6398c6398
<     if ( CUR.tt_metrics.rotated )
---
>     if ( (args[0] & 2) != 0 && CUR.tt_metrics.rotated )
6402,6403c6402,6407
<     if ( CUR.tt_metrics.stretched )
<       K |= 0x100;
---
>     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);
Index: src/truetype/ttinterp.h
===================================================================
RCS file: /cvs/freetype/freetype2/src/truetype/ttinterp.h,v
retrieving revision 1.24
diff -r1.24 ttinterp.h
220a221,222
>     FT_Bool            grayscale;      /* are we hinting for grayscale ? */
>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]