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

2009-10-18 Thread Werner LEMBERG

 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;

Yes, this looks good; I've changed the code accordingly.

Unfortunately, I don't have a font which uses `put', `get', or `dup'.
Has anyone such a beast for testing?


Werner


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


[ft-devel] Question about CFF arithmetic operator dup

2009-10-09 Thread Ning Dong
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
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


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

2009-10-09 Thread Graham Asher
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
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel
  





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


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

2009-10-09 Thread Ning Dong
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
 Freetype-devel@nongnu.org
 http://lists.nongnu.org/mailman/listinfo/freetype-devel
   




___
Freetype-devel mailing list
Freetype-devel@nongnu.org
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


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