freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] New Infinality Release


From: Werner LEMBERG
Subject: Re: [ft-devel] New Infinality Release
Date: Mon, 17 Dec 2012 17:36:28 +0100 (CET)

> It seems OK, and it compiles fine.

Erik, please have a look at the attached patch.  I've `beautified' the
bytecode opcodes, and I've discovered that most of them appear to be
incorrect, compared to the listings in

  http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx

Please check that.  Have you actually done binary searches in TTFs to
find signatures?  Another possibility is to disassemble the `fpgm'
table with TTX, then doing a textual search (`pcregrep' might help for
multiline searches).

Additionally, ttfautohint's bytecode signature has changed; the new
one is

  PUSHB_1,
    32,   
  ADD,    
  FLOOR,  

in function 0.

Given that the new ttfautohint bytecode signature is that short, as
are some other snippets in Greg's whitepaper, I think it is best if
you extend the code so that the function number is also checked to
avoid false hits.


     Werner
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 505168d..440d385 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -4610,25 +4610,90 @@
     FT_ULong       n;
     TT_DefRecord*  rec;
     TT_DefRecord*  limit;
+
 #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
     FT_Byte    opcode_pattern[7][12] = {
-                 /* inline delta function 1 */
-                 {0x4B,0x53,0x23,0x4B,0x51,0x5A,0x58,0x38,0x1B,0x21,0x21,0x59},
-                 /* inline delta function 2 */
-                 {0x4B,0x54,0x58,0x38,0x1B,0x5A,0x21,0x21,0x59,},
-                 /* diagonal stroke function */
-                 {0x20,0x20,0x40,0x60,0x47,0x40,0x23,0x42,},
-                 /* VacuFormRound function */
-                 {0x45,0x23,0x46,0x60,0x20,},
-                 /* ttfautohinted */
-                 {0x20,0x64,0xb0,0x60,0x66,0x23,0xb0,},
-                 /* spacing functions */
-                 {0x01,0x41,0x43,0x58,},
-                 {0x01,0x18,0x41,0x43,0x58,},
+                 /* #0 inline delta function 1 */
+                 {
+                   0x4B, /* PPEM    */
+                   0x53, /* GTEQ    */
+                   0x23, /* SWAP    */
+                   0x4B, /* PPEM    */
+                   0x51, /* LTEQ    */
+                   0x5A, /* AND     */
+                   0x58, /* IF      */
+                   0x38, /*   SHPIX */
+                   0x1B, /* ELSE    */
+                   0x21, /*   POP   */
+                   0x21, /*   POP   */
+                   0x59  /* EIF     */
+                 },
+                 /* #1 inline delta function 2 */
+                 {
+                   0x4B, /* PPEM    */
+                   0x54, /* EQ      */
+                   0x58, /* IF      */
+                   0x38, /*   SHPIX */
+                   0x1B, /* ELSE    */
+                   0x21, /*   POP   */
+                   0x21, /*   POP   */
+                   0x59  /* EIF     */
+                 },
+                 /* #2 diagonal stroke function */
+                 {
+                   0x20, /* DUP     */
+                   0x20, /* DUP     */
+                   0xB0, /* PUSHB_1 */
+                   0x01, /*   1     */
+                   0x60, /* ADD     */
+                   0x46, /* GC_cur  */
+                   0xB0, /* PUSHB_1 */
+                   0x40, /*   64    */
+                   0x23, /* SWAP    */
+                   0x42  /* WS      */
+                 },
+                 /* #3 VacuFormRound function */
+                 {
+                   0x45, /* RCVT    */
+                   0x23, /* SWAP    */
+                   0x46, /* GC_cur  */
+                   0x60, /* ADD     */
+                   0x20, /* DUP     */
+                   0xB0, /* PUSHB_1 */
+                   0x26, /*   38    */
+                 },
+                 /* #4 TTFautohint bytecode (old) */
+                 {
+                   0x20, /* DUP     */
+                   0x64, /* ABS     */
+                   0xB0, /* PUSHB_1 */
+                   0x20, /*   32    */
+                   0x60, /* ADD     */
+                   0x66, /* FLOOR   */
+                   0x23, /* SWAP    */
+                   0xB0  /* PUSHB_1 */
+                 },
+                 /* #5 spacing function 1 */
+                 {
+                   0x01, /* SVTCA_x */
+                   0xB0, /* PUSHB_1 */
+                   0x18, /*   24    */
+                   0x43, /* RS      */
+                   0x58  /* IF      */
+                 },
+                 /* #6 spacing function 2 */
+                 {
+                   0x01, /* SVTCA_x */
+                   0x18, /* RTG     */
+                   0xB0, /* PUSHB_1 */
+                   0x18, /*   24    */
+                   0x43, /* RS      */
+                   0x58  /* IF      */
+                 },
                };
     FT_UShort  opcode_patterns   = 7;
-    FT_UShort  opcode_pointer[7] = {0,0,0,0,0,0,0};
-    FT_UShort  opcode_size[7]    = {12,9,8,5,7,4,5};
+    FT_UShort  opcode_pointer[7] = {  0, 0,  0, 0, 0, 0, 0 };
+    FT_UShort  opcode_size[7]    = { 12, 8, 10, 7, 8, 5, 6 };
     FT_UShort  i;
 #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
 

reply via email to

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