freetype-devel
[Top][All Lists]
Advanced

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

Re: Re: [ft-devel] Question about CFF arithmetic operator dup


From: Ning Dong
Subject: Re: Re: [ft-devel] Question about CFF arithmetic operator dup
Date: Sat, 10 Oct 2009 13:47:45 +0800

The reqiured arguement num of cff_op_dup defined in cff_argument_counts is 1. 
Before processing cff_op_dup, agrs minus 1 to points the first arguement of 
cff_op_dup. The comment said:
        /* At this point, `args' points to the first argument of the  */
        /* operand in case `req_args' isn't zero.  Otherwise, we have */
        /* to adjust `args' manually.                                 */
So, if cff_op_dup duplicates args[0],  args should add 2 to keep these two 
elements on stack.

According to codes of cff_op_abs, cff_op_and and cff_op_exch processing:
        case cff_op_abs:
          FT_TRACE4(( " abs\n" ));

          if ( args[0] < 0 )
            args[0] = -args[0];
          args++;
          break;

        case cff_op_add:
          FT_TRACE4(( " add\n" ));

          args[0] += args[1];
          args++;
          break;

        case cff_op_exch:
          {
            FT_Fixed  tmp;


            FT_TRACE4(( " exch\n" ));

            tmp     = args[0];
            args[0] = args[1];
            args[1] = tmp;
            args   += 2;
          }
          break;

cff_op_abs consumes 1 and push 1, args++ is right;
cff_op_add consumes 2 and push 1, args++ is right;
cff_op_exch consumes 2 and push 2, args +=2 is right;
cff_op_dup consumes 1 and push 2, args +=2 should be right;

------------------                               
Ning Dong
2009-10-10

-------------------------------------------------------------
发件人:Graham Asher
发送日期:2009-10-09 22:48:53
收件人:flintning
抄送:freetype-devel
主题:Re: [ft-devel] Question about CFF arithmetic operator dup

The net effect of consuming one element and adding two is to add one. 
The code looks correct to me.

Graham Asher


Ning Dong wrote:
> Hi,
>  
> I'm checking the cff_decoder_parse_charstrings function in cffgload.c 
> of FT239.
>  
> According to CFF technical note #5177, operator "dup" should 
> consume one element and put two elements to arguement stack:
> dup     any dup(12 27) any any
>  
> But in cff_decoder_parse_charstrings, the codes like this:
>         case cff_op_dup:
>           FT_TRACE4(( " dup\n" ));
>           args[1] = args[0];
>           args++;                //should be args+=2?
>           break;
> Only one element put to arguement stack.
>  
> Is this a bug?
> FT2310 is the same.
> 2009-10-09
> ------------------------------------------------------------------------
> Ning Dong
> ------------------------------------------------------------------------
>
> _______________________________________________
> Freetype-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/freetype-devel
>   




_______________________________________________
Freetype-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freetype-devel

__________ Information from ESET Smart Security, version of virus signature 
database 4494 (20091009) __________

The message was checked by ESET Smart Security.

http://www.eset.com



reply via email to

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