ReactOS  0.4.14-dev-583-g2a1ba2c
psintrp.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* psintrp.c */
4 /* */
5 /* Adobe's CFF Interpreter (body). */
6 /* */
7 /* Copyright 2007-2014 Adobe Systems Incorporated. */
8 /* */
9 /* This software, and all works of authorship, whether in source or */
10 /* object code form as indicated by the copyright notice(s) included */
11 /* herein (collectively, the "Work") is made available, and may only be */
12 /* used, modified, and distributed under the FreeType Project License, */
13 /* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
14 /* FreeType Project License, each contributor to the Work hereby grants */
15 /* to any individual or legal entity exercising permissions granted by */
16 /* the FreeType Project License and this section (hereafter, "You" or */
17 /* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
18 /* royalty-free, irrevocable (except as stated in this section) patent */
19 /* license to make, have made, use, offer to sell, sell, import, and */
20 /* otherwise transfer the Work, where such license applies only to those */
21 /* patent claims licensable by such contributor that are necessarily */
22 /* infringed by their contribution(s) alone or by combination of their */
23 /* contribution(s) with the Work to which such contribution(s) was */
24 /* submitted. If You institute patent litigation against any entity */
25 /* (including a cross-claim or counterclaim in a lawsuit) alleging that */
26 /* the Work or a contribution incorporated within the Work constitutes */
27 /* direct or contributory patent infringement, then any patent licenses */
28 /* granted to You under this License for that Work shall terminate as of */
29 /* the date such litigation is filed. */
30 /* */
31 /* By using, modifying, or distributing the Work you indicate that you */
32 /* have read and understood the terms and conditions of the */
33 /* FreeType Project License as well as those provided in this section, */
34 /* and you accept them fully. */
35 /* */
36 /***************************************************************************/
37 
38 
39 #include "psft.h"
40 #include FT_INTERNAL_DEBUG_H
41 #include FT_SERVICE_CFF_TABLE_LOAD_H
42 
43 #include "psglue.h"
44 #include "psfont.h"
45 #include "psstack.h"
46 #include "pshints.h"
47 #include "psintrp.h"
48 
49 #include "pserror.h"
50 
51 #include "psobjs.h" /* for cff_random */
52 #include "t1decode.h" /* for t1 seac */
53 
54 
55  /*************************************************************************/
56  /* */
57  /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
58  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
59  /* messages during execution. */
60  /* */
61 #undef FT_COMPONENT
62 #define FT_COMPONENT trace_cf2interp
63 
64 
65  FT_LOCAL_DEF( void )
67  FT_Error* error )
68  {
69  FT_ZERO( hintmask );
70 
71  hintmask->error = error;
72  }
73 
74 
77  {
78  return hintmask->isValid;
79  }
80 
81 
84  {
85  return hintmask->isNew;
86  }
87 
88 
89  FT_LOCAL_DEF( void )
91  FT_Bool val )
92  {
93  hintmask->isNew = val;
94  }
95 
96 
97  /* clients call `getMaskPtr' in order to iterate */
98  /* through hint mask */
99 
102  {
103  return hintmask->mask;
104  }
105 
106 
107  static size_t
109  size_t bitCount )
110  {
111  if ( bitCount > CF2_MAX_HINTS )
112  {
113  /* total of h and v stems must be <= 96 */
114  CF2_SET_ERROR( hintmask->error, Invalid_Glyph_Format );
115  return 0;
116  }
117 
118  hintmask->bitCount = bitCount;
119  hintmask->byteCount = ( hintmask->bitCount + 7 ) / 8;
120 
121  hintmask->isValid = TRUE;
122  hintmask->isNew = TRUE;
123 
124  return bitCount;
125  }
126 
127 
128  /* consume the hintmask bytes from the charstring, advancing the src */
129  /* pointer */
130  static void
132  CF2_Buffer charstring,
133  size_t bitCount )
134  {
135  size_t i;
136 
137 #ifndef CF2_NDEBUG
138  /* these are the bits in the final mask byte that should be zero */
139  /* Note: this variable is only used in an assert expression below */
140  /* and then only if CF2_NDEBUG is not defined */
141  CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1;
142 #endif
143 
144 
145  /* initialize counts and isValid */
146  if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 )
147  return;
148 
149  FT_ASSERT( hintmask->byteCount > 0 );
150 
151  FT_TRACE4(( " (maskbytes:" ));
152 
153  /* set mask and advance interpreter's charstring pointer */
154  for ( i = 0; i < hintmask->byteCount; i++ )
155  {
156  hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring );
157  FT_TRACE4(( " 0x%02X", hintmask->mask[i] ));
158  }
159 
160  FT_TRACE4(( ")\n" ));
161 
162  /* assert any unused bits in last byte are zero unless there's a prior */
163  /* error */
164  /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */
165 #ifndef CF2_NDEBUG
166  FT_ASSERT( ( hintmask->mask[hintmask->byteCount - 1] & mask ) == 0 ||
167  *hintmask->error );
168 #endif
169  }
170 
171 
172  FT_LOCAL_DEF( void )
174  size_t bitCount )
175  {
176  size_t i;
177  CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1;
178 
179 
180  /* initialize counts and isValid */
181  if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 )
182  return;
183 
184  FT_ASSERT( hintmask->byteCount > 0 );
185  FT_ASSERT( hintmask->byteCount <=
186  sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) );
187 
188  /* set mask to all ones */
189  for ( i = 0; i < hintmask->byteCount; i++ )
190  hintmask->mask[i] = 0xFF;
191 
192  /* clear unused bits */
193  /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */
194  hintmask->mask[hintmask->byteCount - 1] &= ~mask;
195  }
196 
197 
198  /* Type2 charstring opcodes */
199  enum
200  {
202  cf2_cmdHSTEM, /* 1 */
204  cf2_cmdVSTEM, /* 3 */
205  cf2_cmdVMOVETO, /* 4 */
206  cf2_cmdRLINETO, /* 5 */
207  cf2_cmdHLINETO, /* 6 */
208  cf2_cmdVLINETO, /* 7 */
210  cf2_cmdCLOSEPATH, /* 9 T1 only */
211  cf2_cmdCALLSUBR, /* 10 */
212  cf2_cmdRETURN, /* 11 */
213  cf2_cmdESC, /* 12 */
214  cf2_cmdHSBW, /* 13 T1 only */
215  cf2_cmdENDCHAR, /* 14 */
216  cf2_cmdVSINDEX, /* 15 */
217  cf2_cmdBLEND, /* 16 */
219  cf2_cmdHSTEMHM, /* 18 */
220  cf2_cmdHINTMASK, /* 19 */
221  cf2_cmdCNTRMASK, /* 20 */
222  cf2_cmdRMOVETO, /* 21 */
223  cf2_cmdHMOVETO, /* 22 */
224  cf2_cmdVSTEMHM, /* 23 */
233  };
234 
235  enum
236  {
238  cf2_escVSTEM3, /* 1 T1 only */
239  cf2_escHSTEM3, /* 2 T1 only */
240  cf2_escAND, /* 3 */
241  cf2_escOR, /* 4 */
242  cf2_escNOT, /* 5 */
243  cf2_escSEAC, /* 6 T1 only */
244  cf2_escSBW, /* 7 T1 only */
246  cf2_escABS, /* 9 */
247  cf2_escADD, /* 10 like otherADD */
248  cf2_escSUB, /* 11 like otherSUB */
249  cf2_escDIV, /* 12 */
251  cf2_escNEG, /* 14 */
252  cf2_escEQ, /* 15 */
253  cf2_escCALLOTHERSUBR,/* 16 T1 only */
254  cf2_escPOP, /* 17 T1 only */
255  cf2_escDROP, /* 18 */
257  cf2_escPUT, /* 20 like otherPUT */
258  cf2_escGET, /* 21 like otherGET */
259  cf2_escIFELSE, /* 22 like otherIFELSE */
260  cf2_escRANDOM, /* 23 like otherRANDOM */
261  cf2_escMUL, /* 24 like otherMUL */
263  cf2_escSQRT, /* 26 */
264  cf2_escDUP, /* 27 like otherDUP */
265  cf2_escEXCH, /* 28 like otherEXCH */
266  cf2_escINDEX, /* 29 */
267  cf2_escROLL, /* 30 */
270  cf2_escSETCURRENTPT, /* 33 T1 only */
271  cf2_escHFLEX, /* 34 */
272  cf2_escFLEX, /* 35 */
273  cf2_escHFLEX1, /* 36 */
274  cf2_escFLEX1, /* 37 */
275  cf2_escRESERVED_38 /* 38 & all higher */
276  };
277 
278 
279  /* `stemHintArray' does not change once we start drawing the outline. */
280  static void
282  CF2_Stack opStack,
283  CF2_ArrStack stemHintArray,
284  CF2_Fixed* width,
285  FT_Bool* haveWidth,
286  CF2_Fixed hintOffset )
287  {
288  CF2_UInt i;
289  CF2_UInt count = cf2_stack_count( opStack );
290  FT_Bool hasWidthArg = (FT_Bool)( count & 1 );
291 
292  /* variable accumulates delta values from operand stack */
293  CF2_Fixed position = hintOffset;
294 
295  if ( font->isT1 && !font->decoder->flex_state && !*haveWidth )
296  FT_ERROR(( "cf2_doStems (Type 1 mode):"
297  " No width. Use hsbw/sbw as first op\n" ));
298 
299  if ( !font->isT1 && hasWidthArg && !*haveWidth )
300  *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
301  cf2_getNominalWidthX( font->decoder ) );
302 
303  if ( font->decoder->width_only )
304  goto exit;
305 
306  for ( i = hasWidthArg ? 1 : 0; i < count; i += 2 )
307  {
308  /* construct a CF2_StemHint and push it onto the list */
309  CF2_StemHintRec stemhint;
310 
311 
312  stemhint.min =
313  position = ADD_INT32( position,
314  cf2_stack_getReal( opStack, i ) );
315  stemhint.max =
316  position = ADD_INT32( position,
317  cf2_stack_getReal( opStack, i + 1 ) );
318 
319  stemhint.used = FALSE;
320  stemhint.maxDS =
321  stemhint.minDS = 0;
322 
323  cf2_arrstack_push( stemHintArray, &stemhint ); /* defer error check */
324  }
325 
326  cf2_stack_clear( opStack );
327 
328  exit:
329  /* cf2_doStems must define a width (may be default) */
330  *haveWidth = TRUE;
331  }
332 
333 
334  static void
336  CF2_Fixed* curX,
337  CF2_Fixed* curY,
338  CF2_GlyphPath glyphPath,
339  const FT_Bool* readFromStack,
340  FT_Bool doConditionalLastRead )
341  {
342  CF2_Fixed vals[14];
343  CF2_UInt idx;
344  FT_Bool isHFlex;
345  CF2_Int top, i, j;
346 
347 
348  vals[0] = *curX;
349  vals[1] = *curY;
350  idx = 0;
351  isHFlex = FT_BOOL( readFromStack[9] == FALSE );
352  top = isHFlex ? 9 : 10;
353 
354  for ( i = 0; i < top; i++ )
355  {
356  vals[i + 2] = vals[i];
357  if ( readFromStack[i] )
358  vals[i + 2] = ADD_INT32( vals[i + 2], cf2_stack_getReal( opStack,
359  idx++ ) );
360  }
361 
362  if ( isHFlex )
363  vals[9 + 2] = *curY;
364 
365  if ( doConditionalLastRead )
366  {
367  FT_Bool lastIsX = (FT_Bool)(
368  cf2_fixedAbs( SUB_INT32( vals[10], *curX ) ) >
369  cf2_fixedAbs( SUB_INT32( vals[11], *curY ) ) );
370  CF2_Fixed lastVal = cf2_stack_getReal( opStack, idx );
371 
372 
373  if ( lastIsX )
374  {
375  vals[12] = ADD_INT32( vals[10], lastVal );
376  vals[13] = *curY;
377  }
378  else
379  {
380  vals[12] = *curX;
381  vals[13] = ADD_INT32( vals[11], lastVal );
382  }
383  }
384  else
385  {
386  if ( readFromStack[10] )
387  vals[12] = ADD_INT32( vals[10],
388  cf2_stack_getReal( opStack, idx++ ) );
389  else
390  vals[12] = *curX;
391 
392  if ( readFromStack[11] )
393  vals[13] = ADD_INT32( vals[11],
394  cf2_stack_getReal( opStack, idx ) );
395  else
396  vals[13] = *curY;
397  }
398 
399  for ( j = 0; j < 2; j++ )
400  cf2_glyphpath_curveTo( glyphPath, vals[j * 6 + 2],
401  vals[j * 6 + 3],
402  vals[j * 6 + 4],
403  vals[j * 6 + 5],
404  vals[j * 6 + 6],
405  vals[j * 6 + 7] );
406 
407  cf2_stack_clear( opStack );
408 
409  *curX = vals[12];
410  *curY = vals[13];
411  }
412 
413 
414  /* Blend numOperands on the stack, */
415  /* store results into the first numBlends values, */
416  /* then pop remaining arguments. */
417  static void
418  cf2_doBlend( const CFF_Blend blend,
419  CF2_Stack opStack,
420  CF2_UInt numBlends )
421  {
422  CF2_UInt delta;
423  CF2_UInt base;
424  CF2_UInt i, j;
425  CF2_UInt numOperands = (CF2_UInt)( numBlends * blend->lenBV );
426 
427 
428  base = cf2_stack_count( opStack ) - numOperands;
429  delta = base + numBlends;
430 
431  for ( i = 0; i < numBlends; i++ )
432  {
433  const CF2_Fixed* weight = &blend->BV[1];
434 
435  /* start with first term */
436  CF2_Fixed sum = cf2_stack_getReal( opStack, i + base );
437 
438 
439  for ( j = 1; j < blend->lenBV; j++ )
440  sum = ADD_INT32( sum,
441  FT_MulFix( *weight++,
442  cf2_stack_getReal( opStack,
443  delta++ ) ) );
444 
445  /* store blended result */
446  cf2_stack_setReal( opStack, i + base, sum );
447  }
448 
449  /* leave only `numBlends' results on stack */
450  cf2_stack_pop( opStack, numOperands - numBlends );
451  }
452 
453 
454  /*
455  * `error' is a shared error code used by many objects in this
456  * routine. Before the code continues from an error, it must check and
457  * record the error in `*error'. The idea is that this shared
458  * error code will record the first error encountered. If testing
459  * for an error anyway, the cost of `goto exit' is small, so we do it,
460  * even if continuing would be safe. In this case, `lastError' is
461  * set, so the testing and storing can be done in one place, at `exit'.
462  *
463  * Continuing after an error is intended for objects which do their own
464  * testing of `*error', e.g., array stack functions. This allows us to
465  * avoid an extra test after the call.
466  *
467  * Unimplemented opcodes are ignored.
468  *
469  */
470  FT_LOCAL_DEF( void )
472  CF2_Buffer buf,
474  const FT_Vector* translation,
475  FT_Bool doingSeac,
476  CF2_Fixed curX,
477  CF2_Fixed curY,
478  CF2_Fixed* width )
479  {
480  /* lastError is used for errors that are immediately tested */
481  FT_Error lastError = FT_Err_Ok;
482 
483  /* pointer to parsed font object */
484  PS_Decoder* decoder = font->decoder;
485 
486  FT_Error* error = &font->error;
487  FT_Memory memory = font->memory;
488 
489  CF2_Fixed scaleY = font->innerTransform.d;
490  CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder );
491 
492  /* stuff for Type 1 */
493  FT_Int known_othersubr_result_cnt = 0;
494  FT_Bool large_int = FALSE;
495  FT_Bool initial_map_ready = FALSE;
496 
497 #define PS_STORAGE_SIZE 3
498  CF2_F16Dot16 results[PS_STORAGE_SIZE]; /* for othersubr results */
499  FT_Int result_cnt = 0;
500 
501  /* save this for hinting seac accents */
502  CF2_Fixed hintOriginY = curY;
503 
504  CF2_Stack opStack = NULL;
505  FT_UInt stackSize;
506  FT_Byte op1; /* first opcode byte */
507 
508  CF2_F16Dot16 storage[CF2_STORAGE_SIZE]; /* for `put' and `get' */
509  CF2_F16Dot16 flexStore[6]; /* for Type 1 flex */
510 
511  /* instruction limit; 20,000,000 matches Avalon */
512  FT_UInt32 instructionLimit = 20000000UL;
513 
514  CF2_ArrStackRec subrStack;
515 
516  FT_Bool haveWidth;
517  CF2_Buffer charstring = NULL;
518 
519  CF2_Int charstringIndex = -1; /* initialize to empty */
520 
521  /* TODO: placeholders for hint structures */
522 
523  /* objects used for hinting */
524  CF2_ArrStackRec hStemHintArray;
525  CF2_ArrStackRec vStemHintArray;
526 
527  CF2_HintMaskRec hintMask;
528 #ifdef __REACTOS__
529  CF2_GlyphPathRec *glyphPath = malloc(sizeof(CF2_GlyphPathRec));
530  if (!glyphPath) return;
531 /* Ugly but it allows us to reduce the diff */
532 #define glyphPath (*glyphPath)
533 #else
534  CF2_GlyphPathRec glyphPath;
535 #endif
536 
537  FT_ZERO( &storage );
538  FT_ZERO( &results );
539  FT_ZERO( &flexStore );
540 
541  /* initialize the remaining objects */
542  cf2_arrstack_init( &subrStack,
543  memory,
544  error,
545  sizeof ( CF2_BufferRec ) );
546  cf2_arrstack_init( &hStemHintArray,
547  memory,
548  error,
549  sizeof ( CF2_StemHintRec ) );
550  cf2_arrstack_init( &vStemHintArray,
551  memory,
552  error,
553  sizeof ( CF2_StemHintRec ) );
554 
555  /* initialize CF2_StemHint arrays */
556  cf2_hintmask_init( &hintMask, error );
557 
558  /* initialize path map to manage drawing operations */
559 
560  /* Note: last 4 params are used to handle `MoveToPermissive', which */
561  /* may need to call `hintMap.Build' */
562  /* TODO: MoveToPermissive is gone; are these still needed? */
563  cf2_glyphpath_init( &glyphPath,
564  font,
565  callbacks,
566  scaleY,
567  /* hShift, */
568  &hStemHintArray,
569  &vStemHintArray,
570  &hintMask,
571  hintOriginY,
572  &font->blues,
573  translation );
574 
575  /*
576  * Initialize state for width parsing. From the CFF Spec:
577  *
578  * The first stack-clearing operator, which must be one of hstem,
579  * hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto,
580  * rmoveto, or endchar, takes an additional argument - the width (as
581  * described earlier), which may be expressed as zero or one numeric
582  * argument.
583  *
584  * What we implement here uses the first validly specified width, but
585  * does not detect errors for specifying more than one width.
586  *
587  * If one of the above operators occurs without explicitly specifying
588  * a width, we assume the default width.
589  *
590  * CFF2 charstrings always return the default width (0).
591  *
592  */
593  haveWidth = font->isCFF2 ? TRUE : FALSE;
594  *width = cf2_getDefaultWidthX( decoder );
595 
596  /*
597  * Note: At this point, all pointers to resources must be NULL
598  * and all local objects must be initialized.
599  * There must be no branches to `exit:' above this point.
600  *
601  */
602 
603  /* allocate an operand stack */
604  stackSize = font->isCFF2 ? cf2_getMaxstack( decoder )
606  opStack = cf2_stack_init( memory, error, stackSize );
607 
608  if ( !opStack )
609  {
610  lastError = FT_THROW( Out_Of_Memory );
611  goto exit;
612  }
613 
614  /* initialize subroutine stack by placing top level charstring as */
615  /* first element (max depth plus one for the charstring) */
616  /* Note: Caller owns and must finalize the first charstring. */
617  /* Our copy of it does not change that requirement. */
618  cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 );
619 
620  charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack );
621  *charstring = *buf; /* structure copy */
622 
623  charstringIndex = 0; /* entry is valid now */
624 
625  /* catch errors so far */
626  if ( *error )
627  goto exit;
628 
629  /* main interpreter loop */
630  while ( 1 )
631  {
632  if ( font->isT1 )
633  FT_ASSERT( known_othersubr_result_cnt == 0 ||
634  result_cnt == 0 );
635 
636  if ( cf2_buf_isEnd( charstring ) )
637  {
638  /* If we've reached the end of the charstring, simulate a */
639  /* cf2_cmdRETURN or cf2_cmdENDCHAR. */
640  /* We do this for both CFF and CFF2. */
641  if ( charstringIndex )
642  op1 = cf2_cmdRETURN; /* end of buffer for subroutine */
643  else
644  op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */
645  }
646  else
647  {
648  op1 = (FT_Byte)cf2_buf_readByte( charstring );
649 
650  /* Explicit RETURN and ENDCHAR in CFF2 should be ignored. */
651  /* Note: Trace message will report 0 instead of 11 or 14. */
652  if ( ( op1 == cf2_cmdRETURN || op1 == cf2_cmdENDCHAR ) &&
653  font->isCFF2 )
654  op1 = cf2_cmdRESERVED_0;
655  }
656 
657  if ( font->isT1 )
658  {
659  if ( !initial_map_ready &&
660  !( op1 == cf2_cmdHSTEM ||
661  op1 == cf2_cmdVSTEM ||
662  op1 == cf2_cmdHSBW ||
663  op1 == cf2_cmdCALLSUBR ||
664  op1 == cf2_cmdRETURN ||
665  op1 == cf2_cmdESC ||
666  op1 == cf2_cmdENDCHAR ||
667  op1 >= 32 /* Numbers */ ) )
668  {
669  /* Skip outline commands first time round. */
670  /* `endchar' will trigger initial hintmap build */
671  /* and rewind the charstring. */
672  cf2_stack_clear( opStack );
673  continue;
674  }
675 
676  if ( result_cnt > 0 &&
677  !( op1 == cf2_cmdCALLSUBR ||
678  op1 == cf2_cmdRETURN ||
679  op1 == cf2_cmdESC ||
680  op1 >= 32 /* Numbers */ ) )
681  {
682  /* all operands have been transferred by previous pops */
683  result_cnt = 0;
684  }
685 
686  if ( large_int && !( op1 >= 32 || op1 == cf2_escDIV ) )
687  {
688  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
689  " no `div' after large integer\n" ));
690 
691  large_int = FALSE;
692  }
693  }
694 
695  /* check for errors once per loop */
696  if ( *error )
697  goto exit;
698 
699  instructionLimit--;
700  if ( instructionLimit == 0 )
701  {
702  lastError = FT_THROW( Invalid_Glyph_Format );
703  goto exit;
704  }
705 
706  switch( op1 )
707  {
708  case cf2_cmdRESERVED_0:
709  case cf2_cmdRESERVED_2:
710  case cf2_cmdRESERVED_17:
711  /* we may get here if we have a prior error */
712  FT_TRACE4(( " unknown op (%d)\n", op1 ));
713  break;
714 
715  case cf2_cmdVSINDEX:
716  FT_TRACE4(( " vsindex\n" ));
717 
718  if ( !font->isCFF2 )
719  break; /* clear stack & ignore */
720 
721  if ( font->blend.usedBV )
722  {
723  /* vsindex not allowed after blend */
724  lastError = FT_THROW( Invalid_Glyph_Format );
725  goto exit;
726  }
727 
728  {
729  FT_Int temp = cf2_stack_popInt( opStack );
730 
731 
732  if ( temp >= 0 )
733  font->vsindex = (FT_UInt)temp;
734  }
735  break;
736 
737  case cf2_cmdBLEND:
738  {
739  FT_UInt numBlends;
740 
741 
742  FT_TRACE4(( " blend\n" ));
743 
744  if ( !font->isCFF2 )
745  break; /* clear stack & ignore */
746 
747  /* do we have a `blend' op in a non-variant font? */
748  if ( !font->blend.font )
749  {
750  lastError = FT_THROW( Invalid_Glyph_Format );
751  goto exit;
752  }
753 
754  /* check cached blend vector */
755  if ( font->cffload->blend_check_vector( &font->blend,
756  font->vsindex,
757  font->lenNDV,
758  font->NDV ) )
759  {
760  lastError = font->cffload->blend_build_vector( &font->blend,
761  font->vsindex,
762  font->lenNDV,
763  font->NDV );
764  if ( lastError )
765  goto exit;
766  }
767 
768  /* do the blend */
769  numBlends = (FT_UInt)cf2_stack_popInt( opStack );
770  if ( numBlends > stackSize )
771  {
772  lastError = FT_THROW( Invalid_Glyph_Format );
773  goto exit;
774  }
775 
776  cf2_doBlend( &font->blend, opStack, numBlends );
777 
778  font->blend.usedBV = TRUE;
779  }
780  continue; /* do not clear the stack */
781 
782  case cf2_cmdHSTEMHM:
783  case cf2_cmdHSTEM:
784  FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" ));
785 
786  if ( !font->isT1 )
787  {
788  /* never add hints after the mask is computed */
789  /* except if in Type 1 mode (no hintmask op) */
790  if ( cf2_hintmask_isValid( &hintMask ) )
791  {
792  FT_TRACE4(( "cf2_interpT2CharString:"
793  " invalid horizontal hint mask\n" ));
794  break;
795  }
796  }
797 
798  /* add left-sidebearing correction in Type 1 mode */
799  cf2_doStems( font,
800  opStack,
801  &hStemHintArray,
802  width,
803  &haveWidth,
804  font->isT1 ? decoder->builder.left_bearing->y
805  : 0 );
806 
807  if ( decoder->width_only )
808  goto exit;
809 
810  break;
811 
812  case cf2_cmdVSTEMHM:
813  case cf2_cmdVSTEM:
814  FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" ));
815 
816  if ( !font->isT1 )
817  {
818  /* never add hints after the mask is computed */
819  /* except if in Type 1 mode (no hintmask op) */
820  if ( cf2_hintmask_isValid( &hintMask ) )
821  {
822  FT_TRACE4(( "cf2_interpT2CharString:"
823  " invalid vertical hint mask\n" ));
824  break;
825  }
826  }
827 
828  /* add left-sidebearing correction in Type 1 mode */
829  cf2_doStems( font,
830  opStack,
831  &vStemHintArray,
832  width,
833  &haveWidth,
834  font->isT1 ? decoder->builder.left_bearing->x
835  : 0 );
836 
837  if ( decoder->width_only )
838  goto exit;
839 
840  break;
841 
842  case cf2_cmdVMOVETO:
843  FT_TRACE4(( " vmoveto\n" ));
844 
845  if ( font->isT1 && !decoder->flex_state && !haveWidth )
846  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
847  " No width. Use hsbw/sbw as first op\n" ));
848 
849  if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
850  *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
851  nominalWidthX );
852 
853  /* width is defined or default after this */
854  haveWidth = TRUE;
855 
856  if ( decoder->width_only )
857  goto exit;
858 
859  curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
860 
861  cf2_glyphpath_moveTo( &glyphPath, curX, curY );
862 
863  break;
864 
865  case cf2_cmdRLINETO:
866  {
867  CF2_UInt idx;
868  CF2_UInt count = cf2_stack_count( opStack );
869 
870 
871  FT_TRACE4(( " rlineto\n" ));
872 
873  for ( idx = 0; idx < count; idx += 2 )
874  {
875  curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
876  idx + 0 ) );
877  curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
878  idx + 1 ) );
879 
880  cf2_glyphpath_lineTo( &glyphPath, curX, curY );
881  }
882 
883  cf2_stack_clear( opStack );
884  }
885  continue; /* no need to clear stack again */
886 
887  case cf2_cmdHLINETO:
888  case cf2_cmdVLINETO:
889  {
890  CF2_UInt idx;
891  CF2_UInt count = cf2_stack_count( opStack );
892 
893  FT_Bool isX = FT_BOOL( op1 == cf2_cmdHLINETO );
894 
895 
896  FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" ));
897 
898  for ( idx = 0; idx < count; idx++ )
899  {
900  CF2_Fixed v = cf2_stack_getReal( opStack, idx );
901 
902 
903  if ( isX )
904  curX = ADD_INT32( curX, v );
905  else
906  curY = ADD_INT32( curY, v );
907 
908  isX = !isX;
909 
910  cf2_glyphpath_lineTo( &glyphPath, curX, curY );
911  }
912 
913  cf2_stack_clear( opStack );
914  }
915  continue;
916 
917  case cf2_cmdRCURVELINE:
918  case cf2_cmdRRCURVETO:
919  {
920  CF2_UInt count = cf2_stack_count( opStack );
921  CF2_UInt idx = 0;
922 
923 
924  FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n"
925  : " rrcurveto\n" ));
926 
927  while ( idx + 6 <= count )
928  {
929  CF2_Fixed x1, y1, x2, y2, x3, y3;
930 
931 
932  x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
933  y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY );
934  x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 );
935  y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 );
936  x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
937  y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 );
938 
939  cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
940 
941  curX = x3;
942  curY = y3;
943  idx += 6;
944  }
945 
946  if ( op1 == cf2_cmdRCURVELINE )
947  {
948  curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
949  idx + 0 ) );
950  curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
951  idx + 1 ) );
952 
953  cf2_glyphpath_lineTo( &glyphPath, curX, curY );
954  }
955 
956  cf2_stack_clear( opStack );
957  }
958  continue; /* no need to clear stack again */
959 
960  case cf2_cmdCLOSEPATH:
961  if ( !font->isT1 )
962  FT_TRACE4(( " unknown op (%d)\n", op1 ));
963  else
964  {
965  FT_TRACE4(( " closepath" ));
966 
967  /* if there is no path, `closepath' is a no-op */
968  ps_builder_close_contour( &decoder->builder );
969 
970  haveWidth = TRUE;
971  }
972  break;
973 
974  case cf2_cmdCALLGSUBR:
975  case cf2_cmdCALLSUBR:
976  {
977  CF2_Int subrNum;
978 
979 
980  FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr"
981  : " callsubr" ));
982 
983  if ( ( !font->isT1 && charstringIndex > CF2_MAX_SUBR ) ||
984  ( font->isT1 && charstringIndex > T1_MAX_SUBRS_CALLS ) )
985  {
986  /* max subr plus one for charstring */
987  lastError = FT_THROW( Invalid_Glyph_Format );
988  goto exit; /* overflow of stack */
989  }
990 
991  /* push our current CFF charstring region on subrStack */
992  charstring = (CF2_Buffer)
994  &subrStack,
995  (size_t)charstringIndex + 1 );
996 
997  /* set up the new CFF region and pointer */
998  subrNum = cf2_stack_popInt( opStack );
999 
1000  if ( font->isT1 && decoder->locals_hash )
1001  {
1002  size_t* val = ft_hash_num_lookup( subrNum,
1003  decoder->locals_hash );
1004 
1005 
1006  if ( val )
1007  subrNum = *val;
1008  else
1009  subrNum = -1;
1010  }
1011 
1012  switch ( op1 )
1013  {
1014  case cf2_cmdCALLGSUBR:
1015  FT_TRACE4(( " (idx %d, entering level %d)\n",
1016  subrNum + decoder->globals_bias,
1017  charstringIndex + 1 ));
1018 
1019  if ( cf2_initGlobalRegionBuffer( decoder,
1020  subrNum,
1021  charstring ) )
1022  {
1023  lastError = FT_THROW( Invalid_Glyph_Format );
1024  goto exit; /* subroutine lookup or stream error */
1025  }
1026  break;
1027 
1028  default:
1029  /* cf2_cmdCALLSUBR */
1030  FT_TRACE4(( " (idx %d, entering level %d)\n",
1031  subrNum + decoder->locals_bias,
1032  charstringIndex + 1 ));
1033 
1034  if ( cf2_initLocalRegionBuffer( decoder,
1035  subrNum,
1036  charstring ) )
1037  {
1038  lastError = FT_THROW( Invalid_Glyph_Format );
1039  goto exit; /* subroutine lookup or stream error */
1040  }
1041  }
1042 
1043  charstringIndex += 1; /* entry is valid now */
1044  }
1045  continue; /* do not clear the stack */
1046 
1047  case cf2_cmdRETURN:
1048  FT_TRACE4(( " return (leaving level %d)\n", charstringIndex ));
1049 
1050  if ( charstringIndex < 1 )
1051  {
1052  /* Note: cannot return from top charstring */
1053  lastError = FT_THROW( Invalid_Glyph_Format );
1054  goto exit; /* underflow of stack */
1055  }
1056 
1057  /* restore position in previous charstring */
1058  charstring = (CF2_Buffer)
1060  &subrStack,
1061  (CF2_UInt)--charstringIndex );
1062  continue; /* do not clear the stack */
1063 
1064  case cf2_cmdESC:
1065  {
1066  FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring );
1067 
1068 
1069  /* first switch for 2-byte operators handles CFF2 */
1070  /* and opcodes that are reserved for both CFF and CFF2 */
1071  switch ( op2 )
1072  {
1073  case cf2_escHFLEX:
1074  {
1075  static const FT_Bool readFromStack[12] =
1076  {
1077  TRUE /* dx1 */, FALSE /* dy1 */,
1078  TRUE /* dx2 */, TRUE /* dy2 */,
1079  TRUE /* dx3 */, FALSE /* dy3 */,
1080  TRUE /* dx4 */, FALSE /* dy4 */,
1081  TRUE /* dx5 */, FALSE /* dy5 */,
1082  TRUE /* dx6 */, FALSE /* dy6 */
1083  };
1084 
1085 
1086  FT_TRACE4(( " hflex\n" ));
1087 
1088  cf2_doFlex( opStack,
1089  &curX,
1090  &curY,
1091  &glyphPath,
1092  readFromStack,
1093  FALSE /* doConditionalLastRead */ );
1094  }
1095  continue;
1096 
1097  case cf2_escFLEX:
1098  {
1099  static const FT_Bool readFromStack[12] =
1100  {
1101  TRUE /* dx1 */, TRUE /* dy1 */,
1102  TRUE /* dx2 */, TRUE /* dy2 */,
1103  TRUE /* dx3 */, TRUE /* dy3 */,
1104  TRUE /* dx4 */, TRUE /* dy4 */,
1105  TRUE /* dx5 */, TRUE /* dy5 */,
1106  TRUE /* dx6 */, TRUE /* dy6 */
1107  };
1108 
1109 
1110  FT_TRACE4(( " flex\n" ));
1111 
1112  cf2_doFlex( opStack,
1113  &curX,
1114  &curY,
1115  &glyphPath,
1116  readFromStack,
1117  FALSE /* doConditionalLastRead */ );
1118  }
1119  break; /* TODO: why is this not a continue? */
1120 
1121  case cf2_escHFLEX1:
1122  {
1123  static const FT_Bool readFromStack[12] =
1124  {
1125  TRUE /* dx1 */, TRUE /* dy1 */,
1126  TRUE /* dx2 */, TRUE /* dy2 */,
1127  TRUE /* dx3 */, FALSE /* dy3 */,
1128  TRUE /* dx4 */, FALSE /* dy4 */,
1129  TRUE /* dx5 */, TRUE /* dy5 */,
1130  TRUE /* dx6 */, FALSE /* dy6 */
1131  };
1132 
1133 
1134  FT_TRACE4(( " hflex1\n" ));
1135 
1136  cf2_doFlex( opStack,
1137  &curX,
1138  &curY,
1139  &glyphPath,
1140  readFromStack,
1141  FALSE /* doConditionalLastRead */ );
1142  }
1143  continue;
1144 
1145  case cf2_escFLEX1:
1146  {
1147  static const FT_Bool readFromStack[12] =
1148  {
1149  TRUE /* dx1 */, TRUE /* dy1 */,
1150  TRUE /* dx2 */, TRUE /* dy2 */,
1151  TRUE /* dx3 */, TRUE /* dy3 */,
1152  TRUE /* dx4 */, TRUE /* dy4 */,
1153  TRUE /* dx5 */, TRUE /* dy5 */,
1154  FALSE /* dx6 */, FALSE /* dy6 */
1155  };
1156 
1157 
1158  FT_TRACE4(( " flex1\n" ));
1159 
1160  cf2_doFlex( opStack,
1161  &curX,
1162  &curY,
1163  &glyphPath,
1164  readFromStack,
1165  TRUE /* doConditionalLastRead */ );
1166  }
1167  continue;
1168 
1169  /* these opcodes are always reserved */
1170  case cf2_escRESERVED_8:
1171  case cf2_escRESERVED_13:
1172  case cf2_escRESERVED_19:
1173  case cf2_escRESERVED_25:
1174  case cf2_escRESERVED_31:
1175  case cf2_escRESERVED_32:
1176  FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
1177  break;
1178 
1179  default:
1180  {
1181  if ( font->isCFF2 || op2 >= cf2_escRESERVED_38 )
1182  FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
1183  else if ( font->isT1 && result_cnt > 0 && op2 != cf2_escPOP )
1184  {
1185  /* all operands have been transferred by previous pops */
1186  result_cnt = 0;
1187  }
1188  else
1189  {
1190  /* second switch for 2-byte operators handles */
1191  /* CFF and Type 1 */
1192  switch ( op2 )
1193  {
1194 
1195  case cf2_escDOTSECTION:
1196  /* something about `flip type of locking' -- ignore it */
1197  FT_TRACE4(( " dotsection\n" ));
1198 
1199  break;
1200 
1201  case cf2_escVSTEM3:
1202  case cf2_escHSTEM3:
1203  /*
1204  * Type 1: Type 2:
1205  * x0 dx0 x1 dx1 x2 dx2 vstem3 x dx {dxa dxb}* vstem
1206  * y0 dy0 y1 dy1 y2 dy2 hstem3 y dy {dya dyb}* hstem
1207  * relative to lsb point relative to zero
1208  *
1209  */
1210  {
1211  if ( !font->isT1 )
1212  FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
1213  else
1214  {
1215  CF2_F16Dot16 v0, v1, v2;
1216 
1217  FT_Bool isV = FT_BOOL( op2 == cf2_escVSTEM3 );
1218 
1219 
1220  FT_TRACE4(( isV ? " vstem3\n"
1221  : " hstem3\n" ));
1222 
1223  FT_ASSERT( cf2_stack_count( opStack ) == 6 );
1224 
1225  v0 = cf2_stack_getReal( opStack, 0 );
1226  v1 = cf2_stack_getReal( opStack, 2 );
1227  v2 = cf2_stack_getReal( opStack, 4 );
1228 
1230  opStack, 2,
1231  SUB_INT32( SUB_INT32( v1, v0 ),
1232  cf2_stack_getReal( opStack, 1 ) ) );
1234  opStack, 4,
1235  SUB_INT32( SUB_INT32( v2, v1 ),
1236  cf2_stack_getReal( opStack, 3 ) ) );
1237 
1238  /* add left-sidebearing correction */
1239  cf2_doStems( font,
1240  opStack,
1241  isV ? &vStemHintArray : &hStemHintArray,
1242  width,
1243  &haveWidth,
1244  isV ? decoder->builder.left_bearing->x
1245  : decoder->builder.left_bearing->y );
1246 
1247  if ( decoder->width_only )
1248  goto exit;
1249  }
1250  }
1251  break;
1252 
1253  case cf2_escAND:
1254  {
1257 
1258 
1259  FT_TRACE4(( " and\n" ));
1260 
1261  arg2 = cf2_stack_popFixed( opStack );
1262  arg1 = cf2_stack_popFixed( opStack );
1263 
1264  cf2_stack_pushInt( opStack, arg1 && arg2 );
1265  }
1266  continue; /* do not clear the stack */
1267 
1268  case cf2_escOR:
1269  {
1272 
1273 
1274  FT_TRACE4(( " or\n" ));
1275 
1276  arg2 = cf2_stack_popFixed( opStack );
1277  arg1 = cf2_stack_popFixed( opStack );
1278 
1279  cf2_stack_pushInt( opStack, arg1 || arg2 );
1280  }
1281  continue; /* do not clear the stack */
1282 
1283  case cf2_escNOT:
1284  {
1285  CF2_F16Dot16 arg;
1286 
1287 
1288  FT_TRACE4(( " not\n" ));
1289 
1290  arg = cf2_stack_popFixed( opStack );
1291 
1292  cf2_stack_pushInt( opStack, !arg );
1293  }
1294  continue; /* do not clear the stack */
1295 
1296  case cf2_escSEAC:
1297  if ( !font->isT1 )
1298  FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
1299  else
1300  {
1301  FT_Error error2;
1302  CF2_Int bchar_index, achar_index;
1303  FT_Vector left_bearing, advance;
1304 
1305 #ifdef FT_CONFIG_OPTION_INCREMENTAL
1306  T1_Face face = (T1_Face)decoder->builder.face;
1307 #endif
1308  CF2_BufferRec component;
1309  CF2_Fixed dummyWidth;
1310 
1311  CF2_Int achar = cf2_stack_popInt( opStack );
1312  CF2_Int bchar = cf2_stack_popInt( opStack );
1313 
1314  FT_Pos ady = cf2_stack_popFixed ( opStack );
1315  FT_Pos adx = cf2_stack_popFixed ( opStack );
1316  FT_Pos asb = cf2_stack_popFixed ( opStack );
1317 
1318 
1319  FT_TRACE4(( " seac\n" ));
1320 
1321  if ( doingSeac )
1322  {
1323  FT_ERROR(( " nested seac\n" ));
1324  lastError = FT_THROW( Invalid_Glyph_Format );
1325  goto exit; /* nested seac */
1326  }
1327 
1328  if ( decoder->builder.metrics_only )
1329  {
1330  FT_ERROR(( " unexpected seac\n" ));
1331  lastError = FT_THROW( Invalid_Glyph_Format );
1332  goto exit; /* unexpected seac */
1333  }
1334 
1335  /* `glyph_names' is set to 0 for CID fonts which do */
1336  /* not include an encoding. How can we deal with */
1337  /* these? */
1338 #ifdef FT_CONFIG_OPTION_INCREMENTAL
1339  if ( decoder->glyph_names == 0 &&
1340  !face->root.internal->incremental_interface )
1341 #else
1342  if ( decoder->glyph_names == 0 )
1343 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
1344  {
1345  FT_ERROR((
1346  "cf2_interpT2CharString: (Type 1 seac)"
1347  " glyph names table not available in this font\n" ));
1348  lastError = FT_THROW( Invalid_Glyph_Format );
1349  goto exit;
1350  }
1351 
1352  /* seac weirdness */
1353  adx += decoder->builder.left_bearing->x;
1354 
1355 #ifdef FT_CONFIG_OPTION_INCREMENTAL
1356  if ( face->root.internal->incremental_interface )
1357  {
1358  /* the caller must handle the font encoding also */
1359  bchar_index = bchar;
1360  achar_index = achar;
1361  }
1362  else
1363 #endif
1364  {
1365  bchar_index = t1_lookup_glyph_by_stdcharcode_ps(
1366  decoder, bchar );
1367  achar_index = t1_lookup_glyph_by_stdcharcode_ps(
1368  decoder, achar );
1369  }
1370 
1371  if ( bchar_index < 0 || achar_index < 0 )
1372  {
1373  FT_ERROR((
1374  "cf2_interpT2CharString: (Type 1 seac)"
1375  " invalid seac character code arguments\n" ));
1376  lastError = FT_THROW( Invalid_Glyph_Format );
1377  goto exit;
1378  }
1379 
1380  /* if we are trying to load a composite glyph, */
1381  /* do not load the accent character and return */
1382  /* the array of subglyphs. */
1383  if ( decoder->builder.no_recurse )
1384  {
1385  FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
1386  FT_GlyphLoader loader = glyph->internal->loader;
1387  FT_SubGlyph subg;
1388 
1389 
1390  /* reallocate subglyph array if necessary */
1391  error2 = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );
1392  if ( error2 )
1393  {
1394  lastError = error2; /* pass FreeType error through */
1395  goto exit;
1396  }
1397 
1398  subg = loader->current.subglyphs;
1399 
1400  /* subglyph 0 = base character */
1401  subg->index = bchar_index;
1402  subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
1404  subg->arg1 = 0;
1405  subg->arg2 = 0;
1406  subg++;
1407 
1408  /* subglyph 1 = accent character */
1409  subg->index = achar_index;
1411  subg->arg1 = (FT_Int)FIXED_TO_INT( adx - asb );
1412  subg->arg2 = (FT_Int)FIXED_TO_INT( ady );
1413 
1414  /* set up remaining glyph fields */
1415  glyph->num_subglyphs = 2;
1416  glyph->subglyphs = loader->base.subglyphs;
1417  glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
1418 
1419  loader->current.num_subglyphs = 2;
1420 
1421  goto exit;
1422  }
1423 
1424  /* First load `bchar' in builder */
1425  /* now load the unscaled outline */
1426 
1427  /* prepare loader */
1429 
1430  error2 = cf2_getT1SeacComponent( decoder,
1431  (FT_UInt)bchar_index,
1432  &component );
1433  if ( error2 )
1434  {
1435  lastError = error2; /* pass FreeType error through */
1436  goto exit;
1437  }
1439  &component,
1440  callbacks,
1441  translation,
1442  TRUE,
1443  0,
1444  0,
1445  &dummyWidth );
1446  cf2_freeT1SeacComponent( decoder, &component );
1447 
1448  /* save the left bearing and width of the base */
1449  /* character as they will be erased by the next load */
1450 
1451  left_bearing = *decoder->builder.left_bearing;
1452  advance = *decoder->builder.advance;
1453 
1454  decoder->builder.left_bearing->x = 0;
1455  decoder->builder.left_bearing->y = 0;
1456 
1457  /* Now load `achar' on top of */
1458  /* the base outline */
1459 
1460  error2 = cf2_getT1SeacComponent( decoder,
1461  (FT_UInt)achar_index,
1462  &component );
1463  if ( error2 )
1464  {
1465  lastError = error2; /* pass FreeType error through */
1466  goto exit;
1467  }
1469  &component,
1470  callbacks,
1471  translation,
1472  TRUE,
1473  adx - asb,
1474  ady,
1475  &dummyWidth );
1476  cf2_freeT1SeacComponent( decoder, &component );
1477 
1478  /* restore the left side bearing and */
1479  /* advance width of the base character */
1480 
1481  *decoder->builder.left_bearing = left_bearing;
1482  *decoder->builder.advance = advance;
1483 
1484  goto exit;
1485  }
1486  break;
1487 
1488  case cf2_escSBW:
1489  if ( !font->isT1 )
1490  FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
1491  else
1492  {
1493  CF2_Fixed lsb_x, lsb_y;
1494  PS_Builder* builder;
1495 
1496 
1497  FT_TRACE4(( " sbw" ));
1498 
1499  builder = &decoder->builder;
1500 
1501  builder->advance->y = cf2_stack_popFixed( opStack );
1502  builder->advance->x = cf2_stack_popFixed( opStack );
1503 
1504  lsb_y = cf2_stack_popFixed( opStack );
1505  lsb_x = cf2_stack_popFixed( opStack );
1506 
1507  builder->left_bearing->x =
1508  ADD_INT32( builder->left_bearing->x, lsb_x );
1509  builder->left_bearing->y =
1510  ADD_INT32( builder->left_bearing->y, lsb_y );
1511 
1512  haveWidth = TRUE;
1513 
1514  /* the `metrics_only' indicates that we only want */
1515  /* to compute the glyph's metrics (lsb + advance */
1516  /* width), not load the rest of it; so exit */
1517  /* immediately */
1518  if ( builder->metrics_only )
1519  goto exit;
1520 
1521  if ( initial_map_ready )
1522  {
1523  curX = ADD_INT32( curX, lsb_x );
1524  curY = ADD_INT32( curY, lsb_y );
1525  }
1526  }
1527  break;
1528 
1529  case cf2_escABS:
1530  {
1531  CF2_F16Dot16 arg;
1532 
1533 
1534  FT_TRACE4(( " abs\n" ));
1535 
1536  arg = cf2_stack_popFixed( opStack );
1537 
1538  if ( arg < -CF2_FIXED_MAX )
1539  cf2_stack_pushFixed( opStack, CF2_FIXED_MAX );
1540  else
1541  cf2_stack_pushFixed( opStack, FT_ABS( arg ) );
1542  }
1543  continue; /* do not clear the stack */
1544 
1545  case cf2_escADD:
1546  {
1547  CF2_F16Dot16 summand1;
1548  CF2_F16Dot16 summand2;
1549 
1550 
1551  FT_TRACE4(( " add\n" ));
1552 
1553  summand2 = cf2_stack_popFixed( opStack );
1554  summand1 = cf2_stack_popFixed( opStack );
1555 
1556  cf2_stack_pushFixed( opStack,
1557  ADD_INT32( summand1,
1558  summand2 ) );
1559  }
1560  continue; /* do not clear the stack */
1561 
1562  case cf2_escSUB:
1563  {
1564  CF2_F16Dot16 minuend;
1565  CF2_F16Dot16 subtrahend;
1566 
1567 
1568  FT_TRACE4(( " sub\n" ));
1569 
1570  subtrahend = cf2_stack_popFixed( opStack );
1571  minuend = cf2_stack_popFixed( opStack );
1572 
1573  cf2_stack_pushFixed( opStack,
1574  SUB_INT32( minuend, subtrahend ) );
1575  }
1576  continue; /* do not clear the stack */
1577 
1578  case cf2_escDIV:
1579  {
1580  CF2_F16Dot16 dividend;
1582 
1583 
1584  FT_TRACE4(( " div\n" ));
1585 
1586  if ( font->isT1 && large_int )
1587  {
1588  divisor = (CF2_F16Dot16)cf2_stack_popInt( opStack );
1589  dividend = (CF2_F16Dot16)cf2_stack_popInt( opStack );
1590 
1591  large_int = FALSE;
1592  }
1593  else
1594  {
1595  divisor = cf2_stack_popFixed( opStack );
1596  dividend = cf2_stack_popFixed( opStack );
1597  }
1598 
1599  cf2_stack_pushFixed( opStack,
1600  FT_DivFix( dividend, divisor ) );
1601 
1602  }
1603  continue; /* do not clear the stack */
1604 
1605  case cf2_escNEG:
1606  {
1607  CF2_F16Dot16 arg;
1608 
1609 
1610  FT_TRACE4(( " neg\n" ));
1611 
1612  arg = cf2_stack_popFixed( opStack );
1613 
1614  if ( arg < -CF2_FIXED_MAX )
1615  cf2_stack_pushFixed( opStack, CF2_FIXED_MAX );
1616  else
1617  cf2_stack_pushFixed( opStack, -arg );
1618  }
1619  continue; /* do not clear the stack */
1620 
1621  case cf2_escEQ:
1622  {
1625 
1626 
1627  FT_TRACE4(( " eq\n" ));
1628 
1629  arg2 = cf2_stack_popFixed( opStack );
1630  arg1 = cf2_stack_popFixed( opStack );
1631 
1632  cf2_stack_pushInt( opStack, arg1 == arg2 );
1633  }
1634  continue; /* do not clear the stack */
1635 
1636  case cf2_escCALLOTHERSUBR:
1637  if ( !font->isT1 )
1638  FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
1639  else
1640  {
1641  CF2_Int subr_no;
1642  CF2_Int arg_cnt;
1643  CF2_UInt count;
1644  CF2_UInt opIdx = 0;
1645 
1646 
1647  FT_TRACE4(( " callothersubr\n" ));
1648 
1649  subr_no = cf2_stack_popInt( opStack );
1650  arg_cnt = cf2_stack_popInt( opStack );
1651 
1652  /*******************************************************/
1653  /* */
1654  /* remove all operands to callothersubr from the stack */
1655  /* */
1656  /* for handled othersubrs, where we know the number of */
1657  /* arguments, we increase the stack by the value of */
1658  /* known_othersubr_result_cnt */
1659  /* */
1660  /* for unhandled othersubrs the following pops adjust */
1661  /* the stack pointer as necessary */
1662 
1663  count = cf2_stack_count( opStack );
1665 
1666  opIdx += count - (CF2_UInt)arg_cnt;
1667 
1668  known_othersubr_result_cnt = 0;
1669  result_cnt = 0;
1670 
1671  /* XXX TODO: The checks to `arg_count == <whatever>' */
1672  /* might not be correct; an othersubr expects a */
1673  /* certain number of operands on the PostScript stack */
1674  /* (as opposed to the T1 stack) but it doesn't have to */
1675  /* put them there by itself; previous othersubrs might */
1676  /* have left the operands there if they were not */
1677  /* followed by an appropriate number of pops */
1678  /* */
1679  /* On the other hand, Adobe Reader 7.0.8 for Linux */
1680  /* doesn't accept a font that contains charstrings */
1681  /* like */
1682  /* */
1683  /* 100 200 2 20 callothersubr */
1684  /* 300 1 20 callothersubr pop */
1685  /* */
1686  /* Perhaps this is the reason why BuildCharArray */
1687  /* exists. */
1688 
1689  switch ( subr_no )
1690  {
1691  case 0: /* end flex feature */
1692  if ( arg_cnt != 3 )
1693  goto Unexpected_OtherSubr;
1694 
1695  if ( initial_map_ready &&
1696  ( !decoder->flex_state ||
1697  decoder->num_flex_vectors != 7 ) )
1698  {
1699  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
1700  " unexpected flex end\n" ));
1701  lastError = FT_THROW( Invalid_Glyph_Format );
1702  goto exit;
1703  }
1704 
1705  /* the two `results' are popped */
1706  /* by the following setcurrentpoint */
1707  cf2_stack_pushFixed( opStack, curX );
1708  cf2_stack_pushFixed( opStack, curY );
1709  known_othersubr_result_cnt = 2;
1710  break;
1711 
1712  case 1: /* start flex feature */
1713  if ( arg_cnt != 0 )
1714  goto Unexpected_OtherSubr;
1715 
1716  if ( !initial_map_ready )
1717  break;
1718 
1719  if ( ps_builder_check_points( &decoder->builder, 6 ) )
1720  goto exit;
1721 
1722  decoder->flex_state = 1;
1723  decoder->num_flex_vectors = 0;
1724  break;
1725 
1726  case 2: /* add flex vectors */
1727  {
1728  FT_Int idx;
1729  FT_Int idx2;
1730 
1731 
1732  if ( arg_cnt != 0 )
1733  goto Unexpected_OtherSubr;
1734 
1735  if ( !initial_map_ready )
1736  break;
1737 
1738  if ( !decoder->flex_state )
1739  {
1740  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
1741  " missing flex start\n" ));
1742  lastError = FT_THROW( Invalid_Glyph_Format );
1743  goto exit;
1744  }
1745 
1746  /* note that we should not add a point for */
1747  /* index 0; this will move our current position */
1748  /* to the flex point without adding any point */
1749  /* to the outline */
1750  idx = decoder->num_flex_vectors++;
1751  if ( idx > 0 && idx < 7 )
1752  {
1753  /* in malformed fonts it is possible to have */
1754  /* other opcodes in the middle of a flex (which */
1755  /* don't increase `num_flex_vectors'); we thus */
1756  /* have to check whether we can add a point */
1757 
1758  if ( ps_builder_check_points( &decoder->builder,
1759  1 ) )
1760  {
1761  lastError = FT_THROW( Invalid_Glyph_Format );
1762  goto exit;
1763  }
1764 
1765  /* map: 1->2 2->4 3->6 4->2 5->4 6->6 */
1766  idx2 = ( idx > 3 ? idx - 3 : idx ) * 2;
1767 
1768  flexStore[idx2 - 2] = curX;
1769  flexStore[idx2 - 1] = curY;
1770 
1771  if ( idx == 3 || idx == 6 )
1772  cf2_glyphpath_curveTo( &glyphPath,
1773  flexStore[0],
1774  flexStore[1],
1775  flexStore[2],
1776  flexStore[3],
1777  flexStore[4],
1778  flexStore[5] );
1779  }
1780  }
1781  break;
1782 
1783  case 3: /* change hints */
1784  if ( arg_cnt != 1 )
1785  goto Unexpected_OtherSubr;
1786 
1787  if ( initial_map_ready )
1788  {
1789  /* do not clear hints if initial hintmap */
1790  /* is not ready - we need to collate all */
1791  cf2_arrstack_clear( &vStemHintArray );
1792  cf2_arrstack_clear( &hStemHintArray );
1793 
1794  cf2_hintmask_init( &hintMask, error );
1795  hintMask.isValid = FALSE;
1796  hintMask.isNew = TRUE;
1797  }
1798 
1799  known_othersubr_result_cnt = 1;
1800  break;
1801 
1802  case 12:
1803  case 13:
1804  /* counter control hints, clear stack */
1805  cf2_stack_clear( opStack );
1806  break;
1807 
1808  case 14:
1809  case 15:
1810  case 16:
1811  case 17:
1812  case 18: /* multiple masters */
1813  {
1814  PS_Blend blend = decoder->blend;
1815  FT_UInt num_points, nn, mm;
1816  CF2_UInt delta;
1817  CF2_UInt values;
1818 
1819 
1820  if ( !blend )
1821  {
1822  FT_ERROR((
1823  "cf2_interpT2CharString:"
1824  " unexpected multiple masters operator\n" ));
1825  lastError = FT_THROW( Invalid_Glyph_Format );
1826  goto exit;
1827  }
1828 
1829  num_points = (FT_UInt)subr_no - 13 +
1830  ( subr_no == 18 );
1831  if ( arg_cnt != (FT_Int)( num_points *
1832  blend->num_designs ) )
1833  {
1834  FT_ERROR((
1835  "cf2_interpT2CharString:"
1836  " incorrect number of multiple masters arguments\n" ));
1837  lastError = FT_THROW( Invalid_Glyph_Format );
1838  goto exit;
1839  }
1840 
1841  /* We want to compute */
1842  /* */
1843  /* a0*w0 + a1*w1 + ... + ak*wk */
1844  /* */
1845  /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */
1846  /* */
1847  /* However, given that w0 + w1 + ... + wk == 1, we */
1848  /* can rewrite it easily as */
1849  /* */
1850  /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */
1851  /* */
1852  /* where k == num_designs-1. */
1853  /* */
1854  /* I guess that's why it's written in this `compact' */
1855  /* form. */
1856  /* */
1857  delta = opIdx + num_points;
1858  values = opIdx;
1859  for ( nn = 0; nn < num_points; nn++ )
1860  {
1861  CF2_Fixed tmp = cf2_stack_getReal( opStack,
1862  values );
1863 
1864 
1865  for ( mm = 1; mm < blend->num_designs; mm++ )
1866  tmp = ADD_INT32( tmp,
1867  FT_MulFix(
1868  cf2_stack_getReal( opStack,
1869  delta++ ),
1870  blend->weight_vector[mm] ) );
1871 
1872  cf2_stack_setReal( opStack, values++, tmp );
1873  }
1874  cf2_stack_pop( opStack,
1875  (CF2_UInt)arg_cnt - num_points );
1876 
1877  known_othersubr_result_cnt = (FT_Int)num_points;
1878  break;
1879  }
1880 
1881  case 19:
1882  /* <idx> 1 19 callothersubr */
1883  /* ==> replace elements starting from index */
1884  /* cvi( <idx> ) of BuildCharArray with */
1885  /* WeightVector */
1886  {
1887  FT_Int idx;
1888  PS_Blend blend = decoder->blend;
1889 
1890 
1891  if ( arg_cnt != 1 || !blend )
1892  goto Unexpected_OtherSubr;
1893 
1894  idx = cf2_stack_popInt( opStack );
1895 
1896  if ( idx < 0 ||
1897  (FT_UInt)idx + blend->num_designs >
1898  decoder->len_buildchar )
1899  goto Unexpected_OtherSubr;
1900 
1901  ft_memcpy( &decoder->buildchar[idx],
1902  blend->weight_vector,
1903  blend->num_designs *
1904  sizeof ( blend->weight_vector[0] ) );
1905  }
1906  break;
1907 
1908  case 20:
1909  /* <arg1> <arg2> 2 20 callothersubr pop */
1910  /* ==> push <arg1> + <arg2> onto T1 stack */
1911  {
1912  CF2_F16Dot16 summand1;
1913  CF2_F16Dot16 summand2;
1914 
1915 
1916  if ( arg_cnt != 2 )
1917  goto Unexpected_OtherSubr;
1918 
1919  summand2 = cf2_stack_popFixed( opStack );
1920  summand1 = cf2_stack_popFixed( opStack );
1921 
1922  cf2_stack_pushFixed( opStack,
1923  ADD_INT32( summand1,
1924  summand2 ) );
1925  known_othersubr_result_cnt = 1;
1926  }
1927  break;
1928 
1929  case 21:
1930  /* <arg1> <arg2> 2 21 callothersubr pop */
1931  /* ==> push <arg1> - <arg2> onto T1 stack */
1932  {
1933  CF2_F16Dot16 minuend;
1934  CF2_F16Dot16 subtrahend;
1935 
1936 
1937  if ( arg_cnt != 2 )
1938  goto Unexpected_OtherSubr;
1939 
1940  subtrahend = cf2_stack_popFixed( opStack );
1941  minuend = cf2_stack_popFixed( opStack );
1942 
1943  cf2_stack_pushFixed( opStack,
1944  SUB_INT32( minuend,
1945  subtrahend ) );
1946  known_othersubr_result_cnt = 1;
1947  }
1948  break;
1949 
1950  case 22:
1951  /* <arg1> <arg2> 2 22 callothersubr pop */
1952  /* ==> push <arg1> * <arg2> onto T1 stack */
1953  {
1954  CF2_F16Dot16 factor1;
1955  CF2_F16Dot16 factor2;
1956 
1957 
1958  if ( arg_cnt != 2 )
1959  goto Unexpected_OtherSubr;
1960 
1961  factor2 = cf2_stack_popFixed( opStack );
1962  factor1 = cf2_stack_popFixed( opStack );
1963 
1964  cf2_stack_pushFixed( opStack,
1965  FT_MulFix( factor1, factor2 ) );
1966  known_othersubr_result_cnt = 1;
1967  }
1968  break;
1969 
1970  case 23:
1971  /* <arg1> <arg2> 2 23 callothersubr pop */
1972  /* ==> push <arg1> / <arg2> onto T1 stack */
1973  {
1974  CF2_F16Dot16 dividend;
1976 
1977 
1978  if ( arg_cnt != 2 )
1979  goto Unexpected_OtherSubr;
1980 
1981  divisor = cf2_stack_popFixed( opStack );
1982  dividend = cf2_stack_popFixed( opStack );
1983 
1984  if ( divisor == 0 )
1985  goto Unexpected_OtherSubr;
1986 
1987  cf2_stack_pushFixed( opStack,
1988  FT_DivFix( dividend,
1989  divisor ) );
1990  known_othersubr_result_cnt = 1;
1991  }
1992  break;
1993 
1994  case 24:
1995  /* <val> <idx> 2 24 callothersubr */
1996  /* ==> set BuildCharArray[cvi( <idx> )] = <val> */
1997  {
1998  CF2_Int idx;
1999  PS_Blend blend = decoder->blend;
2000 
2001 
2002  if ( arg_cnt != 2 || !blend )
2003  goto Unexpected_OtherSubr;
2004 
2005  idx = cf2_stack_popInt( opStack );
2006 
2007  if ( idx < 0 ||
2008  (FT_UInt)idx >= decoder->len_buildchar )
2009  goto Unexpected_OtherSubr;
2010 
2011  decoder->buildchar[idx] =
2012  cf2_stack_popFixed( opStack );
2013  }
2014  break;
2015 
2016  case 25:
2017  /* <idx> 1 25 callothersubr pop */
2018  /* ==> push BuildCharArray[cvi( idx )] */
2019  /* onto T1 stack */
2020  {
2021  CF2_Int idx;
2022  PS_Blend blend = decoder->blend;
2023 
2024 
2025  if ( arg_cnt != 1 || !blend )
2026  goto Unexpected_OtherSubr;
2027 
2028  idx = cf2_stack_popInt( opStack );
2029 
2030  if ( idx < 0 ||
2031  (FT_UInt)idx >= decoder->len_buildchar )
2032  goto Unexpected_OtherSubr;
2033 
2034  cf2_stack_pushFixed( opStack,
2035  decoder->buildchar[idx] );
2036  known_othersubr_result_cnt = 1;
2037  }
2038  break;
2039 
2040 #if 0
2041  case 26:
2042  /* <val> mark <idx> */
2043  /* ==> set BuildCharArray[cvi( <idx> )] = <val>, */
2044  /* leave mark on T1 stack */
2045  /* <val> <idx> */
2046  /* ==> set BuildCharArray[cvi( <idx> )] = <val> */
2047  XXX which routine has left its mark on the
2048  XXX (PostScript) stack?;
2049  break;
2050 #endif
2051 
2052  case 27:
2053  /* <res1> <res2> <val1> <val2> 4 27 callothersubr pop */
2054  /* ==> push <res1> onto T1 stack if <val1> <= <val2>, */
2055  /* otherwise push <res2> */
2056  {
2059  CF2_F16Dot16 cond1;
2060  CF2_F16Dot16 cond2;
2061 
2062 
2063  if ( arg_cnt != 4 )
2064  goto Unexpected_OtherSubr;
2065 
2066  cond2 = cf2_stack_popFixed( opStack );
2067  cond1 = cf2_stack_popFixed( opStack );
2068  arg2 = cf2_stack_popFixed( opStack );
2069  arg1 = cf2_stack_popFixed( opStack );
2070 
2071  cf2_stack_pushFixed( opStack,
2072  cond1 <= cond2 ? arg1 : arg2 );
2073  known_othersubr_result_cnt = 1;
2074  }
2075  break;
2076 
2077  case 28:
2078  /* 0 28 callothersubr pop */
2079  /* ==> push random value from interval [0, 1) */
2080  /* onto stack */
2081  {
2082  CF2_F16Dot16 r;
2083 
2084 
2085  if ( arg_cnt != 0 )
2086  goto Unexpected_OtherSubr;
2087 
2088  /* only use the lower 16 bits of `random' */
2089  /* to generate a number in the range (0;1] */
2090  r = (CF2_F16Dot16)
2091  ( ( decoder->current_subfont->random & 0xFFFF ) + 1 );
2092 
2093  decoder->current_subfont->random =
2094  cff_random( decoder->current_subfont->random );
2095 
2096  cf2_stack_pushFixed( opStack, r );
2097  known_othersubr_result_cnt = 1;
2098  }
2099  break;
2100 
2101  default:
2102  if ( arg_cnt >= 0 && subr_no >= 0 )
2103  {
2104  FT_Int i;
2105 
2106 
2107  FT_ERROR((
2108  "cf2_interpT2CharString (Type 1 mode):"
2109  " unknown othersubr [%d %d], wish me luck\n",
2110  arg_cnt, subr_no ));
2111 
2112  /* store the unused args */
2113  /* for this unhandled OtherSubr */
2114 
2115  if ( arg_cnt > PS_STORAGE_SIZE )
2117  result_cnt = arg_cnt;
2118 
2119  for ( i = 1; i <= arg_cnt; i++ )
2120  results[result_cnt - i] =
2121  cf2_stack_popFixed( opStack );
2122 
2123  break;
2124  }
2125  /* fall through */
2126 
2127  Unexpected_OtherSubr:
2128  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
2129  " invalid othersubr [%d %d]\n",
2130  arg_cnt, subr_no ));
2131  lastError = FT_THROW( Invalid_Glyph_Format );
2132  goto exit;
2133  }
2134  }
2135  continue; /* do not clear the stack */
2136 
2137  case cf2_escPOP:
2138  if ( !font->isT1 )
2139  FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
2140  else
2141  {
2142  FT_TRACE4(( " pop" ));
2143 
2144  if ( known_othersubr_result_cnt > 0 )
2145  {
2146  known_othersubr_result_cnt--;
2147  /* ignore, we pushed the operands ourselves */
2148  continue;
2149  }
2150 
2151  if ( result_cnt == 0 )
2152  {
2153  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
2154  " no more operands for othersubr\n" ));
2155  lastError = FT_THROW( Invalid_Glyph_Format );
2156  goto exit;
2157  }
2158 
2159  result_cnt--;
2160  cf2_stack_pushFixed( opStack, results[result_cnt] );
2161  }
2162  continue; /* do not clear the stack */
2163 
2164  case cf2_escDROP:
2165  FT_TRACE4(( " drop\n" ));
2166 
2167  (void)cf2_stack_popFixed( opStack );
2168  continue; /* do not clear the stack */
2169 
2170  case cf2_escPUT:
2171  {
2172  CF2_F16Dot16 val;
2173  CF2_Int idx;
2174 
2175 
2176  FT_TRACE4(( " put\n" ));
2177 
2178  idx = cf2_stack_popInt( opStack );
2179  val = cf2_stack_popFixed( opStack );
2180 
2181  if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
2182  storage[idx] = val;
2183  }
2184  continue; /* do not clear the stack */
2185 
2186  case cf2_escGET:
2187  {
2188  CF2_Int idx;
2189 
2190 
2191  FT_TRACE4(( " get\n" ));
2192 
2193  idx = cf2_stack_popInt( opStack );
2194 
2195  if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
2196  cf2_stack_pushFixed( opStack, storage[idx] );
2197  }
2198  continue; /* do not clear the stack */
2199 
2200  case cf2_escIFELSE:
2201  {
2204  CF2_F16Dot16 cond1;
2205  CF2_F16Dot16 cond2;
2206 
2207 
2208  FT_TRACE4(( " ifelse\n" ));
2209 
2210  cond2 = cf2_stack_popFixed( opStack );
2211  cond1 = cf2_stack_popFixed( opStack );
2212  arg2 = cf2_stack_popFixed( opStack );
2213  arg1 = cf2_stack_popFixed( opStack );
2214 
2215  cf2_stack_pushFixed( opStack,
2216  cond1 <= cond2 ? arg1 : arg2 );
2217  }
2218  continue; /* do not clear the stack */
2219 
2220  case cf2_escRANDOM: /* in spec */
2221  {
2222  CF2_F16Dot16 r;
2223 
2224 
2225  FT_TRACE4(( " random\n" ));
2226 
2227  /* only use the lower 16 bits of `random' */
2228  /* to generate a number in the range (0;1] */
2229  r = (CF2_F16Dot16)
2230  ( ( decoder->current_subfont->random & 0xFFFF ) + 1 );
2231 
2232  decoder->current_subfont->random =
2233  cff_random( decoder->current_subfont->random );
2234 
2235  cf2_stack_pushFixed( opStack, r );
2236  }
2237  continue; /* do not clear the stack */
2238 
2239  case cf2_escMUL:
2240  {
2241  CF2_F16Dot16 factor1;
2242  CF2_F16Dot16 factor2;
2243 
2244 
2245  FT_TRACE4(( " mul\n" ));
2246 
2247  factor2 = cf2_stack_popFixed( opStack );
2248  factor1 = cf2_stack_popFixed( opStack );
2249 
2250  cf2_stack_pushFixed( opStack,
2251  FT_MulFix( factor1, factor2 ) );
2252  }
2253  continue; /* do not clear the stack */
2254 
2255  case cf2_escSQRT:
2256  {
2257  CF2_F16Dot16 arg;
2258 
2259 
2260  FT_TRACE4(( " sqrt\n" ));
2261 
2262  arg = cf2_stack_popFixed( opStack );
2263  if ( arg > 0 )
2264  {
2265  /* use a start value that doesn't make */
2266  /* the algorithm's addition overflow */
2268  FT_Fixed new_root;
2269 
2270 
2271  /* Babylonian method */
2272  for (;;)
2273  {
2274  new_root = ( root + FT_DivFix( arg, root ) + 1 ) >> 1;
2275  if ( new_root == root )
2276  break;
2277  root = new_root;
2278  }
2279  arg = new_root;
2280  }
2281  else
2282  arg = 0;
2283 
2284  cf2_stack_pushFixed( opStack, arg );
2285  }
2286  continue; /* do not clear the stack */
2287 
2288  case cf2_escDUP:
2289  {
2290  CF2_F16Dot16 arg;
2291 
2292 
2293  FT_TRACE4(( " dup\n" ));
2294 
2295  arg = cf2_stack_popFixed( opStack );
2296 
2297  cf2_stack_pushFixed( opStack, arg );
2298  cf2_stack_pushFixed( opStack, arg );
2299  }
2300  continue; /* do not clear the stack */
2301 
2302  case cf2_escEXCH:
2303  {
2306 
2307 
2308  FT_TRACE4(( " exch\n" ));
2309 
2310  arg2 = cf2_stack_popFixed( opStack );
2311  arg1 = cf2_stack_popFixed( opStack );
2312 
2313  cf2_stack_pushFixed( opStack, arg2 );
2314  cf2_stack_pushFixed( opStack, arg1 );
2315  }
2316  continue; /* do not clear the stack */
2317 
2318  case cf2_escINDEX:
2319  {
2320  CF2_Int idx;
2321  CF2_UInt size;
2322 
2323 
2324  FT_TRACE4(( " index\n" ));
2325 
2326  idx = cf2_stack_popInt( opStack );
2327  size = cf2_stack_count( opStack );
2328 
2329  if ( size > 0 )
2330  {
2331  /* for `cf2_stack_getReal', */
2332  /* index 0 is bottom of stack */
2333  CF2_UInt gr_idx;
2334 
2335 
2336  if ( idx < 0 )
2337  gr_idx = size - 1;
2338  else if ( (CF2_UInt)idx >= size )
2339  gr_idx = 0;
2340  else
2341  gr_idx = size - 1 - (CF2_UInt)idx;
2342 
2343  cf2_stack_pushFixed( opStack,
2344  cf2_stack_getReal( opStack,
2345  gr_idx ) );
2346  }
2347  }
2348  continue; /* do not clear the stack */
2349 
2350  case cf2_escROLL:
2351  {
2352  CF2_Int idx;
2353  CF2_Int count;
2354 
2355 
2356  FT_TRACE4(( " roll\n" ));
2357 
2358  idx = cf2_stack_popInt( opStack );
2359  count = cf2_stack_popInt( opStack );
2360 
2361  cf2_stack_roll( opStack, count, idx );
2362  }
2363  continue; /* do not clear the stack */
2364 
2365  case cf2_escSETCURRENTPT:
2366  if ( !font->isT1 )
2367  FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
2368  else
2369  {
2370  FT_TRACE4(( " setcurrentpoint" ));
2371 
2372  if ( !initial_map_ready )
2373  break;
2374 
2375  /* From the T1 specification, section 6.4: */
2376  /* */
2377  /* The setcurrentpoint command is used only in */
2378  /* conjunction with results from OtherSubrs */
2379  /* procedures. */
2380 
2381  /* known_othersubr_result_cnt != 0 is already handled */
2382  /* above. */
2383 
2384  /* Note, however, that both Ghostscript and Adobe */
2385  /* Distiller handle this situation by silently */
2386  /* ignoring the inappropriate `setcurrentpoint' */
2387  /* instruction. So we do the same. */
2388 #if 0
2389 
2390  if ( decoder->flex_state != 1 )
2391  {
2392  FT_ERROR(( "cf2_interpT2CharString:"
2393  " unexpected `setcurrentpoint'\n" ));
2394  goto Syntax_Error;
2395  }
2396  else
2397  ...
2398 #endif
2399 
2400  curY = cf2_stack_popFixed( opStack );
2401  curX = cf2_stack_popFixed( opStack );
2402 
2403  decoder->flex_state = 0;
2404  }
2405  break;
2406 
2407  } /* end of 2nd switch checking op2 */
2408  }
2409  }
2410  } /* end of 1st switch checking op2 */
2411  } /* case cf2_cmdESC */
2412 
2413  break;
2414 
2415  case cf2_cmdHSBW:
2416  if ( !font->isT1 )
2417  FT_TRACE4(( " unknown op (%d)\n", op1 ));
2418  else
2419  {
2420  CF2_Fixed lsb_x;
2421  PS_Builder* builder;
2422 
2423 
2424  FT_TRACE4(( " hsbw" ));
2425 
2426  builder = &decoder->builder;
2427 
2428  builder->advance->x = cf2_stack_popFixed( opStack );
2429  builder->advance->y = 0;
2430 
2431  lsb_x = cf2_stack_popFixed( opStack );
2432 
2433  builder->left_bearing->x = ADD_INT32( builder->left_bearing->x,
2434  lsb_x );
2435 
2436  haveWidth = TRUE;
2437 
2438  /* the `metrics_only' indicates that we only want to compute */
2439  /* the glyph's metrics (lsb + advance width), not load the */
2440  /* rest of it; so exit immediately */
2441  if ( builder->metrics_only )
2442  goto exit;
2443 
2444  if ( initial_map_ready )
2445  curX = ADD_INT32( curX, lsb_x );
2446  }
2447  break;
2448 
2449  case cf2_cmdENDCHAR:
2450  FT_TRACE4(( " endchar\n" ));
2451 
2452  if ( font->isT1 && !initial_map_ready )
2453  {
2454  FT_TRACE5(( "cf2_interpT2CharString (Type 1 mode): "
2455  "Build initial hintmap, rewinding...\n" ));
2456 
2457  /* trigger initial hintmap build */
2458  cf2_glyphpath_moveTo( &glyphPath, curX, curY );
2459 
2460  initial_map_ready = TRUE;
2461 
2462  /* change hints routine - clear for rewind */
2463  cf2_arrstack_clear( &vStemHintArray );
2464  cf2_arrstack_clear( &hStemHintArray );
2465 
2466  cf2_hintmask_init( &hintMask, error );
2467  hintMask.isValid = FALSE;
2468  hintMask.isNew = TRUE;
2469 
2470  /* rewind charstring */
2471  /* some charstrings use endchar from a final subroutine call */
2472  /* without returning, detect these and exit to the top level */
2473  /* charstring */
2474  while ( charstringIndex > 0 )
2475  {
2476  FT_TRACE4(( " return (leaving level %d)\n", charstringIndex ));
2477 
2478  /* restore position in previous charstring */
2479  charstring = (CF2_Buffer)
2481  &subrStack,
2482  (CF2_UInt)--charstringIndex );
2483  }
2484  charstring->ptr = charstring->start;
2485 
2486  break;
2487  }
2488 
2489  if ( cf2_stack_count( opStack ) == 1 ||
2490  cf2_stack_count( opStack ) == 5 )
2491  {
2492  if ( !haveWidth )
2493  *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
2494  nominalWidthX );
2495  }
2496 
2497  /* width is defined or default after this */
2498  haveWidth = TRUE;
2499 
2500  if ( decoder->width_only )
2501  goto exit;
2502 
2503  /* close path if still open */
2504  cf2_glyphpath_closeOpenPath( &glyphPath );
2505 
2506  /* disable seac for CFF2 and Type1 */
2507  /* (charstring ending with args on stack) */
2508  if ( !font->isCFF2 && !font->isT1 && cf2_stack_count( opStack ) > 1 )
2509  {
2510  /* must be either 4 or 5 -- */
2511  /* this is a (deprecated) implied `seac' operator */
2512 
2513  CF2_Int achar;
2514  CF2_Int bchar;
2515  CF2_BufferRec component;
2516  CF2_Fixed dummyWidth; /* ignore component width */
2517  FT_Error error2;
2518 
2519 
2520  if ( doingSeac )
2521  {
2522  lastError = FT_THROW( Invalid_Glyph_Format );
2523  goto exit; /* nested seac */
2524  }
2525 
2526  achar = cf2_stack_popInt( opStack );
2527  bchar = cf2_stack_popInt( opStack );
2528 
2529  curY = cf2_stack_popFixed( opStack );
2530  curX = cf2_stack_popFixed( opStack );
2531 
2532  error2 = cf2_getSeacComponent( decoder, achar, &component );
2533  if ( error2 )
2534  {
2535  lastError = error2; /* pass FreeType error through */
2536  goto exit;
2537  }
2539  &component,
2540  callbacks,
2541  translation,
2542  TRUE,
2543  curX,
2544  curY,
2545  &dummyWidth );
2546  cf2_freeSeacComponent( decoder, &component );
2547 
2548  error2 = cf2_getSeacComponent( decoder, bchar, &component );
2549  if ( error2 )
2550  {
2551  lastError = error2; /* pass FreeType error through */
2552  goto exit;
2553  }
2555  &component,
2556  callbacks,
2557  translation,
2558  TRUE,
2559  0,
2560  0,
2561  &dummyWidth );
2562  cf2_freeSeacComponent( decoder, &component );
2563  }
2564  goto exit;
2565 
2566  case cf2_cmdCNTRMASK:
2567  case cf2_cmdHINTMASK:
2568  /* the final \n in the tracing message gets added in */
2569  /* `cf2_hintmask_read' (which also traces the mask bytes) */
2570  FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" ));
2571 
2572  /* never add hints after the mask is computed */
2573  if ( cf2_stack_count( opStack ) > 1 &&
2574  cf2_hintmask_isValid( &hintMask ) )
2575  {
2576  FT_TRACE4(( "cf2_interpT2CharString: invalid hint mask\n" ));
2577  break;
2578  }
2579 
2580  /* if there are arguments on the stack, there this is an */
2581  /* implied cf2_cmdVSTEMHM */
2582  cf2_doStems( font,
2583  opStack,
2584  &vStemHintArray,
2585  width,
2586  &haveWidth,
2587  0 );
2588 
2589  if ( decoder->width_only )
2590  goto exit;
2591 
2592  if ( op1 == cf2_cmdHINTMASK )
2593  {
2594  /* consume the hint mask bytes which follow the operator */
2595  cf2_hintmask_read( &hintMask,
2596  charstring,
2597  cf2_arrstack_size( &hStemHintArray ) +
2598  cf2_arrstack_size( &vStemHintArray ) );
2599  }
2600  else
2601  {
2602  /*
2603  * Consume the counter mask bytes which follow the operator:
2604  * Build a temporary hint map, just to place and lock those
2605  * stems participating in the counter mask. These are most
2606  * likely the dominant hstems, and are grouped together in a
2607  * few counter groups, not necessarily in correspondence
2608  * with the hint groups. This reduces the chances of
2609  * conflicts between hstems that are initially placed in
2610  * separate hint groups and then brought together. The
2611  * positions are copied back to `hStemHintArray', so we can
2612  * discard `counterMask' and `counterHintMap'.
2613  *
2614  */
2615 #ifdef __REACTOS__
2616  CF2_HintMapRec *counterHintMap = malloc(sizeof(CF2_HintMapRec));
2617  CF2_HintMaskRec counterMask;
2618  if (!counterHintMap)
2619  {
2620  lastError = FT_Err_Out_Of_Memory;
2621  goto exit;
2622  }
2623 /* Ugly but it allows us to reduce the diff */
2624 #define counterHintMap (*counterHintMap)
2625 #else
2626  CF2_HintMapRec counterHintMap;
2627  CF2_HintMaskRec counterMask;
2628 #endif
2629 
2630 
2631  cf2_hintmap_init( &counterHintMap,
2632  font,
2633  &glyphPath.initialHintMap,
2634  &glyphPath.hintMoves,
2635  scaleY );
2636  cf2_hintmask_init( &counterMask, error );
2637 
2638  cf2_hintmask_read( &counterMask,
2639  charstring,
2640  cf2_arrstack_size( &hStemHintArray ) +
2641  cf2_arrstack_size( &vStemHintArray ) );
2642  cf2_hintmap_build( &counterHintMap,
2643  &hStemHintArray,
2644  &vStemHintArray,
2645  &counterMask,
2646  0,
2647  FALSE );
2648 #ifdef __REACTOS__
2649  free(&counterHintMap);
2650 #endif
2651  }
2652  break;
2653 
2654  case cf2_cmdRMOVETO:
2655  FT_TRACE4(( " rmoveto\n" ));
2656 
2657  if ( font->isT1 && !decoder->flex_state && !haveWidth )
2658  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
2659  " No width. Use hsbw/sbw as first op\n" ));
2660 
2661  if ( cf2_stack_count( opStack ) > 2 && !haveWidth )
2662  *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
2663  nominalWidthX );
2664 
2665  /* width is defined or default after this */
2666  haveWidth = TRUE;
2667 
2668  if ( decoder->width_only )
2669  goto exit;
2670 
2671  curY = ADD_INT32( curY, cf2_stack_popFixed( opStack ) );
2672  curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
2673 
2674  if ( !decoder->flex_state )
2675  cf2_glyphpath_moveTo( &glyphPath, curX, curY );
2676 
2677  break;
2678 
2679  case cf2_cmdHMOVETO:
2680  FT_TRACE4(( " hmoveto\n" ));
2681 
2682  if ( font->isT1 && !decoder->flex_state && !haveWidth )
2683  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
2684  " No width. Use hsbw/sbw as first op\n" ));
2685 
2686  if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
2687  *width = ADD_INT32( cf2_stack_getReal( opStack, 0 ),
2688  nominalWidthX );
2689 
2690  /* width is defined or default after this */
2691  haveWidth = TRUE;
2692 
2693  if ( decoder->width_only )
2694  goto exit;
2695 
2696  curX = ADD_INT32( curX, cf2_stack_popFixed( opStack ) );
2697 
2698  cf2_glyphpath_moveTo( &glyphPath, curX, curY );
2699 
2700  break;
2701 
2702  case cf2_cmdRLINECURVE:
2703  {
2704  CF2_UInt count = cf2_stack_count( opStack );
2705  CF2_UInt idx = 0;
2706 
2707 
2708  FT_TRACE4(( " rlinecurve\n" ));
2709 
2710  while ( idx + 6 < count )
2711  {
2712  curX = ADD_INT32( curX, cf2_stack_getReal( opStack,
2713  idx + 0 ) );
2714  curY = ADD_INT32( curY, cf2_stack_getReal( opStack,
2715  idx + 1 ) );
2716 
2717  cf2_glyphpath_lineTo( &glyphPath, curX, curY );
2718  idx += 2;
2719  }
2720 
2721  while ( idx < count )
2722  {
2723  CF2_Fixed x1, y1, x2, y2, x3, y3;
2724 
2725 
2726  x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
2727  y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), curY );
2728  x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), x1 );
2729  y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y1 );
2730  x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
2731  y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 5 ), y2 );
2732 
2733  cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
2734 
2735  curX = x3;
2736  curY = y3;
2737  idx += 6;
2738  }
2739 
2740  cf2_stack_clear( opStack );
2741  }
2742  continue; /* no need to clear stack again */
2743 
2744  case cf2_cmdVVCURVETO:
2745  {
2746  CF2_UInt count, count1 = cf2_stack_count( opStack );
2747  CF2_UInt idx = 0;
2748 
2749 
2750  /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
2751  /* we enforce it by clearing the second bit */
2752  /* (and sorting the stack indexing to suit) */
2753  count = count1 & ~2U;
2754  idx += count1 - count;
2755 
2756  FT_TRACE4(( " vvcurveto\n" ));
2757 
2758  while ( idx < count )
2759  {
2760  CF2_Fixed x1, y1, x2, y2, x3, y3;
2761 
2762 
2763  if ( ( count - idx ) & 1 )
2764  {
2765  x1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curX );
2766 
2767  idx++;
2768  }
2769  else
2770  x1 = curX;
2771 
2772  y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY );
2773  x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
2774  y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
2775  x3 = x2;
2776  y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 );
2777 
2778  cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
2779 
2780  curX = x3;
2781  curY = y3;
2782  idx += 4;
2783  }
2784 
2785  cf2_stack_clear( opStack );
2786  }
2787  continue; /* no need to clear stack again */
2788 
2789  case cf2_cmdHHCURVETO:
2790  {
2791  CF2_UInt count, count1 = cf2_stack_count( opStack );
2792  CF2_UInt idx = 0;
2793 
2794 
2795  /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
2796  /* we enforce it by clearing the second bit */
2797  /* (and sorting the stack indexing to suit) */
2798  count = count1 & ~2U;
2799  idx += count1 - count;
2800 
2801  FT_TRACE4(( " hhcurveto\n" ));
2802 
2803  while ( idx < count )
2804  {
2805  CF2_Fixed x1, y1, x2, y2, x3, y3;
2806 
2807 
2808  if ( ( count - idx ) & 1 )
2809  {
2810  y1 = ADD_INT32( cf2_stack_getReal( opStack, idx ), curY );
2811 
2812  idx++;
2813  }
2814  else
2815  y1 = curY;
2816 
2817  x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
2818  x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
2819  y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
2820  x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 );
2821  y3 = y2;
2822 
2823  cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
2824 
2825  curX = x3;
2826  curY = y3;
2827  idx += 4;
2828  }
2829 
2830  cf2_stack_clear( opStack );
2831  }
2832  continue; /* no need to clear stack again */
2833 
2834  case cf2_cmdVHCURVETO:
2835  case cf2_cmdHVCURVETO:
2836  {
2837  CF2_UInt count, count1 = cf2_stack_count( opStack );
2838  CF2_UInt idx = 0;
2839 
2840  FT_Bool alternate = FT_BOOL( op1 == cf2_cmdHVCURVETO );
2841 
2842 
2843  /* if `cf2_stack_count' isn't of the form 8n, 8n+1, */
2844  /* 8n+4, or 8n+5, we enforce it by clearing the */
2845  /* second bit */
2846  /* (and sorting the stack indexing to suit) */
2847  count = count1 & ~2U;
2848  idx += count1 - count;
2849 
2850  FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" ));
2851 
2852  while ( idx < count )
2853  {
2854  CF2_Fixed x1, x2, x3, y1, y2, y3;
2855 
2856 
2857  if ( alternate )
2858  {
2859  x1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curX );
2860  y1 = curY;
2861  x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
2862  y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
2863  y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), y2 );
2864 
2865  if ( count - idx == 5 )
2866  {
2867  x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), x2 );
2868 
2869  idx++;
2870  }
2871  else
2872  x3 = x2;
2873 
2874  alternate = FALSE;
2875  }
2876  else
2877  {
2878  x1 = curX;
2879  y1 = ADD_INT32( cf2_stack_getReal( opStack, idx + 0 ), curY );
2880  x2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 1 ), x1 );
2881  y2 = ADD_INT32( cf2_stack_getReal( opStack, idx + 2 ), y1 );
2882  x3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 3 ), x2 );
2883 
2884  if ( count - idx == 5 )
2885  {
2886  y3 = ADD_INT32( cf2_stack_getReal( opStack, idx + 4 ), y2 );
2887 
2888  idx++;
2889  }
2890  else
2891  y3 = y2;
2892 
2893  alternate = TRUE;
2894  }
2895 
2896  cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
2897 
2898  curX = x3;
2899  curY = y3;
2900  idx += 4;
2901  }
2902 
2903  cf2_stack_clear( opStack );
2904  }
2905  continue; /* no need to clear stack again */
2906 
2907  case cf2_cmdEXTENDEDNMBR:
2908  {
2909  CF2_Int v;
2910 
2911  CF2_Int byte1 = cf2_buf_readByte( charstring );
2912  CF2_Int byte2 = cf2_buf_readByte( charstring );
2913 
2914 
2915  v = (FT_Short)( ( byte1 << 8 ) |
2916  byte2 );
2917 
2918  FT_TRACE4(( " %d", v ));
2919 
2920  cf2_stack_pushInt( opStack, v );
2921  }
2922  continue;
2923 
2924  default:
2925  /* numbers */
2926  {
2927  if ( /* op1 >= 32 && */ op1 <= 246 )
2928  {
2929  CF2_Int v;
2930 
2931 
2932  v = op1 - 139;
2933 
2934  FT_TRACE4(( " %d", v ));
2935 
2936  /* -107 .. 107 */
2937  cf2_stack_pushInt( opStack, v );
2938  }
2939 
2940  else if ( /* op1 >= 247 && */ op1 <= 250 )
2941  {
2942  CF2_Int v;
2943 
2944 
2945  v = op1;
2946  v -= 247;
2947  v *= 256;
2948  v += cf2_buf_readByte( charstring );
2949  v += 108;
2950 
2951  FT_TRACE4(( " %d", v ));
2952 
2953  /* 108 .. 1131 */
2954  cf2_stack_pushInt( opStack, v );
2955  }
2956 
2957  else if ( /* op1 >= 251 && */ op1 <= 254 )
2958  {
2959  CF2_Int v;
2960 
2961 
2962  v = op1;
2963  v -= 251;
2964  v *= 256;
2965  v += cf2_buf_readByte( charstring );
2966  v = -v - 108;
2967 
2968  FT_TRACE4(( " %d", v ));
2969 
2970  /* -1131 .. -108 */
2971  cf2_stack_pushInt( opStack, v );
2972  }
2973 
2974  else /* op1 == 255 */
2975  {
2976  CF2_Fixed v;
2977 
2978  FT_UInt32 byte1 = (FT_UInt32)cf2_buf_readByte( charstring );
2979  FT_UInt32 byte2 = (FT_UInt32)cf2_buf_readByte( charstring );
2980  FT_UInt32 byte3 = (FT_UInt32)cf2_buf_readByte( charstring );
2981  FT_UInt32 byte4 = (FT_UInt32)cf2_buf_readByte( charstring );
2982 
2983 
2984  v = (CF2_Fixed)( ( byte1 << 24 ) |
2985  ( byte2 << 16 ) |
2986  ( byte3 << 8 ) |
2987  byte4 );
2988 
2989  /*
2990  * For Type 1:
2991  *
2992  * According to the specification, values > 32000 or < -32000
2993  * must be followed by a `div' operator to make the result be
2994  * in the range [-32000;32000]. We expect that the second
2995  * argument of `div' is not a large number. Additionally, we
2996  * don't handle stuff like `<large1> <large2> <num> div <num>
2997  * div' or <large1> <large2> <num> div div'. This is probably
2998  * not allowed anyway.
2999  *
3000  * <large> <num> <num>+ div is not checked but should not be
3001  * allowed as the large value remains untouched.
3002  *
3003  */
3004  if ( font->isT1 )
3005  {
3006  if ( v > 32000 || v < -32000 )
3007  {
3008  if ( large_int )
3009  FT_ERROR(( "cf2_interpT2CharString (Type 1 mode):"
3010  " no `div' after large integer\n" ));
3011  else
3012  large_int = TRUE;
3013  }
3014 
3015  FT_TRACE4(( " %d", v ));
3016 
3017  cf2_stack_pushInt( opStack, (CF2_Int)v );
3018  }
3019  else
3020  {
3021  FT_TRACE4(( " %.5fF", v / 65536.0 ));
3022 
3023  cf2_stack_pushFixed( opStack, v );
3024  }
3025  }
3026  }
3027  continue; /* don't clear stack */
3028 
3029  } /* end of switch statement checking `op1' */
3030 
3031  cf2_stack_clear( opStack );
3032 
3033  } /* end of main interpreter loop */
3034 
3035  /* we get here if the charstring ends without cf2_cmdENDCHAR */
3036  FT_TRACE4(( "cf2_interpT2CharString:"
3037  " charstring ends without ENDCHAR\n" ));
3038 
3039  exit:
3040  /* check whether last error seen is also the first one */
3041  cf2_setError( error, lastError );
3042 
3043  if ( *error )
3044  FT_TRACE4(( "charstring error %d\n", *error ));
3045 
3046  /* free resources from objects we've used */
3047  cf2_glyphpath_finalize( &glyphPath );
3048  cf2_arrstack_finalize( &vStemHintArray );
3049  cf2_arrstack_finalize( &hStemHintArray );
3050  cf2_arrstack_finalize( &subrStack );
3051  cf2_stack_free( opStack );
3052 
3053  FT_TRACE4(( "\n" ));
3054 
3055 #ifdef __REACTOS__
3056  free(&glyphPath);
3057 #undef counterHintMap
3058 #undef glyphPath
3059 #endif
3060 
3061  return;
3062  }
3063 
3064 
3065 /* END */
cannot open resource broken file module version is too low unimplemented feature broken offset within table missing module invalid glyph index unsupported glyph image format invalid outline too many hints invalid object handle invalid module handle invalid size handle invalid charmap handle invalid stream handle too many extensions unlisted object invalid stream seek invalid stream read invalid frame operation invalid frame read raster corrupted negative height while rastering invalid opcode stack overflow bad argument invalid reference found ENDF opcode in execution stream invalid code range too many function definitions SFNT font table missing name table missing horizontal PostScript(post) table missing" ) FT_ERRORDEF_( Invalid_Horiz_Metrics
FT_Long * buildchar
Definition: psaux.h:652
cf2_stack_getReal(CF2_Stack stack, CF2_UInt idx)
Definition: psstack.c:187
#define CF2_UInt
Definition: pstypes.h:64
cf2_glyphpath_init(CF2_GlyphPath glyphpath, CF2_Font font, CF2_OutlineCallbacks callbacks, CF2_Fixed scaleY, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOriginY, const CF2_Blues blues, const FT_Vector *fractionalTranslation)
Definition: pshints.c:1083
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
FT_BEGIN_HEADER struct CF2_BufferRec_ * CF2_Buffer
#define FIXED_TO_INT(x)
Definition: ftcalc.h:406
FT_UInt lenBV
Definition: cfftypes.h:174
cf2_stack_pushFixed(CF2_Stack stack, CF2_Fixed val)
Definition: psstack.c:123
FT_UInt num_designs
Definition: t1tables.h:300
int FT_Error
Definition: fttypes.h:300
cf2_buf_readByte(CF2_Buffer buf)
Definition: psread.c:80
cf2_getNominalWidthX(PS_Decoder *decoder)
Definition: psft.c:853
cf2_stack_popFixed(CF2_Stack stack)
Definition: psstack.c:162
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:608
GLint GLint GLsizei width
Definition: gl.h:1546
cf2_glyphpath_lineTo(CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
Definition: pshints.c:1711
cf2_arrstack_setCount(CF2_ArrStack arrstack, size_t numElements)
Definition: psarrst.c:140
FT_Int32 CF2_F16Dot16
Definition: pstypes.h:69
FT_Pos y
Definition: ftimage.h:77
#define TRUE
Definition: types.h:120
cf2_stack_free(CF2_Stack stack)
Definition: psstack.c:84
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:196
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
cf2_initGlobalRegionBuffer(PS_Decoder *decoder, CF2_Int subrNum, CF2_Buffer buf)
Definition: psft.c:632
#define error(str)
Definition: mkdosfs.c:1605
cf2_hintmask_setNew(CF2_HintMask hintmask, FT_Bool val)
Definition: psintrp.c:90
FT_Fixed * weight_vector
Definition: t1tables.h:307
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
FT_GlyphLoader loader
Definition: psaux.h:537
#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES
Definition: freetype.h:3923
#define FT_SUBGLYPH_FLAG_USE_MY_METRICS
Definition: freetype.h:3928
cf2_arrstack_init(CF2_ArrStack arrstack, FT_Memory memory, FT_Error *error, size_t sizeItem)
Definition: psarrst.c:56
cf2_buf_isEnd(CF2_Buffer buf)
Definition: psread.c:106
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: mk_font.cpp:20
FT_Pos x
Definition: ftimage.h:76
cf2_stack_roll(CF2_Stack stack, CF2_Int count, CF2_Int shift)
Definition: psstack.c:242
#define SUB_INT32(a, b)
Definition: ftcalc.h:431
signed int FT_Int
Definition: fttypes.h:220
FT_Bool isValid
Definition: pshints.h:74
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
t1_lookup_glyph_by_stdcharcode_ps(PS_Decoder *decoder, FT_Int charcode)
Definition: t1decode.c:131
static GLenum which
Definition: wgl_font.c:159
#define ADD_INT32(a, b)
Definition: ftcalc.h:429
FT_Int flex_state
Definition: psaux.h:609
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FT_ABS(a)
Definition: ftobjs.h:74
CF2_Fixed maxDS
Definition: pshints.h:93
#define free
Definition: debug_ros.c:5
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
#define U(x)
Definition: wordpad.c:44
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
GLfloat v0
Definition: glext.h:6061
CFF_SubFont current_subfont
Definition: psaux.h:614
cf2_hintmask_getMaskPtr(CF2_HintMask hintmask)
Definition: psintrp.c:101
cf2_getT1SeacComponent(PS_Decoder *decoder, FT_UInt glyph_index, CF2_Buffer buf)
Definition: psft.c:721
CF2_Fixed min
Definition: pshints.h:89
cf2_setError(FT_Error *error, FT_Error value)
Definition: pserror.c:44
cf2_hintmask_isValid(const CF2_HintMask hintmask)
Definition: psintrp.c:76
cf2_hintmask_setAll(CF2_HintMask hintmask, size_t bitCount)
Definition: psintrp.c:173
size_t * ft_hash_num_lookup(FT_Int num, FT_Hash hash)
Definition: fthash.c:327
void * arg
Definition: msvc.h:10
cf2_hintmap_init(CF2_HintMap hintmap, CF2_Font font, CF2_HintMap initialMap, CF2_ArrStack hintMoves, CF2_Fixed scale)
Definition: pshints.c:277
ps_builder_check_points(PS_Builder *builder, FT_Int count)
Definition: psobjs.c:2145
cf2_glyphpath_curveTo(CF2_GlyphPath glyphpath, CF2_Fixed x1, CF2_Fixed y1, CF2_Fixed x2, CF2_Fixed y2, CF2_Fixed x3, CF2_Fixed y3)
Definition: pshints.c:1817
static void cf2_doStems(const CF2_Font font, CF2_Stack opStack, CF2_ArrStack stemHintArray, CF2_Fixed *width, FT_Bool *haveWidth, CF2_Fixed hintOffset)
Definition: psintrp.c:281
FT_BEGIN_HEADER struct CF2_ArrStackRec_ CF2_ArrStackRec
return FT_Err_Ok
Definition: ftbbox.c:511
FT_Byte ** glyph_names
Definition: psaux.h:630
CF2_ArrStackRec hintMoves
Definition: pshints.h:193
static char memory[1024 *256]
Definition: process.c:116
FT_BEGIN_HEADER struct CF2_BufferRec_ CF2_BufferRec
#define CF2_OPERAND_STACK_SIZE
Definition: psfont.h:52
cf2_stack_pop(CF2_Stack stack, CF2_UInt num)
Definition: psstack.c:229
FT_Byte mask[(CF2_MAX_HINTS+7)/8]
Definition: pshints.h:80
GLuint GLuint GLfloat weight
Definition: glext.h:11719
cf2_getMaxstack(PS_Decoder *decoder)
Definition: psft.c:468
cff_random(FT_UInt32 r)
Definition: psobjs.c:2522
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
cf2_freeT1SeacComponent(PS_Decoder *decoder, CF2_Buffer buf)
Definition: psft.c:767
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
cf2_arrstack_getPointer(const CF2_ArrStack arrstack, size_t idx)
Definition: psarrst.c:187
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
CF2_Fixed max
Definition: pshints.h:90
FT_Bool no_recurse
Definition: psaux.h:550
cf2_freeSeacComponent(PS_Decoder *decoder, CF2_Buffer buf)
Definition: psft.c:708
unsigned char FT_Byte
Definition: fttypes.h:154
FT_GlyphLoader loader
Definition: ftobjs.h:467
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
cf2_glyphpath_finalize(CF2_GlyphPath glyphpath)
Definition: pshints.c:1154
GLuint base
Definition: 3dtext.c:35
ps_builder_close_contour(PS_Builder *builder)
Definition: psobjs.c:2278
cf2_interpT2CharString(CF2_Font font, CF2_Buffer buf, CF2_OutlineCallbacks callbacks, const FT_Vector *translation, FT_Bool doingSeac, CF2_Fixed curX, CF2_Fixed curY, CF2_Fixed *width)
Definition: psintrp.c:471
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
unsigned int idx
Definition: utils.c:41
#define T1_MAX_SUBRS_CALLS
Definition: ftoption.h:715
FT_Int32 * BV
Definition: cfftypes.h:175
PS_Blend blend
Definition: psaux.h:650
CF2_HintMapRec initialHintMap
Definition: pshints.h:191
smooth NULL
Definition: ftsmooth.c:416
cf2_stack_count(CF2_Stack stack)
Definition: psstack.c:100
FT_Error * error
Definition: pshints.h:72
FT_Int globals_bias
Definition: psaux.h:625
PS_Builder builder
Definition: psaux.h:601
#define FT_LOCAL_DEF(x)
Definition: ftconfig.h:388
FT_Vector * left_bearing
Definition: psaux.h:544
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
cf2_stack_clear(CF2_Stack stack)
Definition: psstack.c:322
#define error2(s, a, b)
Definition: debug.h:110
FT_UInt32 random
Definition: cfftypes.h:325
GLuint GLfloat * val
Definition: glext.h:7180
FT_GlyphLoader_CheckSubGlyphs(FT_GlyphLoader loader, FT_UInt n_subs)
Definition: ftgloadr.c:281
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
Definition: _stack.h:47
FT_Bool width_only
Definition: psaux.h:618
cf2_stack_popInt(CF2_Stack stack)
Definition: psstack.c:140
cf2_getDefaultWidthX(PS_Decoder *decoder)
Definition: psft.c:843
cf2_arrstack_push(CF2_ArrStack arrstack, const void *ptr)
Definition: psarrst.c:212
GLsizeiptr size
Definition: glext.h:5919
cf2_glyphpath_closeOpenPath(CF2_GlyphPath glyphpath)
Definition: pshints.c:1907
#define FT_ZERO(p)
Definition: ftmemory.h:237
FT_Int num_flex_vectors
Definition: psaux.h:610
FT_Hash locals_hash
Definition: psaux.h:645
GLint left
Definition: glext.h:7726
cf2_arrstack_getBuffer(const CF2_ArrStack arrstack)
Definition: psarrst.c:177
cf2_arrstack_finalize(CF2_ArrStack arrstack)
Definition: psarrst.c:76
cf2_glyphpath_moveTo(CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y)
Definition: pshints.c:1681
struct _test_info results[8]
Definition: SetCursorPos.c:29
FT_UInt num_subglyphs
Definition: freetype.h:1929
FT_BEGIN_HEADER struct CF2_ArrStackRec_ * CF2_ArrStack
cf2_hintmask_isNew(const CF2_HintMask hintmask)
Definition: psintrp.c:83
signed short FT_Short
Definition: fttypes.h:198
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
int jpeg_marker_parser_method routine
Definition: jpeglib.h:1089
#define FT_BOOL(x)
Definition: fttypes.h:578
CFF_GlyphSlot glyph
Definition: psaux.h:536
FT_Vector * advance
Definition: psaux.h:545
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
cf2_arrstack_clear(CF2_ArrStack arrstack)
Definition: psarrst.c:158
#define PS_STORAGE_SIZE
size_t bitCount
Definition: pshints.h:77
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
GLuint divisor
Definition: glext.h:6313
FT_Bool metrics_only
Definition: psaux.h:552
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
FT_Glyph_Format format
Definition: freetype.h:1921
static unsigned arg_cnt(const DISPPARAMS *dp)
Definition: vbscript.h:162
signed long FT_Fixed
Definition: fttypes.h:288
const GLdouble * v
Definition: gl.h:2040
cf2_hintmap_build(CF2_HintMap hintmap, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, FT_Bool initialMap)
Definition: pshints.c:808
static size_t cf2_hintmask_setCounts(CF2_HintMask hintmask, size_t bitCount)
Definition: psintrp.c:108
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int FT_UInt
Definition: fttypes.h:231
CF2_Fixed minDS
Definition: pshints.h:92
struct FT_GlyphSlotRec_ * FT_GlyphSlot
Definition: freetype.h:554
#define CF2_STORAGE_SIZE
Definition: psfont.h:59
FT_Bool isNew
Definition: pshints.h:75
FT_UInt len_buildchar
Definition: psaux.h:653
#define FT_TRACE5(varformat)
Definition: ftdebug.h:162
static void cf2_doBlend(const CFF_Blend blend, CF2_Stack opStack, CF2_UInt numBlends)
Definition: psintrp.c:418
#define CF2_Int
Definition: pstypes.h:65
size_t byteCount
Definition: pshints.h:78
cf2_arrstack_size(const CF2_ArrStack arrstack)
Definition: psarrst.c:168
#define CF2_FIXED_MAX
Definition: psfixed.h:52
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
static void cf2_doFlex(CF2_Stack opStack, CF2_Fixed *curX, CF2_Fixed *curY, CF2_GlyphPath glyphPath, const FT_Bool *readFromStack, FT_Bool doConditionalLastRead)
Definition: psintrp.c:335
FT_GlyphLoader_Prepare(FT_GlyphLoader loader)
Definition: ftgloadr.c:312
cf2_stack_pushInt(CF2_Stack stack, CF2_Int val)
Definition: psstack.c:107
FT_Slot_Internal internal
Definition: freetype.h:1940
#define const
Definition: zconf.h:230
cf2_getSeacComponent(PS_Decoder *decoder, CF2_Int code, CF2_Buffer buf)
Definition: psft.c:660
static void cf2_hintmask_read(CF2_HintMask hintmask, CF2_Buffer charstring, size_t bitCount)
Definition: psintrp.c:131
#define malloc
Definition: debug_ros.c:4
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define CF2_MAX_SUBR
Definition: psfont.h:53
FT_Bool used
Definition: pshints.h:87
void exit(int exitcode)
Definition: _exit.c:33
cf2_stack_setReal(CF2_Stack stack, CF2_UInt idx, CF2_Fixed val)
Definition: psstack.c:212
FT_Face face
Definition: psaux.h:535
cf2_initLocalRegionBuffer(PS_Decoder *decoder, CF2_Int subrNum, CF2_Buffer buf)
Definition: psft.c:791
static int callbacks
Definition: xmllint.c:873
#define ft_memcpy
Definition: ftstdlib.h:82
#define cf2_fixedAbs(x)
Definition: psfixed.h:68
FT_SubGlyph subglyphs
Definition: freetype.h:1930
GLfloat GLfloat v1
Definition: glext.h:6062
#define UL
Definition: tui.h:83
cf2_stack_init(FT_Memory memory, FT_Error *e, FT_UInt stackSize)
Definition: psstack.c:53
cf2_hintmask_init(CF2_HintMask hintmask, FT_Error *error)
Definition: psintrp.c:66
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define CF2_SET_ERROR(error, e)
Definition: pserror.h:109
#define CF2_Fixed
Definition: psfixed.h:48
FT_Int locals_bias
Definition: psaux.h:624