Visualization Library 2.0.0-b5

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
ttobjs.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* ttobjs.c */
4 /* */
5 /* Objects manager (body). */
6 /* */
7 /* Copyright 1996-2013 */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17 
18 
19 #include <ft2build.h>
20 #include FT_INTERNAL_DEBUG_H
21 #include FT_INTERNAL_STREAM_H
22 #include FT_TRUETYPE_TAGS_H
23 #include FT_INTERNAL_SFNT_H
24 
25 #include "ttgload.h"
26 #include "ttpload.h"
27 
28 #include "tterrors.h"
29 
30 #ifdef TT_USE_BYTECODE_INTERPRETER
31 #include "ttinterp.h"
32 #endif
33 
34 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
35 #include FT_TRUETYPE_UNPATENTED_H
36 #endif
37 
38 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
39 #include "ttgxvar.h"
40 #endif
41 
42  /*************************************************************************/
43  /* */
44  /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
45  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
46  /* messages during execution. */
47  /* */
48 #undef FT_COMPONENT
49 #define FT_COMPONENT trace_ttobjs
50 
51 
52 #ifdef TT_USE_BYTECODE_INTERPRETER
53 
54  /*************************************************************************/
55  /* */
56  /* GLYPH ZONE FUNCTIONS */
57  /* */
58  /*************************************************************************/
59 
60 
61  /*************************************************************************/
62  /* */
63  /* <Function> */
64  /* tt_glyphzone_done */
65  /* */
66  /* <Description> */
67  /* Deallocate a glyph zone. */
68  /* */
69  /* <Input> */
70  /* zone :: A pointer to the target glyph zone. */
71  /* */
72  FT_LOCAL_DEF( void )
73  tt_glyphzone_done( TT_GlyphZone zone )
74  {
75  FT_Memory memory = zone->memory;
76 
77 
78  if ( memory )
79  {
80  FT_FREE( zone->contours );
81  FT_FREE( zone->tags );
82  FT_FREE( zone->cur );
83  FT_FREE( zone->org );
84  FT_FREE( zone->orus );
85 
86  zone->max_points = zone->n_points = 0;
87  zone->max_contours = zone->n_contours = 0;
88  zone->memory = NULL;
89  }
90  }
91 
92 
93  /*************************************************************************/
94  /* */
95  /* <Function> */
96  /* tt_glyphzone_new */
97  /* */
98  /* <Description> */
99  /* Allocate a new glyph zone. */
100  /* */
101  /* <Input> */
102  /* memory :: A handle to the current memory object. */
103  /* */
104  /* maxPoints :: The capacity of glyph zone in points. */
105  /* */
106  /* maxContours :: The capacity of glyph zone in contours. */
107  /* */
108  /* <Output> */
109  /* zone :: A pointer to the target glyph zone record. */
110  /* */
111  /* <Return> */
112  /* FreeType error code. 0 means success. */
113  /* */
115  tt_glyphzone_new( FT_Memory memory,
116  FT_UShort maxPoints,
117  FT_Short maxContours,
118  TT_GlyphZone zone )
119  {
120  FT_Error error;
121 
122 
123  FT_MEM_ZERO( zone, sizeof ( *zone ) );
124  zone->memory = memory;
125 
126  if ( FT_NEW_ARRAY( zone->org, maxPoints ) ||
127  FT_NEW_ARRAY( zone->cur, maxPoints ) ||
128  FT_NEW_ARRAY( zone->orus, maxPoints ) ||
129  FT_NEW_ARRAY( zone->tags, maxPoints ) ||
130  FT_NEW_ARRAY( zone->contours, maxContours ) )
131  {
132  tt_glyphzone_done( zone );
133  }
134  else
135  {
136  zone->max_points = maxPoints;
137  zone->max_contours = maxContours;
138  }
139 
140  return error;
141  }
142 #endif /* TT_USE_BYTECODE_INTERPRETER */
143 
144 
145  /* Compare the face with a list of well-known `tricky' fonts. */
146  /* This list shall be expanded as we find more of them. */
147 
148  static FT_Bool
149  tt_check_trickyness_family( FT_String* name )
150  {
151 
152 #define TRICK_NAMES_MAX_CHARACTERS 16
153 #define TRICK_NAMES_COUNT 8
154 
155  static const char trick_names[TRICK_NAMES_COUNT]
157  {
158  "DFKaiSho-SB", /* dfkaisb.ttf */
159  "DFKaiShu",
160  "DFKai-SB", /* kaiu.ttf */
161  "HuaTianKaiTi?", /* htkt2.ttf */
162  "HuaTianSongTi?", /* htst3.ttf */
163  "MingLiU", /* mingliu.ttf & mingliu.ttc */
164  "PMingLiU", /* mingliu.ttc */
165  "MingLi43", /* mingli.ttf */
166  };
167 
168  int nn;
169 
170 
171  for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ )
172  if ( ft_strstr( name, trick_names[nn] ) )
173  return TRUE;
174 
175  return FALSE;
176  }
177 
178 
179  /* XXX: This function should be in the `sfnt' module. */
180 
181  /* Some PDF generators clear the checksums in the TrueType header table. */
182  /* For example, Quartz ContextPDF clears all entries, or Bullzip PDF */
183  /* Printer clears the entries for subsetted subtables. We thus have to */
184  /* recalculate the checksums where necessary. */
185 
186  static FT_UInt32
187  tt_synth_sfnt_checksum( FT_Stream stream,
188  FT_ULong length )
189  {
190  FT_Error error;
191  FT_UInt32 checksum = 0;
192  int i;
193 
194 
195  if ( FT_FRAME_ENTER( length ) )
196  return 0;
197 
198  for ( ; length > 3; length -= 4 )
199  checksum += (FT_UInt32)FT_GET_ULONG();
200 
201  for ( i = 3; length > 0; length --, i-- )
202  checksum += (FT_UInt32)( FT_GET_BYTE() << ( i * 8 ) );
203 
204  FT_FRAME_EXIT();
205 
206  return checksum;
207  }
208 
209 
210  /* XXX: This function should be in the `sfnt' module. */
211 
212  static FT_ULong
213  tt_get_sfnt_checksum( TT_Face face,
214  FT_UShort i )
215  {
216 #if 0 /* if we believe the written value, use following part. */
217  if ( face->dir_tables[i].CheckSum )
218  return face->dir_tables[i].CheckSum;
219 #endif
220 
221  if ( !face->goto_table )
222  return 0;
223 
224  if ( face->goto_table( face,
225  face->dir_tables[i].Tag,
226  face->root.stream,
227  NULL ) )
228  return 0;
229 
230  return (FT_ULong)tt_synth_sfnt_checksum( face->root.stream,
231  face->dir_tables[i].Length );
232  }
233 
234 
235  typedef struct tt_sfnt_id_rec_
236  {
237  FT_ULong CheckSum;
238  FT_ULong Length;
239 
240  } tt_sfnt_id_rec;
241 
242 
243  static FT_Bool
244  tt_check_trickyness_sfnt_ids( TT_Face face )
245  {
246 #define TRICK_SFNT_IDS_PER_FACE 3
247 #define TRICK_SFNT_IDS_NUM_FACES 17
248 
249  static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES]
251 
252 #define TRICK_SFNT_ID_cvt 0
253 #define TRICK_SFNT_ID_fpgm 1
254 #define TRICK_SFNT_ID_prep 2
255 
256  { /* MingLiU 1995 */
257  { 0x05bcf058, 0x000002e4 }, /* cvt */
258  { 0x28233bf1, 0x000087c4 }, /* fpgm */
259  { 0xa344a1ea, 0x000001e1 } /* prep */
260  },
261  { /* MingLiU 1996- */
262  { 0x05bcf058, 0x000002e4 }, /* cvt */
263  { 0x28233bf1, 0x000087c4 }, /* fpgm */
264  { 0xa344a1eb, 0x000001e1 } /* prep */
265  },
266  { /* DFKaiShu */
267  { 0x11e5ead4, 0x00000350 }, /* cvt */
268  { 0x5a30ca3b, 0x00009063 }, /* fpgm */
269  { 0x13a42602, 0x0000007e } /* prep */
270  },
271  { /* HuaTianKaiTi */
272  { 0xfffbfffc, 0x00000008 }, /* cvt */
273  { 0x9c9e48b8, 0x0000bea2 }, /* fpgm */
274  { 0x70020112, 0x00000008 } /* prep */
275  },
276  { /* HuaTianSongTi */
277  { 0xfffbfffc, 0x00000008 }, /* cvt */
278  { 0x0a5a0483, 0x00017c39 }, /* fpgm */
279  { 0x70020112, 0x00000008 } /* prep */
280  },
281  { /* NEC fadpop7.ttf */
282  { 0x00000000, 0x00000000 }, /* cvt */
283  { 0x40c92555, 0x000000e5 }, /* fpgm */
284  { 0xa39b58e3, 0x0000117c } /* prep */
285  },
286  { /* NEC fadrei5.ttf */
287  { 0x00000000, 0x00000000 }, /* cvt */
288  { 0x33c41652, 0x000000e5 }, /* fpgm */
289  { 0x26d6c52a, 0x00000f6a } /* prep */
290  },
291  { /* NEC fangot7.ttf */
292  { 0x00000000, 0x00000000 }, /* cvt */
293  { 0x6db1651d, 0x0000019d }, /* fpgm */
294  { 0x6c6e4b03, 0x00002492 } /* prep */
295  },
296  { /* NEC fangyo5.ttf */
297  { 0x00000000, 0x00000000 }, /* cvt */
298  { 0x40c92555, 0x000000e5 }, /* fpgm */
299  { 0xde51fad0, 0x0000117c } /* prep */
300  },
301  { /* NEC fankyo5.ttf */
302  { 0x00000000, 0x00000000 }, /* cvt */
303  { 0x85e47664, 0x000000e5 }, /* fpgm */
304  { 0xa6c62831, 0x00001caa } /* prep */
305  },
306  { /* NEC fanrgo5.ttf */
307  { 0x00000000, 0x00000000 }, /* cvt */
308  { 0x2d891cfd, 0x0000019d }, /* fpgm */
309  { 0xa0604633, 0x00001de8 } /* prep */
310  },
311  { /* NEC fangot5.ttc */
312  { 0x00000000, 0x00000000 }, /* cvt */
313  { 0x40aa774c, 0x000001cb }, /* fpgm */
314  { 0x9b5caa96, 0x00001f9a } /* prep */
315  },
316  { /* NEC fanmin3.ttc */
317  { 0x00000000, 0x00000000 }, /* cvt */
318  { 0x0d3de9cb, 0x00000141 }, /* fpgm */
319  { 0xd4127766, 0x00002280 } /* prep */
320  },
321  { /* NEC FA-Gothic, 1996 */
322  { 0x00000000, 0x00000000 }, /* cvt */
323  { 0x4a692698, 0x000001f0 }, /* fpgm */
324  { 0x340d4346, 0x00001fca } /* prep */
325  },
326  { /* NEC FA-Minchou, 1996 */
327  { 0x00000000, 0x00000000 }, /* cvt */
328  { 0xcd34c604, 0x00000166 }, /* fpgm */
329  { 0x6cf31046, 0x000022b0 } /* prep */
330  },
331  { /* NEC FA-RoundGothicB, 1996 */
332  { 0x00000000, 0x00000000 }, /* cvt */
333  { 0x5da75315, 0x0000019d }, /* fpgm */
334  { 0x40745a5f, 0x000022e0 } /* prep */
335  },
336  { /* NEC FA-RoundGothicM, 1996 */
337  { 0x00000000, 0x00000000 }, /* cvt */
338  { 0xf055fc48, 0x000001c2 }, /* fpgm */
339  { 0x3900ded3, 0x00001e18 } /* prep */
340  }
341  };
342 
343  FT_ULong checksum;
344  int num_matched_ids[TRICK_SFNT_IDS_NUM_FACES];
345  FT_Bool has_cvt, has_fpgm, has_prep;
346  FT_UShort i;
347  int j, k;
348 
349 
350  FT_MEM_SET( num_matched_ids, 0,
351  sizeof ( int ) * TRICK_SFNT_IDS_NUM_FACES );
352  has_cvt = FALSE;
353  has_fpgm = FALSE;
354  has_prep = FALSE;
355 
356  for ( i = 0; i < face->num_tables; i++ )
357  {
358  checksum = 0;
359 
360  switch( face->dir_tables[i].Tag )
361  {
362  case TTAG_cvt:
363  k = TRICK_SFNT_ID_cvt;
364  has_cvt = TRUE;
365  break;
366 
367  case TTAG_fpgm:
368  k = TRICK_SFNT_ID_fpgm;
369  has_fpgm = TRUE;
370  break;
371 
372  case TTAG_prep:
373  k = TRICK_SFNT_ID_prep;
374  has_prep = TRUE;
375  break;
376 
377  default:
378  continue;
379  }
380 
381  for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )
382  if ( face->dir_tables[i].Length == sfnt_id[j][k].Length )
383  {
384  if ( !checksum )
385  checksum = tt_get_sfnt_checksum( face, i );
386 
387  if ( sfnt_id[j][k].CheckSum == checksum )
388  num_matched_ids[j]++;
389 
390  if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )
391  return TRUE;
392  }
393  }
394 
395  for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ )
396  {
397  if ( !has_cvt && !sfnt_id[j][TRICK_SFNT_ID_cvt].Length )
398  num_matched_ids[j] ++;
399  if ( !has_fpgm && !sfnt_id[j][TRICK_SFNT_ID_fpgm].Length )
400  num_matched_ids[j] ++;
401  if ( !has_prep && !sfnt_id[j][TRICK_SFNT_ID_prep].Length )
402  num_matched_ids[j] ++;
403  if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE )
404  return TRUE;
405  }
406 
407  return FALSE;
408  }
409 
410 
411  static FT_Bool
412  tt_check_trickyness( FT_Face face )
413  {
414  if ( !face )
415  return FALSE;
416 
417  /* For first, check the face name for quick check. */
418  if ( face->family_name &&
419  tt_check_trickyness_family( face->family_name ) )
420  return TRUE;
421 
422  /* Type42 fonts may lack `name' tables, we thus try to identify */
423  /* tricky fonts by checking the checksums of Type42-persistent */
424  /* sfnt tables (`cvt', `fpgm', and `prep'). */
425  if ( tt_check_trickyness_sfnt_ids( (TT_Face)face ) )
426  return TRUE;
427 
428  return FALSE;
429  }
430 
431 
432  /* Check whether `.notdef' is the only glyph in the `loca' table. */
433  static FT_Bool
434  tt_check_single_notdef( FT_Face ttface )
435  {
436  FT_Bool result = FALSE;
437 
438  TT_Face face = (TT_Face)ttface;
439  FT_UInt asize;
440  FT_ULong i;
441  FT_ULong glyph_index = 0;
442  FT_UInt count = 0;
443 
444 
445  for( i = 0; i < face->num_locations; i++ )
446  {
447  tt_face_get_location( face, i, &asize );
448  if ( asize > 0 )
449  {
450  count += 1;
451  if ( count > 1 )
452  break;
453  glyph_index = i;
454  }
455  }
456 
457  /* Only have a single outline. */
458  if ( count == 1 )
459  {
460  if ( glyph_index == 0 )
461  result = TRUE;
462  else
463  {
464  /* FIXME: Need to test glyphname == .notdef ? */
465  FT_Error error;
466  char buf[8];
467 
468 
469  error = FT_Get_Glyph_Name( ttface, glyph_index, buf, 8 );
470  if ( !error &&
471  buf[0] == '.' && !ft_strncmp( buf, ".notdef", 8 ) )
472  result = TRUE;
473  }
474  }
475 
476  return result;
477  }
478 
479 
480  /*************************************************************************/
481  /* */
482  /* <Function> */
483  /* tt_face_init */
484  /* */
485  /* <Description> */
486  /* Initialize a given TrueType face object. */
487  /* */
488  /* <Input> */
489  /* stream :: The source font stream. */
490  /* */
491  /* face_index :: The index of the font face in the resource. */
492  /* */
493  /* num_params :: Number of additional generic parameters. Ignored. */
494  /* */
495  /* params :: Additional generic parameters. Ignored. */
496  /* */
497  /* <InOut> */
498  /* face :: The newly built face object. */
499  /* */
500  /* <Return> */
501  /* FreeType error code. 0 means success. */
502  /* */
505  FT_Face ttface, /* TT_Face */
506  FT_Int face_index,
507  FT_Int num_params,
509  {
510  FT_Error error;
512  SFNT_Service sfnt;
513  TT_Face face = (TT_Face)ttface;
514 
515 
516  FT_TRACE2(( "TTF driver\n" ));
517 
518  library = ttface->driver->root.library;
519 
520  sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
521  if ( !sfnt )
522  {
523  FT_ERROR(( "tt_face_init: cannot access `sfnt' module\n" ));
524  error = FT_THROW( Missing_Module );
525  goto Exit;
526  }
527 
528  /* create input stream from resource */
529  if ( FT_STREAM_SEEK( 0 ) )
530  goto Exit;
531 
532  /* check that we have a valid TrueType file */
533  error = sfnt->init_face( stream, face, face_index, num_params, params );
534  if ( error )
535  goto Exit;
536 
537  /* We must also be able to accept Mac/GX fonts, as well as OT ones. */
538  /* The 0x00020000 tag is completely undocumented; some fonts from */
539  /* Arphic made for Chinese Windows 3.1 have this. */
540  if ( face->format_tag != 0x00010000L && /* MS fonts */
541  face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */
542  face->format_tag != TTAG_true ) /* Mac fonts */
543  {
544  FT_TRACE2(( " not a TTF font\n" ));
545  goto Bad_Format;
546  }
547 
548 #ifdef TT_USE_BYTECODE_INTERPRETER
549  ttface->face_flags |= FT_FACE_FLAG_HINTER;
550 #endif
551 
552  /* If we are performing a simple font format check, exit immediately. */
553  if ( face_index < 0 )
554  return FT_Err_Ok;
555 
556  /* Load font directory */
557  error = sfnt->load_face( stream, face, face_index, num_params, params );
558  if ( error )
559  goto Exit;
560 
561  if ( tt_check_trickyness( ttface ) )
562  ttface->face_flags |= FT_FACE_FLAG_TRICKY;
563 
564  error = tt_face_load_hdmx( face, stream );
565  if ( error )
566  goto Exit;
567 
568  if ( FT_IS_SCALABLE( ttface ) )
569  {
570 
571 #ifdef FT_CONFIG_OPTION_INCREMENTAL
572 
573  if ( !ttface->internal->incremental_interface )
574  error = tt_face_load_loca( face, stream );
575  if ( !error )
576  error = tt_face_load_cvt( face, stream );
577  if ( !error )
578  error = tt_face_load_fpgm( face, stream );
579  if ( !error )
580  error = tt_face_load_prep( face, stream );
581 
582  /* Check the scalable flag based on `loca'. */
583  if ( !ttface->internal->incremental_interface &&
584  ttface->num_fixed_sizes &&
585  face->glyph_locations &&
586  tt_check_single_notdef( ttface ) )
587  {
588  FT_TRACE5(( "tt_face_init:"
589  " Only the `.notdef' glyph has an outline.\n"
590  " "
591  " Resetting scalable flag to FALSE.\n" ));
592 
593  ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
594  }
595 
596 #else
597 
598  if ( !error )
599  error = tt_face_load_loca( face, stream );
600  if ( !error )
601  error = tt_face_load_cvt( face, stream );
602  if ( !error )
603  error = tt_face_load_fpgm( face, stream );
604  if ( !error )
605  error = tt_face_load_prep( face, stream );
606 
607  /* Check the scalable flag based on `loca'. */
608  if ( ttface->num_fixed_sizes &&
609  face->glyph_locations &&
610  tt_check_single_notdef( ttface ) )
611  {
612  FT_TRACE5(( "tt_face_init:"
613  " Only the `.notdef' glyph has an outline.\n"
614  " "
615  " Resetting scalable flag to FALSE.\n" ));
616 
617  ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE;
618  }
619 
620 #endif
621 
622  }
623 
624 #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
625  !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
626 
627  {
628  FT_Bool unpatented_hinting;
629  int i;
630 
631 
632  /* Determine whether unpatented hinting is to be used for this face. */
633  unpatented_hinting = FT_BOOL
635 
636  for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )
637  if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
638  unpatented_hinting = TRUE;
639 
640  if ( !unpatented_hinting )
642  }
643 
644 #endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
645  !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
646 
647  /* initialize standard glyph loading routines */
648  TT_Init_Glyph_Loading( face );
649 
650  Exit:
651  return error;
652 
653  Bad_Format:
654  error = FT_THROW( Unknown_File_Format );
655  goto Exit;
656  }
657 
658 
659  /*************************************************************************/
660  /* */
661  /* <Function> */
662  /* tt_face_done */
663  /* */
664  /* <Description> */
665  /* Finalize a given face object. */
666  /* */
667  /* <Input> */
668  /* face :: A pointer to the face object to destroy. */
669  /* */
670  FT_LOCAL_DEF( void )
671  tt_face_done( FT_Face ttface ) /* TT_Face */
672  {
673  TT_Face face = (TT_Face)ttface;
674  FT_Memory memory;
676  SFNT_Service sfnt;
677 
678 
679  if ( !face )
680  return;
681 
682  memory = ttface->memory;
683  stream = ttface->stream;
684  sfnt = (SFNT_Service)face->sfnt;
685 
686  /* for `extended TrueType formats' (i.e. compressed versions) */
687  if ( face->extra.finalizer )
688  face->extra.finalizer( face->extra.data );
689 
690  if ( sfnt )
691  sfnt->done_face( face );
692 
693  /* freeing the locations table */
694  tt_face_done_loca( face );
695 
696  tt_face_free_hdmx( face );
697 
698  /* freeing the CVT */
699  FT_FREE( face->cvt );
700  face->cvt_size = 0;
701 
702  /* freeing the programs */
704  FT_FRAME_RELEASE( face->cvt_program );
705  face->font_program_size = 0;
706  face->cvt_program_size = 0;
707 
708 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
709  tt_done_blend( memory, face->blend );
710  face->blend = NULL;
711 #endif
712  }
713 
714 
715  /*************************************************************************/
716  /* */
717  /* SIZE FUNCTIONS */
718  /* */
719  /*************************************************************************/
720 
721 #ifdef TT_USE_BYTECODE_INTERPRETER
722 
723  /*************************************************************************/
724  /* */
725  /* <Function> */
726  /* tt_size_run_fpgm */
727  /* */
728  /* <Description> */
729  /* Run the font program. */
730  /* */
731  /* <Input> */
732  /* size :: A handle to the size object. */
733  /* */
734  /* pedantic :: Set if bytecode execution should be pedantic. */
735  /* */
736  /* <Return> */
737  /* FreeType error code. 0 means success. */
738  /* */
740  tt_size_run_fpgm( TT_Size size,
741  FT_Bool pedantic )
742  {
743  TT_Face face = (TT_Face)size->root.face;
744  TT_ExecContext exec;
745  FT_Error error;
746 
747 
748  /* debugging instances have their own context */
749  if ( size->debug )
750  exec = size->context;
751  else
752  exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
753 
754  if ( !exec )
755  return FT_THROW( Could_Not_Find_Context );
756 
757  TT_Load_Context( exec, face, size );
758 
759  exec->callTop = 0;
760  exec->top = 0;
761 
762  exec->period = 64;
763  exec->phase = 0;
764  exec->threshold = 0;
765 
766  exec->instruction_trap = FALSE;
767  exec->F_dot_P = 0x4000L;
768 
769  exec->pedantic_hinting = pedantic;
770 
771  {
772  FT_Size_Metrics* metrics = &exec->metrics;
773  TT_Size_Metrics* tt_metrics = &exec->tt_metrics;
774 
775 
776  metrics->x_ppem = 0;
777  metrics->y_ppem = 0;
778  metrics->x_scale = 0;
779  metrics->y_scale = 0;
780 
781  tt_metrics->ppem = 0;
782  tt_metrics->scale = 0;
783  tt_metrics->ratio = 0x10000L;
784  }
785 
786  /* allow font program execution */
787  TT_Set_CodeRange( exec,
789  face->font_program,
790  face->font_program_size );
791 
792  /* disable CVT and glyph programs coderange */
793  TT_Clear_CodeRange( exec, tt_coderange_cvt );
794  TT_Clear_CodeRange( exec, tt_coderange_glyph );
795 
796  if ( face->font_program_size > 0 )
797  {
798  error = TT_Goto_CodeRange( exec, tt_coderange_font, 0 );
799 
800  if ( !error )
801  {
802  FT_TRACE4(( "Executing `fpgm' table.\n" ));
803 
804  error = face->interpreter( exec );
805  }
806  }
807  else
808  error = FT_Err_Ok;
809 
810  if ( !error )
811  TT_Save_Context( exec, size );
812 
813  return error;
814  }
815 
816 
817  /*************************************************************************/
818  /* */
819  /* <Function> */
820  /* tt_size_run_prep */
821  /* */
822  /* <Description> */
823  /* Run the control value program. */
824  /* */
825  /* <Input> */
826  /* size :: A handle to the size object. */
827  /* */
828  /* pedantic :: Set if bytecode execution should be pedantic. */
829  /* */
830  /* <Return> */
831  /* FreeType error code. 0 means success. */
832  /* */
834  tt_size_run_prep( TT_Size size,
835  FT_Bool pedantic )
836  {
837  TT_Face face = (TT_Face)size->root.face;
838  TT_ExecContext exec;
839  FT_Error error;
840 
841 
842  /* debugging instances have their own context */
843  if ( size->debug )
844  exec = size->context;
845  else
846  exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
847 
848  if ( !exec )
849  return FT_THROW( Could_Not_Find_Context );
850 
851  TT_Load_Context( exec, face, size );
852 
853  exec->callTop = 0;
854  exec->top = 0;
855 
856  exec->instruction_trap = FALSE;
857 
858  exec->pedantic_hinting = pedantic;
859 
860  TT_Set_CodeRange( exec,
862  face->cvt_program,
863  face->cvt_program_size );
864 
865  TT_Clear_CodeRange( exec, tt_coderange_glyph );
866 
867  if ( face->cvt_program_size > 0 )
868  {
869  error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
870 
871  if ( !error && !size->debug )
872  {
873  FT_TRACE4(( "Executing `prep' table.\n" ));
874 
875  error = face->interpreter( exec );
876  }
877  }
878  else
879  error = FT_Err_Ok;
880 
881  /* UNDOCUMENTED! The MS rasterizer doesn't allow the following */
882  /* graphics state variables to be modified by the CVT program. */
883 
884  exec->GS.dualVector.x = 0x4000;
885  exec->GS.dualVector.y = 0;
886  exec->GS.projVector.x = 0x4000;
887  exec->GS.projVector.y = 0x0;
888  exec->GS.freeVector.x = 0x4000;
889  exec->GS.freeVector.y = 0x0;
890 
891  exec->GS.rp0 = 0;
892  exec->GS.rp1 = 0;
893  exec->GS.rp2 = 0;
894 
895  exec->GS.gep0 = 1;
896  exec->GS.gep1 = 1;
897  exec->GS.gep2 = 1;
898 
899  exec->GS.loop = 1;
900 
901  /* save as default graphics state */
902  size->GS = exec->GS;
903 
904  TT_Save_Context( exec, size );
905 
906  return error;
907  }
908 
909 #endif /* TT_USE_BYTECODE_INTERPRETER */
910 
911 
912 #ifdef TT_USE_BYTECODE_INTERPRETER
913 
914  static void
915  tt_size_done_bytecode( FT_Size ftsize )
916  {
917  TT_Size size = (TT_Size)ftsize;
918  TT_Face face = (TT_Face)ftsize->face;
919  FT_Memory memory = face->root.memory;
920 
921 
922  if ( size->debug )
923  {
924  /* the debug context must be deleted by the debugger itself */
925  size->context = NULL;
926  size->debug = FALSE;
927  }
928 
929  FT_FREE( size->cvt );
930  size->cvt_size = 0;
931 
932  /* free storage area */
933  FT_FREE( size->storage );
934  size->storage_size = 0;
935 
936  /* twilight zone */
937  tt_glyphzone_done( &size->twilight );
938 
939  FT_FREE( size->function_defs );
940  FT_FREE( size->instruction_defs );
941 
942  size->num_function_defs = 0;
943  size->max_function_defs = 0;
944  size->num_instruction_defs = 0;
945  size->max_instruction_defs = 0;
946 
947  size->max_func = 0;
948  size->max_ins = 0;
949 
950  size->bytecode_ready = 0;
951  size->cvt_ready = 0;
952  }
953 
954 
955  /* Initialize bytecode-related fields in the size object. */
956  /* We do this only if bytecode interpretation is really needed. */
957  static FT_Error
958  tt_size_init_bytecode( FT_Size ftsize,
959  FT_Bool pedantic )
960  {
961  FT_Error error;
962  TT_Size size = (TT_Size)ftsize;
963  TT_Face face = (TT_Face)ftsize->face;
964  FT_Memory memory = face->root.memory;
965  FT_Int i;
966 
967  FT_UShort n_twilight;
968  TT_MaxProfile* maxp = &face->max_profile;
969 
970 
971  size->bytecode_ready = 1;
972  size->cvt_ready = 0;
973 
974  size->max_function_defs = maxp->maxFunctionDefs;
975  size->max_instruction_defs = maxp->maxInstructionDefs;
976 
977  size->num_function_defs = 0;
978  size->num_instruction_defs = 0;
979 
980  size->max_func = 0;
981  size->max_ins = 0;
982 
983  size->cvt_size = face->cvt_size;
984  size->storage_size = maxp->maxStorage;
985 
986  /* Set default metrics */
987  {
989 
990 
991  metrics->rotated = FALSE;
992  metrics->stretched = FALSE;
993 
994  /* set default compensation (all 0) */
995  for ( i = 0; i < 4; i++ )
996  metrics->compensations[i] = 0;
997  }
998 
999  /* allocate function defs, instruction defs, cvt, and storage area */
1000  if ( FT_NEW_ARRAY( size->function_defs, size->max_function_defs ) ||
1001  FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||
1002  FT_NEW_ARRAY( size->cvt, size->cvt_size ) ||
1003  FT_NEW_ARRAY( size->storage, size->storage_size ) )
1004  goto Exit;
1005 
1006  /* reserve twilight zone */
1007  n_twilight = maxp->maxTwilightPoints;
1008 
1009  /* there are 4 phantom points (do we need this?) */
1010  n_twilight += 4;
1011 
1012  error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );
1013  if ( error )
1014  goto Exit;
1015 
1016  size->twilight.n_points = n_twilight;
1017 
1018  size->GS = tt_default_graphics_state;
1019 
1020  /* set `face->interpreter' according to the debug hook present */
1021  {
1022  FT_Library library = face->root.driver->root.library;
1023 
1024 
1025  face->interpreter = (TT_Interpreter)
1027  if ( !face->interpreter )
1029  }
1030 
1031  /* Fine, now run the font program! */
1032  error = tt_size_run_fpgm( size, pedantic );
1033 
1034  Exit:
1035  if ( error )
1036  tt_size_done_bytecode( ftsize );
1037 
1038  return error;
1039  }
1040 
1041 
1043  tt_size_ready_bytecode( TT_Size size,
1044  FT_Bool pedantic )
1045  {
1047 
1048 
1049  if ( !size->bytecode_ready )
1050  {
1051  error = tt_size_init_bytecode( (FT_Size)size, pedantic );
1052  if ( error )
1053  goto Exit;
1054  }
1055 
1056  /* rescale CVT when needed */
1057  if ( !size->cvt_ready )
1058  {
1059  FT_UInt i;
1060  TT_Face face = (TT_Face)size->root.face;
1061 
1062 
1063  /* Scale the cvt values to the new ppem. */
1064  /* We use by default the y ppem to scale the CVT. */
1065  for ( i = 0; i < size->cvt_size; i++ )
1066  size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
1067 
1068  /* all twilight points are originally zero */
1069  for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )
1070  {
1071  size->twilight.org[i].x = 0;
1072  size->twilight.org[i].y = 0;
1073  size->twilight.cur[i].x = 0;
1074  size->twilight.cur[i].y = 0;
1075  }
1076 
1077  /* clear storage area */
1078  for ( i = 0; i < (FT_UInt)size->storage_size; i++ )
1079  size->storage[i] = 0;
1080 
1081  size->GS = tt_default_graphics_state;
1082 
1083  error = tt_size_run_prep( size, pedantic );
1084  if ( !error )
1085  size->cvt_ready = 1;
1086  }
1087 
1088  Exit:
1089  return error;
1090  }
1091 
1092 #endif /* TT_USE_BYTECODE_INTERPRETER */
1093 
1094 
1095  /*************************************************************************/
1096  /* */
1097  /* <Function> */
1098  /* tt_size_init */
1099  /* */
1100  /* <Description> */
1101  /* Initialize a new TrueType size object. */
1102  /* */
1103  /* <InOut> */
1104  /* size :: A handle to the size object. */
1105  /* */
1106  /* <Return> */
1107  /* FreeType error code. 0 means success. */
1108  /* */
1110  tt_size_init( FT_Size ttsize ) /* TT_Size */
1111  {
1112  TT_Size size = (TT_Size)ttsize;
1114 
1115 #ifdef TT_USE_BYTECODE_INTERPRETER
1116  size->bytecode_ready = 0;
1117  size->cvt_ready = 0;
1118 #endif
1119 
1120  size->ttmetrics.valid = FALSE;
1121  size->strike_index = 0xFFFFFFFFUL;
1122 
1123  return error;
1124  }
1125 
1126 
1127  /*************************************************************************/
1128  /* */
1129  /* <Function> */
1130  /* tt_size_done */
1131  /* */
1132  /* <Description> */
1133  /* The TrueType size object finalizer. */
1134  /* */
1135  /* <Input> */
1136  /* size :: A handle to the target size object. */
1137  /* */
1138  FT_LOCAL_DEF( void )
1139  tt_size_done( FT_Size ttsize ) /* TT_Size */
1140  {
1141  TT_Size size = (TT_Size)ttsize;
1142 
1143 
1144 #ifdef TT_USE_BYTECODE_INTERPRETER
1145  if ( size->bytecode_ready )
1146  tt_size_done_bytecode( ttsize );
1147 #endif
1148 
1149  size->ttmetrics.valid = FALSE;
1150  }
1151 
1152 
1153  /*************************************************************************/
1154  /* */
1155  /* <Function> */
1156  /* tt_size_reset */
1157  /* */
1158  /* <Description> */
1159  /* Reset a TrueType size when resolutions and character dimensions */
1160  /* have been changed. */
1161  /* */
1162  /* <Input> */
1163  /* size :: A handle to the target size object. */
1164  /* */
1167  {
1168  TT_Face face;
1171 
1172 
1173  size->ttmetrics.valid = FALSE;
1174 
1175  face = (TT_Face)size->root.face;
1176 
1177  metrics = &size->metrics;
1178 
1179  /* copy the result from base layer */
1180  *metrics = size->root.metrics;
1181 
1182  if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 )
1183  return FT_THROW( Invalid_PPem );
1184 
1185  /* This bit flag, if set, indicates that the ppems must be */
1186  /* rounded to integers. Nearly all TrueType fonts have this bit */
1187  /* set, as hinting won't work really well otherwise. */
1188  /* */
1189  if ( face->header.Flags & 8 )
1190  {
1191  metrics->x_scale = FT_DivFix( metrics->x_ppem << 6,
1192  face->root.units_per_EM );
1193  metrics->y_scale = FT_DivFix( metrics->y_ppem << 6,
1194  face->root.units_per_EM );
1195 
1196  metrics->ascender =
1197  FT_PIX_ROUND( FT_MulFix( face->root.ascender, metrics->y_scale ) );
1198  metrics->descender =
1199  FT_PIX_ROUND( FT_MulFix( face->root.descender, metrics->y_scale ) );
1200  metrics->height =
1201  FT_PIX_ROUND( FT_MulFix( face->root.height, metrics->y_scale ) );
1202  metrics->max_advance =
1204  metrics->x_scale ) );
1205  }
1206 
1207  /* compute new transformation */
1208  if ( metrics->x_ppem >= metrics->y_ppem )
1209  {
1210  size->ttmetrics.scale = metrics->x_scale;
1211  size->ttmetrics.ppem = metrics->x_ppem;
1212  size->ttmetrics.x_ratio = 0x10000L;
1213  size->ttmetrics.y_ratio = FT_DivFix( metrics->y_ppem,
1214  metrics->x_ppem );
1215  }
1216  else
1217  {
1218  size->ttmetrics.scale = metrics->y_scale;
1219  size->ttmetrics.ppem = metrics->y_ppem;
1220  size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem,
1221  metrics->y_ppem );
1222  size->ttmetrics.y_ratio = 0x10000L;
1223  }
1224 
1225 #ifdef TT_USE_BYTECODE_INTERPRETER
1226  size->cvt_ready = 0;
1227 #endif /* TT_USE_BYTECODE_INTERPRETER */
1228 
1229  if ( !error )
1230  size->ttmetrics.valid = TRUE;
1231 
1232  return error;
1233  }
1234 
1235 
1236  /*************************************************************************/
1237  /* */
1238  /* <Function> */
1239  /* tt_driver_init */
1240  /* */
1241  /* <Description> */
1242  /* Initialize a given TrueType driver object. */
1243  /* */
1244  /* <Input> */
1245  /* driver :: A handle to the target driver object. */
1246  /* */
1247  /* <Return> */
1248  /* FreeType error code. 0 means success. */
1249  /* */
1251  tt_driver_init( FT_Module ttdriver ) /* TT_Driver */
1252  {
1253 
1254 #ifdef TT_USE_BYTECODE_INTERPRETER
1255 
1256  TT_Driver driver = (TT_Driver)ttdriver;
1257 
1258 
1259  if ( !TT_New_Context( driver ) )
1260  return FT_THROW( Could_Not_Find_Context );
1261 
1262 #else
1263 
1264  FT_UNUSED( ttdriver );
1265 
1266 #endif
1267 
1268  return FT_Err_Ok;
1269  }
1270 
1271 
1272  /*************************************************************************/
1273  /* */
1274  /* <Function> */
1275  /* tt_driver_done */
1276  /* */
1277  /* <Description> */
1278  /* Finalize a given TrueType driver. */
1279  /* */
1280  /* <Input> */
1281  /* driver :: A handle to the target TrueType driver. */
1282  /* */
1283  FT_LOCAL_DEF( void )
1284  tt_driver_done( FT_Module ttdriver ) /* TT_Driver */
1285  {
1286 #ifdef TT_USE_BYTECODE_INTERPRETER
1287  TT_Driver driver = (TT_Driver)ttdriver;
1288 
1289 
1290  /* destroy the execution context */
1291  if ( driver->context )
1292  {
1293  TT_Done_Context( driver->context );
1294  driver->context = NULL;
1295  }
1296 #else
1297  FT_UNUSED( ttdriver );
1298 #endif
1299 
1300  }
1301 
1302 
1303  /*************************************************************************/
1304  /* */
1305  /* <Function> */
1306  /* tt_slot_init */
1307  /* */
1308  /* <Description> */
1309  /* Initialize a new slot object. */
1310  /* */
1311  /* <InOut> */
1312  /* slot :: A handle to the slot object. */
1313  /* */
1314  /* <Return> */
1315  /* FreeType error code. 0 means success. */
1316  /* */
1319  {
1320  return FT_GlyphLoader_CreateExtra( slot->internal->loader );
1321  }
1322 
1323 
1324 /* END */
FT_UShort units_per_EM
Definition: freetype.h:945
GLenum GLuint GLenum GLsizei length
const TT_GraphicsState tt_default_graphics_state
FT_UShort n_points
Definition: tttypes.h:1477
#define TRICK_SFNT_IDS_NUM_FACES
FT_Face face
Definition: freetype.h:1404
FT_Byte * tags
Definition: tttypes.h:1484
#define TRICK_SFNT_ID_cvt
TT_Init_Face_Func init_face
Definition: sfnt.h:653
int FT_Error
Definition: fttypes.h:296
#define FT_GET_BYTE()
Definition: ftstream.h:287
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:586
GLuint GLuint stream
for(n=1;n< outline->n_points;n++)
Definition: ftbbox.c:593
void * sfnt
Definition: tttypes.h:1298
FT_Int num_fixed_sizes
Definition: freetype.h:932
SFNT_Interface * SFNT_Service
Definition: sfnt.h:754
#define ft_strncmp
Definition: ftstdlib.h:88
unsigned long FT_ULong
Definition: fttypes.h:249
FT_Vector * org
Definition: tttypes.h:1480
tt_size_done(FT_Size ttsize)
Definition: ttobjs.c:1139
#define ft_strstr
Definition: ftstdlib.h:91
FT_Generic_Finalizer finalizer
Definition: fttypes.h:458
#define FT_MEM_ZERO(dest, count)
Definition: ftmemory.h:208
#define NULL
Definition: ftobjs.h:61
signed int FT_Int
Definition: fttypes.h:216
FT_Short ascender
Definition: freetype.h:946
FT_ULong strike_index
Definition: ttobjs.h:300
#define FT_FACE_FLAG_SCALABLE
Definition: freetype.h:1076
return FT_THROW(Missing_Property)
tt_face_load_loca(TT_Face face, FT_Stream stream)
Definition: ttpload.c:62
#define FT_UNUSED(arg)
Definition: ftconfig.h:76
FT_Library library
Definition: ftobjs.h:476
FT_Bool valid
Definition: ttobjs.h:278
FT_String * family_name
Definition: freetype.h:929
FT_Short descender
Definition: freetype.h:947
tt_slot_init(FT_GlyphSlot slot)
Definition: ttobjs.c:1318
FT_Short * cvt
Definition: tttypes.h:1357
TT_Init_Glyph_Loading(TT_Face face)
Definition: ttgload.c:682
unsigned int FT_UInt32
Definition: ftconfig.h:133
FT_Bool ignore_unpatented_hinter
Definition: ftobjs.h:369
FT_Long x_ratio
Definition: ttobjs.h:269
FT_Library library
Definition: cffdrivr.c:414
tt_size_init(FT_Size ttsize)
Definition: ttobjs.c:1110
typedefFT_BEGIN_HEADER struct TT_DriverRec_ * TT_Driver
Definition: ttobjs.h:39
return FT_Err_Ok
Definition: ftbbox.c:645
TT_Interpreter interpreter
Definition: tttypes.h:1368
FT_UShort * contours
Definition: tttypes.h:1485
FT_UShort max_points
Definition: tttypes.h:1475
TT_Loader_GotoTableFunc goto_table
Definition: tttypes.h:1288
FT_ULong font_program_size
Definition: tttypes.h:1348
png_uint_32 i
Definition: png.h:2640
TT_New_Context(TT_Driver driver)
FT_Pos max_advance
Definition: freetype.h:1378
#define FT_FACE_DRIVER(x)
Definition: ftobjs.h:561
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:104
FT_Face_Internal internal
Definition: freetype.h:971
tt_face_load_cvt(TT_Face face, FT_Stream stream)
Definition: ttpload.c:280
FT_GlyphLoader_CreateExtra(FT_GlyphLoader loader)
Definition: ftgloadr.c:166
tt_face_init(FT_Stream stream, FT_Face ttface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
Definition: ttobjs.c:504
#define FT_DEBUG_HOOK_TRUETYPE
Definition: ftobjs.h:774
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLuint GLint GLenum face
TT_Done_Face_Func done_face
Definition: sfnt.h:655
tt_face_free_hdmx(TT_Face face)
Definition: ttpload.c:559
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define TTAG_true
Definition: tttags.h:92
FT_Memory memory
Definition: tttypes.h:1474
#define FT_TRACE4(varformat)
Definition: ftdebug.h:161
tt_size_reset(TT_Size size)
Definition: ttobjs.c:1166
FT_Vector * cur
Definition: tttypes.h:1481
FT_Byte * font_program
Definition: tttypes.h:1349
FT_SizeRec root
Definition: ttobjs.h:292
#define FT_FREE(ptr)
Definition: ftmemory.h:286
FT_ULong format_tag
Definition: tttypes.h:1264
FT_Long ratio
Definition: ttobjs.h:273
tt_face_load_hdmx(TT_Face face, FT_Stream stream)
Definition: ttpload.c:484
FT_ModuleRec root
Definition: ftobjs.h:751
struct TT_FaceRec_ * TT_Face
Definition: tttypes.h:951
tt_done_blend(FT_Memory memory, GX_Blend blend)
#define TTAG_fpgm
Definition: tttags.h:54
TT_MaxProfile max_profile
Definition: tttypes.h:1271
FT_Error error
Definition: cffdrivr.c:411
FT_ULong Tag
Definition: tttypes.h:132
char FT_String
Definition: fttypes.h:183
FT_ULong num_locations
Definition: tttypes.h:1404
#define FT_DEBUG_HOOK_UNPATENTED_HINTING
Definition: ftobjs.h:781
tt_driver_done(FT_Module ttdriver)
Definition: ttobjs.c:1284
FT_Error(* TT_Interpreter)(void *exec_context)
Definition: tttypes.h:956
FT_ULong cvt_size
Definition: tttypes.h:1356
FT_ULong CheckSum
Definition: tttypes.h:133
#define FT_TRACE2(varformat)
Definition: ftdebug.h:159
#define TRICK_SFNT_IDS_PER_FACE
struct tt_sfnt_id_rec_ tt_sfnt_id_rec
FT_ULong Length
Definition: tttypes.h:135
#define FT_PARAM_TAG_UNPATENTED_HINTING
Definition: ttunpat.h:49
TT_Size_Metrics ttmetrics
Definition: ttobjs.h:298
FT_Pos descender
Definition: freetype.h:1376
FT_DebugHook_Func debug_hooks[4]
Definition: ftobjs.h:877
FT_UShort x_ppem
Definition: freetype.h:1369
FT_Short n_contours
Definition: tttypes.h:1478
#define FALSE
Definition: ftobjs.h:57
TT_Load_Face_Func load_face
Definition: sfnt.h:654
#define TRICK_NAMES_COUNT
signed short FT_Short
Definition: fttypes.h:194
FT_Long face_flags
Definition: freetype.h:924
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
tt_face_done(FT_Face ttface)
Definition: ttobjs.c:671
FT_Bool rotated
Definition: ttobjs.h:280
TT_Header header
Definition: tttypes.h:1268
FT_Byte * glyph_locations
Definition: tttypes.h:1405
#define FT_FACE_FLAG_HINTER
Definition: freetype.h:1087
#define FT_BOOL(x)
Definition: fttypes.h:574
FT_FaceRec root
Definition: tttypes.h:1260
#define FT_FRAME_EXIT()
Definition: ftstream.h:514
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:290
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:489
CFF_Driver driver
Definition: cffdrivr.c:585
GLuint const GLchar * name
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:485
void * data
Definition: fttypes.h:457
#define FT_FRAME_RELEASE(bytes)
Definition: ftstream.h:522
if(!abbox) return FT_THROW(Invalid_Argument)
FT_Generic extra
Definition: tttypes.h:1382
GLenum const GLfloat * params
FT_Fixed y_scale
Definition: freetype.h:1373
#define TTAG_cvt
Definition: tttags.h:47
GLuint64EXT * result
unsigned int FT_UInt
Definition: fttypes.h:227
TT_Table dir_tables
Definition: tttypes.h:1266
tt_face_load_prep(TT_Face face, FT_Stream stream)
Definition: ttpload.c:423
FT_Short height
Definition: freetype.h:948
tt_driver_init(FT_Module ttdriver)
Definition: ttobjs.c:1251
#define FT_TRACE5(varformat)
Definition: ftdebug.h:162
#define FT_FACE_FLAG_TRICKY
Definition: freetype.h:1089
FT_Fixed x_scale
Definition: freetype.h:1372
FT_Fixed scale
Definition: ttobjs.h:274
GLuint GLuint GLsizei count
#define FT_GET_ULONG()
Definition: ftstream.h:293
#define FT_FRAME_ENTER(size)
Definition: ftstream.h:510
FT_Driver driver
Definition: freetype.h:962
FT_Get_Module_Interface(FT_Library library, const char *mod_name)
Definition: ftobjs.c:4337
tt_face_load_fpgm(TT_Face face, FT_Stream stream)
Definition: ttpload.c:361
#define TRICK_NAMES_MAX_CHARACTERS
FT_ULong cvt_program_size
Definition: tttypes.h:1352
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
#define TRICK_SFNT_ID_prep
#define FT_MEM_SET(dest, byte, count)
Definition: ftmemory.h:201
unsigned short FT_UShort
Definition: fttypes.h:205
FT_UShort ppem
Definition: ttobjs.h:272
FT_Stream stream
Definition: freetype.h:964
#define FT_IS_SCALABLE(face)
Definition: freetype.h:1148
FT_Byte * cvt_program
Definition: tttypes.h:1353
FT_Short max_advance_width
Definition: freetype.h:950
GLsizeiptr size
FT_Get_Glyph_Name(FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max)
Definition: ftobjs.c:3588
FT_UShort num_tables
Definition: tttypes.h:1265
#define TRUE
Definition: ftobjs.h:53
FT_Vector * orus
Definition: tttypes.h:1482
struct TT_SizeRec_ * TT_Size
Definition: ttobjs.h:50
#define FT_PIX_ROUND(x)
Definition: ftobjs.h:81
FT_Size_Metrics metrics
Definition: freetype.h:1406
FT_Long y_ratio
Definition: ttobjs.h:270
tt_face_get_location(TT_Face face, FT_UInt gindex, FT_UInt *asize)
Definition: ttpload.c:173
#define FT_LOCAL_DEF(x)
Definition: ftconfig.h:236
FT_UShort max_contours
Definition: tttypes.h:1476
FT_Memory memory
Definition: freetype.h:963
tt_face_done_loca(TT_Face face)
Definition: ttpload.c:251
FT_Size_Metrics metrics
Definition: ttobjs.h:296
FT_UShort y_ppem
Definition: freetype.h:1370
#define TRICK_SFNT_ID_fpgm
#define TTAG_prep
Definition: tttags.h:87
TT_RunIns(TT_ExecContext exec)