freetype-devel
[Top][All Lists]
Advanced

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

RE: [Devel] Helvetica 75 Bold does not work with TT_CONFIG_OPTION_BYTECO


From: Boris Letocha
Subject: RE: [Devel] Helvetica 75 Bold does not work with TT_CONFIG_OPTION_BYTECODE_INTERPRETER
Date: Thu, 7 Oct 2004 13:23:02 +0200

Hello all,

Maybe you remember my e-mail (look below). Our customer pushes me so
hard that I tried to find bug myself and I was successful. I had to
change ttdebug.c a little to be able to trace "cvt" code range in TTFs.

This is problematic part of disassembly of that font. 
        01140: IF         
        01141: NPUSHW       (2):     0    89 
        01147: WCVTF      
        01148: PUSHB[1]              0 
        01150: RCVT       
        01151: PUSHB[1]             10 
        01153: MAX        
        01154: ELSE       
        01155: PUSHB[1]              0 
        01157: EIF        
"IF" instruction has zero on stack so it should skip instructions till
"ELSE" instruction.

For skipping instructions this function is called: (All code is from
ttinterp.c)

  static FT_Bool
  SkipCode( EXEC_OP )
  {
    CUR.IP += CUR.length;

    if ( CUR.IP < CUR.codeSize )
    {
      CUR.opcode = CUR.code[CUR.IP];

      CUR.length = opcode_length[CUR.opcode];
      if ( CUR.length < 0 )
      {
        if ( CUR.IP + 1 > CUR.codeSize )
          goto Fail_Overflow;
        CUR.length = CUR.code[CUR.IP + 1] + 2;
      }

      if ( CUR.IP + CUR.length <= CUR.codeSize )
        return SUCCESS;
    }

  Fail_Overflow:
    CUR.error = TT_Err_Code_Overflow;
    return FAILURE;
  }

Unfortunately in this font instruction: NPUSHW(2) was used and its
length in bytes is 6, but this "CUR.length = CUR.code[CUR.IP + 1] + 2;"
will calculate 4.

So my fix of that line is:

        CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1];

Same change should be done in function TT_RunIns( TT_ExecContext  exc )

And in table "const FT_Char  opcode_length[256] =" line:

   -1,-1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,

Change to line:

   -1,-2, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,

So total number of changed lines is 3.

Regards,

Boris Letocha

-----Original Message-----
From: address@hidden [mailto:address@hidden On
Behalf Of Boris Letocha
Sent: Tuesday, July 20, 2004 2:45 PM
To: address@hidden
Subject: [Devel] Helvetica 75 Bold does not work with
TT_CONFIG_OPTION_BYTECODE_INTERPRETER

Hello all,

In current CVS version (also in 2.1.8, don't know if it worked anytime
before) after opening font HLB_____.TTF (size 50400)
function FT_Set_Char_Size returns 0x81 = Too_Few_Arguments in decoding
of WCvtF instruction (it needs 2 values on stack, there is only 1
value).
It is reproducible in ftview.exe.
Interesting is that non-bold version works correctly. Font works
correctly in Windows. I will send font for investigation privately after
request.
Is it possible to implement fallback to non interpreter way if problem
of this kind is found?

Thanks,

Boris Letocha


_______________________________________________
Devel mailing list
address@hidden
http://www.freetype.org/mailman/listinfo/devel



reply via email to

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