freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] CFF divide operator


From: Derek B. Noonburg
Subject: [ft-devel] CFF divide operator
Date: Thu, 4 Feb 2016 19:16:40 -0800 (PST)

I've run into some CFF fonts that use the divide operator, which is
unimplemented in the new CFF interpreter.

Here's a patch that fixes it -- at least for the fonts I'm looking at.
I'm doing a floating point divide and then converting to fixed point.
There may be a better way to handle it.  Maybe someone more familiar
with the cf2 internals could comment?

I was going to include a sample font, but I can't get ftview to load CFF
fonts (and I need it to figure out exactly which font(s) are the problem
cases).  Is there some trick to making ftview work with CFF fonts?

- Derek


*** freetype-2.6.2/src/cff/cf2intrp.c   2016-02-04 18:55:23.328184725 -0800
--- freetype-2.6.2b/src/cff/cf2intrp.c  2016-02-04 19:01:36.821256136 -0800
***************
*** 871,880 ****
              break;
  
            case cf2_escDIV: /* in spec */
!             FT_TRACE4(( " div\n" ));
  
!             CF2_FIXME;
!             break;
  
            case cf2_escNEG: /* in spec */
              FT_TRACE4(( " neg\n" ));
--- 871,888 ----
              break;
  
            case cf2_escDIV: /* in spec */
!             {
!               CF2_Int num;
!               CF2_Int den;
  
!               FT_TRACE4(( " div\n" ));
! 
!               den = cf2_stack_popInt( opStack );
!               num = cf2_stack_popInt( opStack );
!               cf2_stack_pushFixed( opStack,
!                                    cf2_floatToFixed((float)num / (float)den) 
);
!             }
!             continue;
  
            case cf2_escNEG: /* in spec */
              FT_TRACE4(( " neg\n" ));




reply via email to

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