w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ttapi.c
Go to the documentation of this file.
1 /*******************************************************************
2  *
3  * ttapi.c
4  *
5  * High-level interface implementation
6  *
7  * Copyright 1996-2000 by
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  * Notes:
17  *
18  * This file is used to implement most of the functions that are
19  * defined in the file "freetype.h". However, two functions are
20  * implemented elsewhere :
21  *
22  * TT_MulDiv and TT_MulFix are in ttcalc.h/ttcalc.c
23  *
24  ******************************************************************/
25 
26 #include "ttconfig.h"
27 
28 #include "freetype.h"
29 #include "ttengine.h"
30 #include "ttcalc.h"
31 #include "ttmemory.h"
32 #include "ttcache.h"
33 #include "ttfile.h"
34 #include "ttobjs.h"
35 #include "ttload.h"
36 #include "ttgload.h"
37 #include "ttraster.h"
38 #include "ttextend.h"
39 
40 
41 /* required by the tracing mode */
42 #undef TT_COMPONENT
43 #define TT_COMPONENT trace_api
44 
45 
46 #ifdef TT_STATIC_RASTER
47 #define RAS_OPS /* void */
48 #define RAS_OP /* void */
49 #else
50 #define RAS_OPS ((TRaster_Instance*)_engine->raster_component),
51 #define RAS_OP ((TRaster_Instance*)_engine->raster_component)
52 #endif /* TT_STATIC_RASTER */
53 
54 
55 #define RENDER_Glyph( glyph, target ) \
56  Render_Glyph( RAS_OPS glyph, target )
57 
58 #define RENDER_Gray_Glyph( glyph, target, palette ) \
59  Render_Gray_Glyph( RAS_OPS glyph, target, palette )
60 
61 
62 
63 /*******************************************************************
64  *
65  * Function : TT_FreeType_Version
66  *
67  * Description : Returns the major and minor version of the library.
68  *
69  * Input : major, minor addresses
70  *
71  * Output : Error code.
72  *
73  * MT-Note : YES!
74  *
75  ******************************************************************/
76 
79  int *minor )
80  {
81  if ( !major || !minor )
83 
86 
87  return TT_Err_Ok;
88  }
89 
90 
91 /*******************************************************************
92  *
93  * Function : TT_Init_FreeType
94  *
95  * Description : The library's engine initializer. This function
96  * must be called prior to any call.
97  *
98  * Input : engine pointer to a FreeType engine instance
99  *
100  * Output : Error code.
101  *
102  * MT-Note : This function should be called each time you want
103  * to create a TT_Engine. It is not necessarily thread
104  * safe depending on the implementations of ttmemory,
105  * ttfile and ttmutex, so take care. Their default
106  * implementations are safe, however.
107  *
108  ******************************************************************/
109 
112  {
113  PEngine_Instance _engine;
114 
115  TT_Error error;
116  int n;
117 
118 
119  /* first of all, initialize memory sub-system */
120  error = TTMemory_Init();
121  if ( error )
122  return error;
123 
124  /* Allocate engine instance */
125  if ( ALLOC( _engine, sizeof ( TEngine_Instance ) ) )
126  return error;
127 
128 #undef TT_FAIL
129 #define TT_FAIL( x ) ( error = x (_engine) ) != TT_Err_Ok
130 
131  /* Initalize components */
132  if ( TT_FAIL( TTFile_Init ) ||
133  TT_FAIL( TTCache_Init ) ||
135  TT_FAIL( TTExtend_Init ) ||
136 #endif
137  TT_FAIL( TTObjs_Init ) ||
139  goto Fail;
140 
141 #undef TT_FAIL
142 
143  /* set the gray palette defaults: 0 to 4 */
144  for ( n = 0; n < 5; n++ )
145  _engine->raster_palette[n] = (Byte)n; /* Conversion ok, some warn */
146 
147  /* create the engine lock */
148  MUTEX_Create( _engine->lock );
149 
150  HANDLE_Set( *engine, _engine );
151  return TT_Err_Ok;
152 
153  Fail:
155  HANDLE_Set( *engine, NULL );
156  return error;
157  }
158 
159 
160 /*******************************************************************
161  *
162  * Function : TT_Done_FreeType
163  *
164  * Description : The library's engine finalizer. This function
165  * will discard all active face and glyph objects
166  * from the heap.
167  *
168  * Input : engine FreeType engine instance
169  *
170  * Output : Error code.
171  *
172  * MT-Note : Destroys an engine. Not necessarily thread-safe
173  * depending on the implementations of ttmemory,
174  * ttfile and ttmutex. The default implementations
175  * are safe, however.
176  *
177  ******************************************************************/
178 
181  {
183 
184 
185  if ( !_engine )
186  return TT_Err_Ok;
187 
188  MUTEX_Destroy( _engine->lock );
189 
190  TTRaster_Done( _engine );
191  TTObjs_Done ( _engine );
192 #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
193  TTExtend_Done( _engine );
194 #endif
195  TTCache_Done ( _engine );
196  TTFile_Done ( _engine );
197  FREE( _engine );
198 
199  TTMemory_Done();
200 
201  return TT_Err_Ok;
202  }
203 
204 
205 #ifdef TT_CONFIG_OPTION_GRAY_SCALING
206 
207 /*******************************************************************
208  *
209  * Function : TT_Set_Raster_Gray_Palette
210  *
211  * Description : Sets the gray-levels palette used for font
212  * smoothing.
213  *
214  * Input : engine FreeType engine instance
215  * palette address of palette (a 5 byte array)
216  *
217  * Output : Invalid argument if 'palette' is NULL.
218  *
219  * MT-Note: NO! Unprotected modification of an engine's palette.
220  *
221  ******************************************************************/
222 
225  Byte* palette )
226  {
227  int i;
228 
229 
230  if ( !palette )
232 
233  for ( i = 0; i < 5; i++ )
234  HANDLE_Engine( engine )->raster_palette[i] = (Byte)palette[i];
235 
236  return TT_Err_Ok;
237  }
238 
239 #endif /* TT_CONFIG_OPTION_GRAY_SCALING */
240 
241 
242 /*******************************************************************
243  *
244  * Function : TT_Open_Face
245  *
246  * Description : Creates a new face object from a given font file.
247  *
248  * Input : engine FreeType engine instance
249  * fontPathName the font file's pathname
250  * face adress of returned face handle
251  *
252  * Output : Error code.
253  *
254  * Note : The face handle is set to NULL in case of failure.
255  *
256  * MT-Note : YES!
257  *
258  ******************************************************************/
259 
262  const TT_Text* fontPathName,
263  TT_Face* face )
264  {
266 
268  TT_Error error;
270  PFace _face;
271 
272 
273  if ( !_engine )
274  return TT_Err_Invalid_Engine;
275 
276  /* open the file */
277  error = TT_Open_Stream( fontPathName, &stream );
278  if ( error )
279  return error;
280 
281  input.stream = stream;
282  input.fontIndex = 0;
283  input.engine = _engine;
284 
285  /* Create and load the new face object - this is thread-safe */
286  error = CACHE_New( _engine->objs_face_cache,
287  _face,
288  &input );
289 
290  /* Set the handle */
291  HANDLE_Set( *face, _face );
292 
293  if ( error )
294  goto Fail;
295 
296  return TT_Err_Ok;
297 
298  Fail:
300  return error;
301  }
302 
303 
304 /*******************************************************************
305  *
306  * Function : TT_Open_Collection
307  *
308  * Description : Creates a new face object from a given font file.
309  *
310  * Input : engine FreeType engine instance
311  * collectionPathName the font file's pathname
312  * fontIndex index of font in TrueType collection
313  * face adress of returned face handle
314  *
315  * Output : Error code.
316  *
317  * Note : The face handle is set to NULL in case of failure.
318  *
319  * MT-Note : YES!
320  *
321  ******************************************************************/
322 
325  const TT_Text* collectionPathName,
326  TT_ULong fontIndex,
327  TT_Face* face )
328  {
330 
332  TT_Error error;
334  PFace _face;
335 
336 
337  if ( !_engine )
338  return TT_Err_Invalid_Engine;
339 
340  /* open the file */
341  error = TT_Open_Stream( collectionPathName, &stream );
342  if ( error )
343  return error;
344 
345  input.stream = stream;
346  input.fontIndex = fontIndex;
347  input.engine = _engine;
348 
349  /* Create and load the new face object - this is thread-safe */
350  error = CACHE_New( _engine->objs_face_cache,
351  _face,
352  &input );
353 
354  /* Set the handle */
355  HANDLE_Set( *face, _face );
356 
357  if ( error )
358  goto Fail;
359 
360  return TT_Err_Ok;
361 
362  Fail:
364 
365  return error;
366  }
367 
368 
369 /*******************************************************************
370  *
371  * Function : TT_Get_Face_Properties
372  *
373  * Description : Returns face properties.
374  *
375  * Input : face the face handle
376  * properties address of target properties record
377  *
378  * Output : Error code.
379  *
380  * Note : Currently, max_Faces is always set to 0.
381  *
382  * MT-Note : YES! Reads only permanent data.
383  *
384  ******************************************************************/
385 
389  {
390  PFace _face = HANDLE_Face( face );
391 
392 
393  if ( !_face )
395 
396  properties->num_Glyphs = _face->numGlyphs;
397  properties->max_Points = _face->maxPoints;
399  properties->num_CharMaps = _face->numCMaps;
401 
402  if ( _face->ttcHeader.DirCount == 0 )
403  properties->num_Faces = 1;
404  else
406 
407  properties->header = &_face->fontHeader;
409 
410  if ( _face->verticalInfo )
412  else
414 
415  properties->os2 = &_face->os2;
416  properties->postscript = &_face->postscript;
417  properties->hdmx = &_face->hdmx;
418 
419  return TT_Err_Ok;
420  }
421 
422 
423 /*******************************************************************
424  *
425  * Function : TT_Set_Face_Pointer
426  *
427  * Description : Each face object has one pointer, which use is
428  * reserved to client applications. The TrueType
429  * engine never accesses or uses this field.
430  *
431  * This function is used to set the pointer.
432  *
433  * Input : face the given face handle
434  * data the generic pointer value
435  *
436  * Output : Error code.
437  *
438  * MT-Note : NO! But this function is reserved to "enlightened"
439  * developers, so it shouldn't be a problem.
440  *
441  ******************************************************************/
442 
445  void* data )
446  {
447  PFace faze = HANDLE_Face( face );
448 
449 
450  if ( !faze )
452  else
453  faze->generic = data;
454 
455  return TT_Err_Ok;
456  }
457 
458 
459 /*******************************************************************
460  *
461  * Function : TT_Get_Face_Pointer
462  *
463  * Description : Each face object has one pointer, which use is
464  * reserved to client applications. The TrueType
465  * engine never access or use this field.
466  *
467  * This function is used to read the pointer.
468  *
469  * Input : face the given face handle
470  * data the generic pointer value
471  *
472  * Output : Error code.
473  *
474  * MT-Note : NO! But this function is reserved to "enlightened"
475  * developers, so it shouldn't be a problem.
476  *
477  ******************************************************************/
478 
479  FT_EXPORT_FUNC( void* )
481  {
482  PFace faze = HANDLE_Face( face );
483 
484 
485  if ( !faze )
486  return NULL;
487  else
488  return faze->generic;
489  }
490 
491 
492 /*******************************************************************
493  *
494  * Function : TT_Get_Face_Metrics
495  *
496  * Description : This function returns the original horizontal AND
497  * vertical metrics as found in the "hmtx" and "vmtx"
498  * tables. These are the glyphs' left-side-bearings
499  * and advance widths (horizontal), as well as top
500  * side bearings and advance heights (vertical).
501  *
502  * All are expressed in FONT UNITS, a.k.a. EM
503  * units.
504  *
505  * Input : face The given face handle.
506  * first Index of first glyph in table.
507  * last Index of last glyph in table.
508  *
509  * leftBearings A pointer to an array of TT_Shorts where the
510  * left side bearings for the glyphs 'first'
511  * to 'last' will be returned. If these metrics
512  * don't interest you, simply set it to NULL.
513  *
514  * widths A pointer to an array of TT_UShorts
515  * where the advance widths for the glyphs
516  * 'first' to 'last' will be returned. If these
517  * metrics don't interest you, simply set it
518  * to NULL.
519  *
520  * topBearings A pointer to an array of TT_Shorts where the
521  * top side bearings for the glyphs 'first'
522  * to 'last' will be returned. If these metrics
523  * don't interest you, simply set it to NULL.
524  *
525  * heights A pointer to an array of TT_UShorts
526  * where the advance heights for the glyphs
527  * 'first' to 'last' will be returned. If these
528  * metrics don't interest you, simply set it
529  * to NULL.
530  *
531  * Output : Error code.
532  *
533  * IMPORTANT NOTE :
534  *
535  * As vertical metrics are optional in a TrueType font, this
536  * function will return an error ( TT_Err_No_Vertical_Data )
537  * whenever this function is called on such a face with non-NULL
538  * 'topBearings' or 'heights' arguments.
539  *
540  * When a font has no vertical data, the 'vertical' field in its
541  * properties structure is set to NULL.
542  *
543  * MT-Note : YES! Reads only permanent data.
544  *
545  ******************************************************************/
546 
549  TT_UShort firstGlyph,
550  TT_UShort lastGlyph,
551  TT_Short* leftBearings,
552  TT_UShort* widths,
553  TT_Short* topBearings,
554  TT_UShort* heights )
555  {
556  PFace _face = HANDLE_Face( face );
557  UInt num;
558 
559 
560  if ( !_face )
562 
563  /* Check the glyph range */
564  if ( lastGlyph >= _face->numGlyphs || firstGlyph > lastGlyph )
566 
567  num = lastGlyph - firstGlyph; /* number of elements-1 in each array */
568 
569  /* store the left side bearings and advance widths first */
570  {
571  UShort n;
572  Short left_bearing;
573  UShort advance_width;
574 
575 
576  for ( n = 0; n <= num; n++ )
577  {
579  firstGlyph + n, &left_bearing, &advance_width );
580 
581  if ( leftBearings ) leftBearings[n] = left_bearing;
582  if ( widths ) widths[n] = advance_width;
583  }
584  }
585 
586  /* check for vertical data if topBearings or heights is non-NULL */
587  if ( !topBearings && !heights )
588  return TT_Err_Ok;
589 
590  if ( !_face->verticalInfo )
592 
593  /* store the top side bearings */
594  {
595  UShort n;
596  Short top_bearing;
597  UShort advance_height;
598 
599  for ( n = 0; n <= num; n++ )
600  {
602  firstGlyph + n, &top_bearing, &advance_height );
603 
604  if ( topBearings ) topBearings[n] = top_bearing;
605  if ( heights ) heights[n] = advance_height;
606  }
607  }
608 
609  return TT_Err_Ok;
610  }
611 
612 
613 /*******************************************************************
614  *
615  * Function : TT_Flush_Face
616  *
617  * Description : This function is used to close an active face's
618  * file handle or descriptor. This is useful to save
619  * system resources, if your application uses tons
620  * of fonts.
621  *
622  * Input : face the given face handle
623  *
624  * Output : Error code.
625  *
626  * MT-Note : YES! (If ttfile is.)
627  *
628  ******************************************************************/
629 
632  {
633  PFace faze = HANDLE_Face( face );
634 
635 
636  if ( !faze )
638  else
639  return TT_Flush_Stream( &faze->stream );
640  }
641 
642 
643 /*******************************************************************
644  *
645  * Function : TT_Close_Face
646  *
647  * Description : Closes an opened face object. This function
648  * will destroy all objects associated to the
649  * face, except the glyphs.
650  *
651  * Input : face the given face handle
652  *
653  * Output : Error code.
654  *
655  * NOTE : The handle is set to NULL on exit.
656  *
657  * MT-Note : YES!
658  *
659  ******************************************************************/
660 
663  {
664  PFace _face = HANDLE_Face( face );
665 
666 
667  if ( !_face )
669 
670  TT_Close_Stream( &_face->stream );
671 
672  /* delete the face object -- this is thread-safe */
673  return CACHE_Done( _face->engine->objs_face_cache, _face );
674  }
675 
676 
677 /*******************************************************************
678  *
679  * Function : TT_New_Instance
680  *
681  * Description : Creates a new instance from a given face.
682  *
683  * Input : face parent face handle
684  * instance address of instance handle
685  *
686  * Output : Error code.
687  *
688  * Note : The handle is set to NULL in case of failure.
689  *
690  * MT-Note : YES!
691  *
692  ******************************************************************/
693 
697  {
698  TT_Error error;
699  PFace _face = HANDLE_Face( face );
700  PInstance _ins;
701 
702 
703  if ( !_face )
705 
706  /* get a new instance from the face's cache -- this is thread-safe */
707  error = CACHE_New( &_face->instances, _ins, _face );
708 
709  HANDLE_Set( *instance, _ins );
710 
711  if ( !error )
712  {
713  error = Instance_Init( _ins );
714  if ( error )
715  {
716  HANDLE_Set( *instance, NULL );
717  CACHE_Done( &_face->instances, _ins );
718  }
719  }
720 
721  return error;
722  }
723 
724 
725 /*******************************************************************
726  *
727  * Function : TT_Set_Instance_Resolutions
728  *
729  * Description : Resets an instance to a new device resolution.
730  *
731  * Input : instance the instance handle
732  * xResolution new horizontal device resolution in dpi
733  * yResolution new vertical device resolution in dpi
734  *
735  * Output : Error code.
736  *
737  * Note : There is no check for overflow; with other words,
738  * the product of glyph dimensions times the device
739  * resolutions must have reasonable values.
740  *
741  * MT-Note : You should set the charsize or pixel size immediately
742  * after this call in multi-threaded programs. This will
743  * force the instance data to be resetted. Otherwise, you
744  * may encounter corruption when loading two glyphs from
745  * the same instance concurrently!
746  *
747  * Happily, 99.99% will do just that :-)
748  *
749  ******************************************************************/
750 
753  TT_UShort xResolution,
754  TT_UShort yResolution )
755  {
757 
758 
759  if ( !ins )
761 
762  ins->metrics.x_resolution = xResolution;
763  ins->metrics.y_resolution = yResolution;
764  ins->valid = FALSE;
765 
766  /* In the case of a thread-safe implementation, we immediately */
767  /* call Instance_Reset in order to change the instance's variable */
768 
769  /* In the case of a non-threaded build, we simply set the 'valid' */
770  /* flag to FALSE, which will force the instance's resetting at */
771  /* the next glyph loading */
772 
773  return TT_Err_Ok;
774  }
775 
776 
777 /*******************************************************************
778  *
779  * Function : TT_Set_Instance_CharSizes
780  *
781  * Description : Resets an instance to new point size.
782  *
783  * Input : instance the instance handle
784  * charWidth the new width in 26.6 char points
785  * charHeight the new height in 26.6 char points
786  *
787  * Output : Error code.
788  *
789  * Note : There is no check for overflow; with other words,
790  * the product of glyph dimensions times the device
791  * resolution must have reasonable values.
792  *
793  * MT-Note : NO! This should be called only when setting/resetting
794  * instances, so there is no need to protect.
795  *
796  ******************************************************************/
797 
800  TT_F26Dot6 charWidth,
801  TT_F26Dot6 charHeight )
802  {
804 
805 
806  if ( !ins )
808 
809  if ( charWidth < 1 * 64 )
810  charWidth = 1 * 64;
811 
812  if ( charHeight < 1 * 64 )
813  charHeight = 1 * 64;
814 
815  ins->metrics.x_scale1 = ( charWidth * ins->metrics.x_resolution ) / 72;
816  ins->metrics.x_scale2 = ins->owner->fontHeader.Units_Per_EM;
817 
818  ins->metrics.y_scale1 = ( charHeight * ins->metrics.y_resolution ) / 72;
819  ins->metrics.y_scale2 = ins->owner->fontHeader.Units_Per_EM;
820 
821  if ( ins->owner->fontHeader.Flags & 8 )
822  {
823  ins->metrics.x_scale1 = (ins->metrics.x_scale1+32) & -64;
824  ins->metrics.y_scale1 = (ins->metrics.y_scale1+32) & -64;
825  }
826 
827  ins->metrics.x_ppem = ins->metrics.x_scale1 / 64;
828  ins->metrics.y_ppem = ins->metrics.y_scale1 / 64;
829 
830  if ( charWidth > charHeight )
831  ins->metrics.pointSize = charWidth;
832  else
833  ins->metrics.pointSize = charHeight;
834 
835  ins->valid = FALSE;
836 
837  return Instance_Reset( ins );
838  }
839 
840 
841 /*******************************************************************
842  *
843  * Function : TT_Set_Instance_CharSize
844  *
845  * Description : Resets an instance to new point size.
846  *
847  * Input : instance the instance handle
848  * charSize the new character size in 26.6 char points
849  *
850  * Output : Error code.
851  *
852  * Note : There is no check for overflow; with other words,
853  * the product of glyph dimensions times the device
854  * resolution must have reasonable values.
855  *
856  * MT-Note : NO! This should be called only when setting/resetting
857  * instances, so there is no need to protect.
858  *
859  ******************************************************************/
860 
863  TT_F26Dot6 charSize )
864  {
865  return TT_Set_Instance_CharSizes( instance, charSize, charSize );
866  }
867 
868 
869 /*******************************************************************
870  *
871  * Function : TT_Set_Instance_PixelSizes
872  *
873  * Description : Resets an instance to new pixel sizes
874  *
875  * Input : instance the instance handle
876  * pixelWidth the new width in pixels
877  * pixelHeight the new height in pixels
878  *
879  * Output : Error code.
880  *
881  * Note : There is no check for overflow; with other words,
882  * the product of glyph dimensions times the device
883  * resolution must have reasonable values.
884  *
885  * MT-Note : NO! This should be called only when setting/resetting
886  * instances, so there is no need to protect.
887  *
888  ******************************************************************/
889 
892  TT_UShort pixelWidth,
893  TT_UShort pixelHeight,
894  TT_F26Dot6 pointSize )
895  {
897 
898  if ( !ins )
900 
901  if ( pixelWidth < 1 ) pixelWidth = 1;
902  if ( pixelHeight < 1 ) pixelHeight = 1;
903 
904  ins->metrics.x_ppem = pixelWidth;
905  ins->metrics.y_ppem = pixelHeight;
906  ins->metrics.pointSize = pointSize;
907 
908  ins->metrics.x_scale1 = ins->metrics.x_ppem * 64L;
909  ins->metrics.x_scale2 = ins->owner->fontHeader.Units_Per_EM;
910  ins->metrics.y_scale1 = ins->metrics.y_ppem * 64L;
911  ins->metrics.y_scale2 = ins->owner->fontHeader.Units_Per_EM;
912 
913  ins->valid = FALSE;
914 
915  return Instance_Reset( ins );
916  }
917 
918 
919 /*******************************************************************
920  *
921  * Function : TT_Set_Instance_Transform_Flags
922  *
923  * Description : Informs the interpreter about the transformations
924  * that will be applied to the rendered glyphs.
925  *
926  * Input : instance the instance handle
927  * rotated set to TRUE if the glyph are rotated
928  * stretched set to TRUE if the glyph are stretched
929  *
930  * Output : Error code.
931  *
932  * Note : This function is deprecated! It's much better to
933  * control hinting manually when calling TT_Load_Glyph
934  * than relying on the font programs...
935  *
936  * Never use it, unless calling for trouble ;-)
937  *
938  * MT-Note : NO! This should be called only when setting/resetting
939  * instances, so there is no need to protect.
940  *
941  ******************************************************************/
942 
945  TT_Bool rotated,
946  TT_Bool stretched )
947  {
949 
950 
951  if ( !ins )
953 
954  ins->metrics.rotated = rotated;
955  ins->metrics.stretched = stretched;
956  ins->valid = FALSE;
957 
958  return TT_Err_Ok;
959  }
960 
961 
962 /*******************************************************************
963  *
964  * Function : TT_Get_Instance_Metrics
965  *
966  * Description : Returns instance metrics.
967  *
968  * Input : instance the instance handle
969  * metrics address of target instance metrics record
970  *
971  * Output : Error code.
972  *
973  * MT-Note : YES! Reads only semi-permanent data.
974  *
975  ******************************************************************/
976 
980  {
982 
983 
984  if ( !ins )
986 
987  if ( !ins->valid )
988  Instance_Reset( ins );
989 
990  metrics->pointSize = ins->metrics.pointSize;
991 
992  metrics->x_scale = TT_MulDiv( 0x10000,
993  ins->metrics.x_scale1,
994  ins->metrics.x_scale2 );
995 
996  metrics->y_scale = TT_MulDiv( 0x10000,
997  ins->metrics.y_scale1,
998  ins->metrics.y_scale2 );
999 
1000  metrics->x_resolution = ins->metrics.x_resolution;
1001  metrics->y_resolution = ins->metrics.y_resolution;
1002  metrics->x_ppem = ins->metrics.x_ppem;
1003  metrics->y_ppem = ins->metrics.y_ppem;
1004 
1005  return TT_Err_Ok;
1006  }
1007 
1008 
1009 /*******************************************************************
1010  *
1011  * Function : TT_Set_Instance_Pointer
1012  *
1013  * Description : Each instance has one pointer, which use is
1014  * reserved to client applications. The TrueType
1015  * engine never accesses or uses this field.
1016  *
1017  * This function is used to set the pointer.
1018  *
1019  * Input : face the given face handle
1020  * data the generic pointer value
1021  *
1022  * Output : Error code.
1023  *
1024  * MT-Note : NO!
1025  *
1026  ******************************************************************/
1027 
1030  void* data )
1031  {
1033 
1034 
1035  if ( !ins )
1037  else
1038  ins->generic = data;
1039 
1040  return TT_Err_Ok;
1041  }
1042 
1043 
1044 /*******************************************************************
1045  *
1046  * Function : TT_Get_Instance_Pointer
1047  *
1048  * Description : Each instance has one pointer, which use is
1049  * reserved to client applications. The TrueType
1050  * engine never accesses or uses this field.
1051  *
1052  * This function is used to read the pointer.
1053  *
1054  * Input : face the given face handle
1055  * data the generic pointer value
1056  *
1057  * Output : Error code.
1058  *
1059  * MT-Safe : NO!
1060  *
1061  ******************************************************************/
1062 
1063  FT_EXPORT_FUNC( void* )
1065  {
1067 
1068 
1069  if ( !ins )
1070  return NULL;
1071  else
1072  return ins->generic;
1073  }
1074 
1075 
1076 /*******************************************************************
1077  *
1078  * Function : TT_Done_Instance
1079  *
1080  * Description : Closes a given instance.
1081  *
1082  * Input : instance address of instance handle
1083  *
1084  * Output : Error code.
1085  *
1086  * MT-Safe : YES!
1087  *
1088  ******************************************************************/
1089 
1092  {
1094 
1095 
1096  if ( !ins )
1098 
1099  /* delete the instance -- this is thread-safe */
1100  return CACHE_Done( &ins->owner->instances, ins );
1101  }
1102 
1103 
1104 /*******************************************************************
1105  *
1106  * Function : TT_New_Glyph
1107  *
1108  * Description : Creates a new glyph object related to a given
1109  * face.
1110  *
1111  * Input : face the face handle
1112  * glyph address of target glyph handle
1113  *
1114  * Output : Error code.
1115  *
1116  * MT-Safe : YES!
1117  *
1118  ******************************************************************/
1119 
1122  TT_Glyph* glyph )
1123  {
1124  TT_Error error;
1125  PFace _face = HANDLE_Face( face );
1126  PGlyph _glyph;
1127 
1128 
1129  if ( !_face )
1131 
1132  /* get a new glyph from the face's cache -- this is thread-safe */
1133  error = CACHE_New( &_face->glyphs, _glyph, _face );
1134 
1135  HANDLE_Set( *glyph, _glyph );
1136 
1137  return error;
1138  }
1139 
1140 
1141 /*******************************************************************
1142  *
1143  * Function : TT_Done_Glyph
1144  *
1145  * Description : Destroys a given glyph object.
1146  *
1147  * Input : glyph the glyph handle
1148  *
1149  * Output : Error code.
1150  *
1151  * MT-Safe : YES!
1152  *
1153  ******************************************************************/
1154 
1157  {
1158  PGlyph _glyph = HANDLE_Glyph( glyph );
1159 
1160 
1161  if ( !_glyph )
1163 
1164  /* delete the engine -- this is thread-safe */
1165  return CACHE_Done( &_glyph->face->glyphs, _glyph );
1166  }
1167 
1168 
1169 /*******************************************************************
1170  *
1171  * Function : TT_Load_Glyph
1172  *
1173  * Description : Loads a glyph.
1174  *
1175  * Input : instance the instance handle
1176  * glyph the glyph handle
1177  * glyphIndex the glyph index
1178  * loadFlags flags controlling how to load the glyph
1179  * (none, scaled, hinted, both)
1180  *
1181  * Output : Error code.
1182  *
1183  * MT-Safe : YES!
1184  *
1185  ******************************************************************/
1186 
1189  TT_Glyph glyph,
1190  TT_UShort glyphIndex,
1191  TT_UShort loadFlags )
1192  {
1193  PInstance _ins;
1194  PGlyph _glyph;
1195  TT_Error error;
1196 
1197 
1198  _ins = HANDLE_Instance( instance );
1199 
1200  if ( !_ins )
1201  loadFlags &= ~(TTLOAD_SCALE_GLYPH | TTLOAD_HINT_GLYPH);
1202 
1203  if ( (loadFlags & TTLOAD_SCALE_GLYPH) == 0 )
1204  _ins = 0;
1205 
1206  _glyph = HANDLE_Glyph( glyph );
1207  if ( !_glyph )
1209 
1210  if ( _ins )
1211  {
1212  if ( _ins->owner != _glyph->face )
1214 
1215  if ( !_ins->valid )
1216  {
1217  /* This code can only be called in non thread-safe builds */
1218  error = Instance_Reset( _ins );
1219  if ( error )
1220  return error;
1221  }
1222  }
1223 
1224  return Load_TrueType_Glyph( _ins, _glyph, glyphIndex, loadFlags );
1225  }
1226 
1227 
1228 /*******************************************************************
1229  *
1230  * Function : TT_Get_Glyph_Outline
1231  *
1232  * Description : Returns the glyph's outline data.
1233  *
1234  * Input : glyph the glyph handle
1235  * outline address where the glyph outline will be returned
1236  *
1237  * Output : Error code.
1238  *
1239  * MT-Safe : YES! Reads only semi-permanent data.
1240  *
1241  ******************************************************************/
1242 
1245  TT_Outline* outline )
1246  {
1247  PGlyph _glyph = HANDLE_Glyph( glyph );
1248 
1249 
1250  if ( !_glyph )
1252 
1253  *outline = _glyph->outline;
1254  outline->owner = FALSE;
1255 
1256  return TT_Err_Ok;
1257  }
1258 
1259 
1260 /*******************************************************************
1261  *
1262  * Function : TT_Get_Glyph_Metrics
1263  *
1264  * Description : Extracts the glyph's horizontal metrics information.
1265  *
1266  * Input : glyph glyph object handle
1267  * metrics address where metrics will be returned
1268  *
1269  * Output : Error code.
1270  *
1271  * MT-Safe : NO! Glyph containers can't be shared.
1272  *
1273  ******************************************************************/
1274 
1278  {
1279  PGlyph _glyph = HANDLE_Glyph( glyph );
1280 
1281 
1282  if ( !_glyph )
1284 
1285  metrics->bbox = _glyph->metrics.bbox;
1286  metrics->bearingX = _glyph->metrics.horiBearingX;
1287  metrics->bearingY = _glyph->metrics.horiBearingY;
1288  metrics->advance = _glyph->metrics.horiAdvance;
1289 
1290  return TT_Err_Ok;
1291  }
1292 
1293 
1294 /*******************************************************************
1295  *
1296  * Function : TT_Get_Glyph_Big_Metrics
1297  *
1298  * Description : Extracts the glyph's big metrics information.
1299  *
1300  * Input : glyph glyph object handle
1301  * metrics address where big metrics will be returned
1302  *
1303  * Output : Error code.
1304  *
1305  * MT-Safe : NO! Glyph containers can't be shared.
1306  *
1307  ******************************************************************/
1308 
1312  {
1313  PGlyph _glyph = HANDLE_Glyph( glyph );
1314 
1315 
1316  if ( !_glyph )
1318 
1319  *metrics = _glyph->metrics;
1320 
1321  return TT_Err_Ok;
1322  }
1323 
1324 
1325 /*******************************************************************
1326  *
1327  * Function : TT_Get_Glyph_Bitmap
1328  *
1329  * Description : Produces a bitmap from a glyph outline.
1330  *
1331  * Input : glyph the glyph container's handle
1332  * bitmap target bitmap description block
1333  * xOffset x offset in fractional pixels (26.6 format)
1334  * yOffset y offset in fractional pixels (26.6 format)
1335  *
1336  * Output : Error code.
1337  *
1338  * Note : Only use integer pixel offsets if you want to preserve
1339  * the fine hints applied to the outline. This means that
1340  * xOffset and yOffset must be multiples of 64!
1341  *
1342  * MT-Safe : NO! Glyph containers can't be shared.
1343  *
1344  ******************************************************************/
1345 
1349  TT_F26Dot6 xOffset,
1350  TT_F26Dot6 yOffset )
1351  {
1352  PEngine_Instance _engine;
1353  TT_Engine engine;
1354  TT_Error error;
1355  PGlyph _glyph = HANDLE_Glyph( glyph );
1356 
1358 
1359 
1360  if ( !_glyph )
1362 
1363  _engine = _glyph->face->engine;
1364  HANDLE_Set( engine, _engine );
1365 
1366  outline = _glyph->outline;
1367  /* XXX : For now, use only dropout mode 2 */
1368  /* outline.dropout_mode = _glyph->scan_type; */
1369  outline.dropout_mode = 2;
1370 
1371  TT_Translate_Outline( &outline, xOffset, yOffset );
1373  TT_Translate_Outline( &outline, -xOffset, -yOffset );
1374 
1375  return error;
1376  }
1377 
1378 
1379 #ifdef TT_CONFIG_OPTION_GRAY_SCALING
1380 
1381 /*******************************************************************
1382  *
1383  * Function : TT_Get_Glyph_Pixmap
1384  *
1385  * Description : Produces a grayscaled pixmap from a glyph
1386  * outline.
1387  *
1388  * Input : glyph the glyph container's handle
1389  * pixmap target pixmap description block
1390  * xOffset x offset in fractional pixels (26.6 format)
1391  * yOffset y offset in fractional pixels (26.6 format)
1392  *
1393  * Output : Error code.
1394  *
1395  * Note : Only use integer pixel offsets to preserve the fine
1396  * hinting of the glyph and the 'correct' anti-aliasing
1397  * (where vertical and horizontal stems aren't grayed).
1398  * This means that xOffset and yOffset must be multiples
1399  * of 64!
1400  *
1401  * You can experiment with offsets of +32 to get 'blurred'
1402  * versions of the glyphs (a nice effect at large sizes that
1403  * some graphic designers may appreciate :)
1404  *
1405  * MT-Safe : NO! Glyph containers can't be shared.
1406  *
1407  ******************************************************************/
1408 
1411  TT_Raster_Map* pixmap,
1412  TT_F26Dot6 xOffset,
1413  TT_F26Dot6 yOffset )
1414  {
1415  PEngine_Instance _engine;
1416  TT_Engine engine;
1417  TT_Error error;
1418  PGlyph _glyph = HANDLE_Glyph( glyph );
1419 
1421 
1422 
1423  if ( !_glyph )
1425 
1426  _engine = _glyph->face->engine;
1427  HANDLE_Set(engine,_engine);
1428 
1429  outline = _glyph->outline;
1430  /* XXX : For now, use only dropout mode 2 */
1431  /* outline.dropout_mode = _glyph->scan_type; */
1432  outline.dropout_mode = 2;
1433 
1434  TT_Translate_Outline( &outline, xOffset, yOffset );
1435  error = TT_Get_Outline_Pixmap( engine, &outline, pixmap );
1436  TT_Translate_Outline( &outline, -xOffset, -yOffset );
1437 
1438  return error;
1439  }
1440 
1441 #endif /* TT_CONFIG_OPTION_GRAY_SCALING */
1442 
1443 
1445  = { 0, 0, NULL, NULL, NULL, 0, 0, 0, 0 };
1446 
1447 
1448 /*******************************************************************
1449  *
1450  * Function : TT_New_Outline
1451  *
1452  * Description : Creates a new TrueType outline, reserving
1453  * array space for a given number of points and
1454  * contours.
1455  *
1456  * Input : numPoints number of points
1457  * numContours number of contours
1458  * outline address of target outline structure
1459  *
1460  * Output : Error code
1461  *
1462  * MT-Safe : YES!
1463  *
1464  ******************************************************************/
1465 
1468  TT_Short numContours,
1469  TT_Outline* outline )
1470  {
1471  TT_Error error;
1472 
1473 
1474  if ( !outline )
1475  return TT_Err_Invalid_Argument;
1476 
1477  *outline = null_outline;
1478 
1479  if ( ALLOC( outline->points, numPoints*2*sizeof ( TT_F26Dot6 ) ) ||
1480  ALLOC( outline->flags, numPoints *sizeof ( Byte ) ) ||
1481  ALLOC( outline->contours, numContours*sizeof ( UShort ) ) )
1482  goto Fail;
1483 
1484  outline->n_points = numPoints;
1485  outline->n_contours = numContours;
1486  outline->owner = TRUE;
1487  return TT_Err_Ok;
1488 
1489  Fail:
1490  outline->owner = TRUE;
1492  return error;
1493  }
1494 
1495 
1496 /*******************************************************************
1497  *
1498  * Function : TT_Done_Outline
1499  *
1500  * Description : Deletes an outline created through TT_New_Outline().
1501  * Calling this function for outlines returned
1502  * by TT_Get_Glyph_Outline() yields an error.
1503  *
1504  * Input : outline address of outline
1505  *
1506  * Output : Error code.
1507  *
1508  * MT-Safe : YES!
1509  *
1510  ******************************************************************/
1511 
1514  {
1515  if ( outline )
1516  {
1517  if ( outline->owner )
1518  {
1519  FREE( outline->points );
1520  FREE( outline->flags );
1521  FREE( outline->contours );
1522  }
1523  *outline = null_outline;
1524  return TT_Err_Ok;
1525  }
1526  else
1527  return TT_Err_Invalid_Argument;
1528  }
1529 
1530 
1531 /*******************************************************************
1532  *
1533  * Function : TT_Get_Outline_Bitmap
1534  *
1535  * Description : Render a TrueType outline into a bitmap.
1536  * Note that the bitmap must be created by the caller.
1537  *
1538  * Input : outline the outline to render
1539  * bitmap the target bitmap
1540  *
1541  * Output : Error code.
1542  *
1543  * MT-Safe : YES!
1544  *
1545  ******************************************************************/
1546 
1551  {
1552  PEngine_Instance _engine = HANDLE_Engine( engine );
1553  TT_Error error;
1554 
1555 
1556  if ( !_engine )
1557  return TT_Err_Invalid_Engine;
1558 
1559  if ( !outline || !bitmap )
1560  return TT_Err_Invalid_Argument;
1561 
1562  MUTEX_Lock( _engine->raster_lock );
1564  MUTEX_Release( _engine->raster_lock );
1565 
1566  return error;
1567  }
1568 
1569 
1570 #ifdef TT_CONFIG_OPTION_GRAY_SCALING
1571 
1572 /*******************************************************************
1573  *
1574  * Function : TT_Get_Outline_Pixmap
1575  *
1576  * Description : Render a TrueType outline into a pixmap.
1577  * Note that the pixmap must be created by the caller.
1578  *
1579  * Input : outline the outline to render
1580  * pixmap the target pixmap
1581  *
1582  * Output : Error code
1583  *
1584  * MT-Safe : YES!
1585  *
1586  ******************************************************************/
1587 
1591  TT_Raster_Map* pixmap )
1592  {
1593  PEngine_Instance _engine = HANDLE_Engine( engine );
1594  TT_Error error;
1595 
1596 
1597  if ( !_engine )
1598  return TT_Err_Invalid_Engine;
1599 
1600  if ( !outline || !pixmap )
1601  return TT_Err_Invalid_Argument;
1602 
1603  MUTEX_Lock( _engine->raster_lock );
1604  error = RENDER_Gray_Glyph( outline, pixmap, _engine->raster_palette );
1605  MUTEX_Release( _engine->raster_lock );
1606  return error;
1607  }
1608 
1609 #endif /* TT_CONFIG_OPTION_GRAY_SCALING */
1610 
1611 
1612 /*******************************************************************
1613  *
1614  * Function : TT_Copy_Outline
1615  *
1616  * Description : Copy an outline into another. The source and
1617  * target outlines must have the same points and
1618  * contours numbers.
1619  *
1620  * Input : source address of source outline
1621  * target address of target outline
1622  *
1623  * Output : Error code
1624  *
1625  * Note : This function doesn't touch the target outline's 'owner'
1626  * field.
1627  *
1628  * MT-Safe : YES!
1629  *
1630  ******************************************************************/
1631 
1634  TT_Outline* target )
1635  {
1636  if ( !source || !target ||
1637  source->n_points != target->n_points ||
1638  source->n_contours != target->n_contours )
1639  return TT_Err_Invalid_Argument;
1640 
1641  MEM_Copy( target->points, source->points,
1642  source->n_points * 2 * sizeof ( TT_F26Dot6 ) );
1643 
1644  MEM_Copy( target->flags, source->flags,
1645  source->n_points * sizeof ( Byte ) );
1646 
1647  MEM_Copy( target->contours, source->contours,
1648  source->n_contours * sizeof ( Short ) );
1649 
1650  target->high_precision = source->high_precision;
1651  target->second_pass = target->second_pass;
1652  target->dropout_mode = source->dropout_mode;
1653 
1654  return TT_Err_Ok;
1655  }
1656 
1657 
1658 /*******************************************************************
1659  *
1660  * Function : TT_Transform_Outline
1661  *
1662  * Description : Applies a simple transformation to an outline.
1663  *
1664  * Input : outline the glyph's outline. Can be extracted
1665  * from a glyph container through
1666  * TT_Get_Glyph_Outline().
1667  *
1668  * matrix simple matrix with 16.16 fixed floats
1669  *
1670  * Output : Error code (always TT_Err_Ok).
1671  *
1672  * MT-Safe : YES!
1673  *
1674  ******************************************************************/
1675 
1676  FT_EXPORT_FUNC( void )
1678  TT_Matrix* matrix )
1679  {
1680  UShort n;
1681  TT_F26Dot6 x, y;
1682  TT_Vector* vec;
1683 
1684 
1685  vec = outline->points;
1686  for ( n = 0; n < outline->n_points; n++ )
1687  {
1688  x = TT_MulFix( vec->x, matrix->xx ) +
1689  TT_MulFix( vec->y, matrix->xy );
1690 
1691  y = TT_MulFix( vec->x, matrix->yx ) +
1692  TT_MulFix( vec->y, matrix->yy );
1693 
1694  vec->x = x;
1695  vec->y = y;
1696  vec++;
1697  }
1698  }
1699 
1700 
1701 /*******************************************************************
1702  *
1703  * Function : TT_Transform_Vector
1704  *
1705  * Description : Apply a simple transform to a vector
1706  *
1707  * Input : x, y the vector.
1708  *
1709  * matrix simple matrix with 16.16 fixed floats
1710  *
1711  * Output : None.
1712  *
1713  * MT-Safe : YES!
1714  *
1715  ******************************************************************/
1716 
1717  FT_EXPORT_FUNC( void )
1719  TT_F26Dot6* y,
1720  TT_Matrix* matrix )
1721  {
1722  TT_F26Dot6 xz, yz;
1723 
1724 
1725  xz = TT_MulFix( *x, matrix->xx ) +
1726  TT_MulFix( *y, matrix->xy );
1727 
1728  yz = TT_MulFix( *x, matrix->yx ) +
1729  TT_MulFix( *y, matrix->yy );
1730 
1731  *x = xz;
1732  *y = yz;
1733  }
1734 
1735 
1736 /*******************************************************************
1737  *
1738  * Function : TT_Translate_Outline
1739  *
1740  * Description : Applies a simple translation.
1741  *
1742  * Input : outline no comment :)
1743  * xOffset
1744  * yOffset
1745  *
1746  * Output : Error code.
1747  *
1748  * MT-Safe : YES!
1749  *
1750  ******************************************************************/
1751 
1752  FT_EXPORT_FUNC( void )
1754  TT_F26Dot6 xOffset,
1755  TT_F26Dot6 yOffset )
1756  {
1757  UShort n;
1759 
1760 
1761  for ( n = 0; n < outline->n_points; n++ )
1762  {
1763  vec->x += xOffset;
1764  vec->y += yOffset;
1765  vec++;
1766  }
1767  }
1768 
1769 
1770 /*******************************************************************
1771  *
1772  * Function : TT_Get_Outline_BBox
1773  *
1774  * Description : Returns an outline's bounding box.
1775  *
1776  * Input : outline no comment :)
1777  * bbox address where the bounding box is returned
1778  *
1779  * Output : Error code.
1780  *
1781  * MT-Safe : YES!
1782  *
1783  ******************************************************************/
1784 
1787  TT_BBox* bbox )
1788  {
1789  TT_F26Dot6 x, y;
1790  UShort k;
1791 
1792 
1793  if ( outline && bbox )
1794  {
1795  if ( outline->n_points == 0 )
1796  {
1797  bbox->xMin = 0;
1798  bbox->yMin = 0;
1799  bbox->xMax = 0;
1800  bbox->yMax = 0;
1801  }
1802  else
1803  {
1805 
1806  bbox->xMin = bbox->xMax = vec->x;
1807  bbox->yMin = bbox->yMax = vec->y;
1808  vec++;
1809 
1810  for ( k = 1; k < outline->n_points; k++ )
1811  {
1812  x = vec->x;
1813  if ( x < bbox->xMin ) bbox->xMin = x;
1814  if ( x > bbox->xMax ) bbox->xMax = x;
1815  y = vec->y;
1816  if ( y < bbox->yMin ) bbox->yMin = y;
1817  if ( y > bbox->yMax ) bbox->yMax = y;
1818  vec++;
1819  }
1820  }
1821  return TT_Err_Ok;
1822  }
1823  else
1824  return TT_Err_Invalid_Argument;
1825  }
1826 
1827 
1828 
1829  /* ----------------- character mappings support ------------- */
1830 
1831 /*******************************************************************
1832  *
1833  * Function : TT_Get_CharMap_Count
1834  *
1835  * Description : Returns the number of charmaps in a given face.
1836  *
1837  * Input : face face object handle
1838  *
1839  * Output : Number of tables. -1 in case of error (bad handle).
1840  *
1841  * Note : DON'T USE THIS FUNCTION! IT HAS BEEN DEPRECATED!
1842  *
1843  * It is retained for backwards compatibility only and will
1844  * fail on 16bit systems.
1845  *
1846  * MT-Safe : YES !
1847  *
1848  ******************************************************************/
1849 
1850  FT_EXPORT_FUNC( int )
1852  {
1853  PFace faze = HANDLE_Face( face );
1854 
1855  return ( faze ? faze->numCMaps : -1 );
1856  }
1857 
1858 
1859 /*******************************************************************
1860  *
1861  * Function : TT_Get_CharMap_ID
1862  *
1863  * Description : Returns the ID of a given charmap.
1864  *
1865  * Input : face face object handle
1866  * charmapIndex index of charmap in directory
1867  * platformID address of returned platform ID
1868  * encodingID address of returned encoding ID
1869  *
1870  * Output : error code
1871  *
1872  * MT-Safe : YES !
1873  *
1874  ******************************************************************/
1875 
1878  TT_UShort charmapIndex,
1879  TT_UShort* platformID,
1880  TT_UShort* encodingID )
1881  {
1882  PCMapTable cmap;
1883  PFace faze = HANDLE_Face( face );
1884 
1885 
1886  if ( !faze )
1888 
1889  if ( charmapIndex >= faze->numCMaps )
1890  return TT_Err_Invalid_Argument;
1891 
1892  cmap = faze->cMaps + charmapIndex;
1893 
1894  *platformID = cmap->platformID;
1895  *encodingID = cmap->platformEncodingID;
1896 
1897  return TT_Err_Ok;
1898  }
1899 
1900 
1901 /*******************************************************************
1902  *
1903  * Function : TT_Get_CharMap
1904  *
1905  * Description : Looks up a charmap.
1906  *
1907  * Input : face face object handle
1908  * charmapIndex index of charmap in directory
1909  * charMap address of returned charmap handle
1910  *
1911  * Output : Error code.
1912  *
1913  * MT-Safe : YES!
1914  *
1915  ******************************************************************/
1916 
1919  TT_UShort charmapIndex,
1920  TT_CharMap* charMap )
1921  {
1922  TT_Error error;
1923  TT_Stream stream;
1924  PCMapTable cmap;
1925  PFace faze = HANDLE_Face( face );
1926 
1927 
1928  if ( !faze )
1930 
1931  if ( charmapIndex >= faze->numCMaps )
1932  return TT_Err_Invalid_Argument;
1933 
1934  cmap = faze->cMaps + charmapIndex;
1935 
1936  /* Load table if needed */
1937  error = TT_Err_Ok;
1938 
1939  /* MT-NOTE: We're modifying the face object, so protect it. */
1940  MUTEX_Lock( faze->lock );
1941 
1942  if ( !cmap->loaded )
1943  {
1944  (void)USE_Stream( faze->stream, stream );
1945  if ( !error )
1946  {
1947  error = CharMap_Load( cmap, stream );
1948  DONE_Stream( stream );
1949  }
1950 
1951  if ( error )
1952  cmap = NULL;
1953  else
1954  cmap->loaded = TRUE;
1955  }
1956  MUTEX_Release( faze->lock );
1957 
1958  HANDLE_Set( *charMap, cmap );
1959 
1960  return error;
1961  }
1962 
1963 
1964 /*******************************************************************
1965  *
1966  * Function : TT_Char_Index
1967  *
1968  * Description : Returns the glyph index corresponding to
1969  * a given character code defined for the 'charmap'.
1970  *
1971  * Input : charMap charmap handle
1972  * charcode character code
1973  *
1974  * Output : glyph index.
1975  *
1976  * Notes : Character code 0 is the unknown glyph, which should never
1977  * be displayed.
1978  *
1979  * MT-Safe : YES!
1980  *
1981  ******************************************************************/
1982 
1985  TT_ULong charCode )
1986  {
1987  PCMapTable cmap = HANDLE_CharMap( charMap );
1988 
1989 
1990  if ( !cmap )
1991  return 0; /* we return 0 in case of invalid char map */
1992 
1993  return CharMap_Index( cmap, charCode );
1994  }
1995 
1996 
1997 /*******************************************************************
1998  *
1999  * Function : TT_Get_Name_Count
2000  *
2001  * Description : Returns the number of strings found in the
2002  * name table.
2003  *
2004  * Input : face face handle
2005  *
2006  * Output : number of strings.
2007  *
2008  * Notes : Returns -1 on error (invalid handle).
2009  *
2010  * DON'T USE THIS FUNCTION! IT HAS BEEN DEPRECATED!
2011  *
2012  * It is retained for backwards compatibility only and will
2013  * fail on 16bit systems.
2014  *
2015  * MT-Safe : YES!
2016  *
2017  ******************************************************************/
2018 
2019  FT_EXPORT_FUNC( int )
2021  {
2022  PFace faze = HANDLE_Face( face );
2023 
2024 
2025  if ( !faze )
2026  return -1;
2027 
2028  return faze->nameTable.numNameRecords;
2029  }
2030 
2031 
2032 /*******************************************************************
2033  *
2034  * Function : TT_Get_Name_ID
2035  *
2036  * Description : Returns the IDs of the string number 'nameIndex'
2037  * in the name table of a given face.
2038  *
2039  * Input : face face handle
2040  * nameIndex index of string. First is 0
2041  * platformID addresses of returned IDs
2042  * encodingID
2043  * languageID
2044  * nameID
2045  *
2046  * Output : Error code.
2047  *
2048  * Notes : Some files have a corrupt or unusual name table, with some
2049  * entries having a platformID > 3. These can usually
2050  * be ignored by a client application.
2051  *
2052  * MT-Safe : YES!
2053  *
2054  ******************************************************************/
2055 
2058  TT_UShort nameIndex,
2059  TT_UShort* platformID,
2060  TT_UShort* encodingID,
2061  TT_UShort* languageID,
2062  TT_UShort* nameID )
2063  {
2064  TNameRec* namerec;
2065  PFace faze = HANDLE_Face( face );
2066 
2067 
2068  if ( !faze )
2070 
2071  if ( nameIndex >= faze->nameTable.numNameRecords )
2072  return TT_Err_Invalid_Argument;
2073 
2074  namerec = faze->nameTable.names + nameIndex;
2075 
2076  *platformID = namerec->platformID;
2077  *encodingID = namerec->encodingID;
2078  *languageID = namerec->languageID;
2079  *nameID = namerec->nameID;
2080 
2081  return TT_Err_Ok;
2082  }
2083 
2084 
2085 /*******************************************************************
2086  *
2087  * Function : TT_Get_Name_String
2088  *
2089  * Description : Returns the address and length of a given
2090  * string found in the name table.
2091  *
2092  * Input : face face handle
2093  * nameIndex string index
2094  * stringPtr address of returned pointer to string
2095  * length address of returned string length
2096  *
2097  * Output : Error code.
2098  *
2099  * Notes : If the string's platformID is invalid,
2100  * stringPtr is NULL, and length is 0.
2101  *
2102  * MT-Safe : YES!
2103  *
2104  ******************************************************************/
2105 
2108  TT_UShort nameIndex,
2109  TT_String** stringPtr,
2110  TT_UShort* length )
2111  {
2112  TNameRec* namerec;
2113  PFace faze = HANDLE_Face( face );
2114 
2115 
2116  if ( !faze )
2118 
2119  if ( nameIndex >= faze->nameTable.numNameRecords )
2120  return TT_Err_Invalid_Argument;
2121 
2122  namerec = faze->nameTable.names + nameIndex;
2123 
2124  *stringPtr = (String*)namerec->string;
2125  *length = namerec->stringLength;
2126 
2127  return TT_Err_Ok;
2128  }
2129 
2130 
2131 /*******************************************************************
2132  *
2133  * Function : TT_Get_Font_Data
2134  *
2135  * Description : Loads any font table into client memory.
2136  *
2137  * Input : face Face object to look for.
2138  *
2139  * tag Tag of table to load. Use the value 0 if you
2140  * want to access the whole font file, else set
2141  * this parameter to a valid TrueType table tag
2142  * that you can forge with the MAKE_TT_TAG
2143  * macro.
2144  *
2145  * offset Starting offset in the table (or the file
2146  * if tag == 0).
2147  *
2148  * buffer Address of target buffer
2149  *
2150  * length Address of decision variable:
2151  *
2152  * if length == NULL:
2153  * Load the whole table. Returns an
2154  * error if 'offset' != 0.
2155  *
2156  * if *length == 0 :
2157  * Exit immediately, returning the
2158  * length of the given table, or of
2159  * the font file, depending on the
2160  * value of 'tag'.
2161  *
2162  * if *length != 0 :
2163  * Load the next 'length' bytes of
2164  * table or font, starting at offset
2165  * 'offset' (in table or font too).
2166  *
2167  * Output : Error code.
2168  *
2169  * MT-Safe : YES!
2170  *
2171  ******************************************************************/
2172 
2175  TT_ULong tag,
2176  TT_Long offset,
2177  void* buffer,
2178  TT_Long* length )
2179  {
2180  PFace faze = HANDLE_Face( face );
2181 
2182 
2183  if ( !faze )
2185 
2186  return Load_TrueType_Any( faze, tag, offset, buffer, length );
2187  }
2188 
2189 
2190  /************************ callback definition ******************/
2191 
2192  /* Register a new callback to the TrueType engine -- this should */
2193  /* only be used by higher-level libraries, not typical clients */
2194  /* */
2195  /* This is not part of the current FreeType release, thus */
2196  /* undefined... */
2197 
2198 #if 0
2200  TT_Register_Callback( TT_Engine engine,
2201  int callback_id,
2202  void* callback_ptr )
2203  {
2205 
2206 
2207  if ( !eng )
2208  return TT_Err_Invalid_Argument;
2209 
2210  /* currently, we only support one callback */
2211  if (callback_id != TT_Callback_Glyph_Outline_Load)
2212  return TT_Err_Invalid_Argument;
2213 
2214  eng->glCallback = (TT_Glyph_Loader_Callback)callback_ptr;
2215  return TT_Err_Ok;
2216  }
2217 #endif /* 0 */
2218 
2219 
2220 /* END */
#define n
Definition: t4ht.c:1290
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
#define error(a)
Definition: dviinfo.c:48
struct rect data
Definition: dvipdfm.c:64
static void
Definition: fpif.c:118
#define TT_CONFIG_OPTION_EXTEND_ENGINE
Definition: ft_conf.h:91
#define TT_Err_Invalid_Glyph_Handle
Definition: fterrid.h:41
#define TT_Err_Invalid_Instance_Handle
Definition: fterrid.h:40
#define TT_Err_Invalid_Engine
Definition: fterrid.h:57
#define TT_Err_No_Vertical_Data
Definition: fterrid.h:62
#define TT_Err_Invalid_Argument
Definition: fterrid.h:45
#define TT_Err_Ok
Definition: fterrid.h:34
#define TT_Err_Invalid_Face_Handle
Definition: fterrid.h:39
const unsigned char FREE
Definition: image.cpp:34
long TT_Error
Definition: freetype.h:664
unsigned short TT_UShort
Definition: freetype.h:106
#define TT_FREETYPE_MAJOR
Definition: freetype.h:29
#define TTLOAD_SCALE_GLYPH
Definition: freetype.h:903
#define TT_FREETYPE_MINOR
Definition: freetype.h:30
signed long TT_F26Dot6
Definition: freetype.h:123
unsigned long TT_ULong
Definition: freetype.h:110
signed short TT_Short
Definition: freetype.h:105
signed long TT_Long
Definition: freetype.h:109
int TT_Bool
Definition: freetype.h:95
#define TTLOAD_HINT_GLYPH
Definition: freetype.h:904
char TT_String
Definition: freetype.h:102
char TT_Text
Definition: freetype.h:78
TT_Long TT_MulFix(TT_Long A, TT_Long B)
Definition: ttcalc.c:191
TT_Long TT_MulDiv(TT_Long A, TT_Long B, TT_Long C)
Definition: ttcalc.c:143
static TT_Error CharMap_Load(PCMapTable cmap, TT_Stream input)
Definition: ttcmap.c:48
static UShort CharMap_Index(PCMapTable cmap, ULong charcode)
Definition: ttcmap.c:369
static void TT_Get_Metrics(TT_Horizontal_Header *header, UShort index, Short *bearing, UShort *advance)
Definition: ttgload.c:61
static TT_Error Load_TrueType_Glyph(PInstance instance, PGlyph glyph, UShort glyph_index, UShort load_flags)
Definition: ttgload.c:562
static TT_Error Load_TrueType_Any(PFace face, ULong tag, Long offset, void *buffer, Long *length)
Definition: ttload.c:1555
static TT_Error TTObjs_Done(PEngine_Instance engine)
Definition: ttobjs.c:1485
static TT_Error TTObjs_Init(PEngine_Instance engine)
Definition: ttobjs.c:1428
static TT_Error Instance_Init(PInstance ins)
Definition: ttobjs.c:833
static TT_Error Instance_Reset(PInstance ins)
Definition: ttobjs.c:939
#define HANDLE_Engine(handle)
Definition: tttypes.h:133
#define HANDLE_CharMap(handle)
Definition: tttypes.h:143
#define HANDLE_Face(handle)
Definition: tttypes.h:135
#define HANDLE_Instance(handle)
Definition: tttypes.h:137
#define HANDLE_Glyph(handle)
Definition: tttypes.h:141
#define HANDLE_Set(handle, val)
Definition: tttypes.h:145
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific i
Definition: afcover.h:80
sizeof(AF_ModuleRec)
FT_Vector * vec
Definition: ftbbox.c:469
FT_Face face
Definition: cffdrivr.c:659
#define const
Definition: ftzconf.h:91
unsigned char Byte
Definition: ftzconf.h:219
unsigned short UShort
Definition: ftraster.c:310
unsigned int UInt
Definition: ftraster.c:308
short Short
Definition: ftraster.c:309
kerning y
Definition: ttdriver.c:212
int num
Definition: disdvi.c:621
int major
Definition: pdfcolor.c:526
int minor
Definition: pdfcolor.c:527
string engine
Definition: kpsewhich.c:51
#define input
Definition: cpascal.h:53
#define length(c)
Definition: ctangleboot.c:65
#define target(code, i)
Definition: lpeg.c:1165
float x
Definition: cordic.py:15
int k
Definition: otp-parser.c:70
float ** matrix()
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if
static int offset
Definition: ppmtogif.c:642
struct stream_s stream
Definition: pts_fax.h:93
#define Byte
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78
A string of characters.
Definition: t1part.c:49
Byte raster_palette[5]
Definition: ttengine.h:70
void * objs_face_cache
Definition: ttengine.h:62
TMutex raster_lock
Definition: ttengine.h:68
Definition: ttobjs.h:481
TT_Stream stream
Definition: ttobjs.h:486
void * generic
Definition: ttobjs.h:582
Bool verticalInfo
Definition: ttobjs.h:512
TT_OS2 os2
Definition: ttobjs.h:515
TTTCHeader ttcHeader
Definition: ttobjs.h:492
TName_Table nameTable
Definition: ttobjs.h:521
TT_Vertical_Header verticalHeader
Definition: ttobjs.h:513
TT_Horizontal_Header horizontalHeader
Definition: ttobjs.h:510
UShort maxContours
Definition: ttobjs.h:561
TCache instances
Definition: ttobjs.h:568
UShort numGlyphs
Definition: ttobjs.h:559
PCMapTable cMaps
Definition: ttobjs.h:532
UShort maxPoints
Definition: ttobjs.h:560
TT_Header fontHeader
Definition: ttobjs.h:508
PEngine_Instance engine
Definition: ttobjs.h:483
UShort numCMaps
Definition: ttobjs.h:531
TT_Hdmx hdmx
Definition: ttobjs.h:519
TCache glyphs
Definition: ttobjs.h:569
TMutex lock
Definition: ttobjs.h:489
TT_Postscript postscript
Definition: ttobjs.h:517
TT_Outline outline
Definition: ttobjs.h:768
TT_Big_Glyph_Metrics metrics
Definition: ttobjs.h:767
PFace face
Definition: ttobjs.h:766
PFace owner
Definition: ttobjs.h:595
Bool valid
Definition: ttobjs.h:597
TNameRec * names
Definition: tttables.h:202
UShort numNameRecords
Definition: tttables.h:200
ULong DirCount
Definition: tttables.h:41
TT_UShort num_CharMaps
Definition: freetype.h:601
TT_Hdmx * hdmx
Definition: freetype.h:612
TT_Header * header
Definition: freetype.h:608
TT_ULong num_Faces
Definition: freetype.h:604
TT_Vertical_Header * vertical
Definition: freetype.h:613
TT_UShort max_Contours
Definition: freetype.h:599
TT_UShort num_Names
Definition: freetype.h:602
TT_UShort max_Points
Definition: freetype.h:598
TT_Horizontal_Header * horizontal
Definition: freetype.h:609
TT_Postscript * postscript
Definition: freetype.h:611
TT_UShort num_Glyphs
Definition: freetype.h:597
TT_Short n_contours
Definition: freetype.h:175
TT_Byte * flags
Definition: freetype.h:179
TT_Char dropout_mode
Definition: freetype.h:214
TT_UShort * contours
Definition: freetype.h:180
TT_UShort n_points
Definition: freetype.h:176
TT_Bool owner
Definition: freetype.h:187
TT_Vector * points
Definition: freetype.h:178
Definition: nsfix.c:44
Definition: gf2pbm.c:137
Definition: utils.c:300
Definition: pbmfont.h:4
Definition: execute.c:108
Definition: ttf.h:433
Definition: sh.h:1345
Definition: xmlparse.c:179
#define ins
Definition: stack.c:13
TT_Error TT_Flush_Face(TT_Face face)
Definition: ttapi.c:631
void * TT_Get_Instance_Pointer(TT_Instance instance)
Definition: ttapi.c:1064
TT_Error TT_FreeType_Version(int *major, int *minor)
Definition: ttapi.c:78
TT_Error TT_Open_Face(TT_Engine engine, const TT_Text *fontPathName, TT_Face *face)
Definition: ttapi.c:261
TT_Error TT_Set_Instance_CharSizes(TT_Instance instance, TT_F26Dot6 charWidth, TT_F26Dot6 charHeight)
Definition: ttapi.c:799
TT_Error TT_New_Instance(TT_Face face, TT_Instance *instance)
Definition: ttapi.c:695
TT_Error TT_Get_Glyph_Big_Metrics(TT_Glyph glyph, TT_Big_Glyph_Metrics *metrics)
Definition: ttapi.c:1310
TT_UShort TT_Char_Index(TT_CharMap charMap, TT_ULong charCode)
Definition: ttapi.c:1984
TT_Error TT_Close_Face(TT_Face face)
Definition: ttapi.c:662
#define TT_FAIL(x)
int TT_Get_CharMap_Count(TT_Face face)
Definition: ttapi.c:1851
TT_Error TT_Set_Instance_Resolutions(TT_Instance instance, TT_UShort xResolution, TT_UShort yResolution)
Definition: ttapi.c:752
TT_Error TT_Get_CharMap(TT_Face face, TT_UShort charmapIndex, TT_CharMap *charMap)
Definition: ttapi.c:1918
TT_Error TT_Done_FreeType(TT_Engine engine)
Definition: ttapi.c:180
int TT_Get_Name_Count(TT_Face face)
Definition: ttapi.c:2020
void TT_Transform_Vector(TT_F26Dot6 *x, TT_F26Dot6 *y, TT_Matrix *matrix)
Definition: ttapi.c:1718
TT_Error TT_Set_Instance_CharSize(TT_Instance instance, TT_F26Dot6 charSize)
Definition: ttapi.c:862
TT_Error TT_Get_Font_Data(TT_Face face, TT_ULong tag, TT_Long offset, void *buffer, TT_Long *length)
Definition: ttapi.c:2174
TT_Error TT_Get_Face_Properties(TT_Face face, TT_Face_Properties *properties)
Definition: ttapi.c:387
TT_Error TT_Get_Glyph_Bitmap(TT_Glyph glyph, TT_Raster_Map *bitmap, TT_F26Dot6 xOffset, TT_F26Dot6 yOffset)
Definition: ttapi.c:1347
TT_Error TT_Done_Glyph(TT_Glyph glyph)
Definition: ttapi.c:1156
TT_Error TT_Get_Glyph_Metrics(TT_Glyph glyph, TT_Glyph_Metrics *metrics)
Definition: ttapi.c:1276
TT_Error TT_Get_Face_Metrics(TT_Face face, TT_UShort firstGlyph, TT_UShort lastGlyph, TT_Short *leftBearings, TT_UShort *widths, TT_Short *topBearings, TT_UShort *heights)
Definition: ttapi.c:548
TT_Error TT_Get_Glyph_Outline(TT_Glyph glyph, TT_Outline *outline)
Definition: ttapi.c:1244
static const TT_Outline null_outline
Definition: ttapi.c:1445
TT_Error TT_New_Glyph(TT_Face face, TT_Glyph *glyph)
Definition: ttapi.c:1121
TT_Error TT_New_Outline(TT_UShort numPoints, TT_Short numContours, TT_Outline *outline)
Definition: ttapi.c:1467
TT_Error TT_Init_FreeType(TT_Engine *engine)
Definition: ttapi.c:111
#define RENDER_Glyph(glyph, target)
Definition: ttapi.c:55
TT_Error TT_Get_Name_String(TT_Face face, TT_UShort nameIndex, TT_String **stringPtr, TT_UShort *length)
Definition: ttapi.c:2107
TT_Error TT_Set_Instance_Transform_Flags(TT_Instance instance, TT_Bool rotated, TT_Bool stretched)
Definition: ttapi.c:944
void TT_Transform_Outline(TT_Outline *outline, TT_Matrix *matrix)
Definition: ttapi.c:1677
TT_Error TT_Open_Collection(TT_Engine engine, const TT_Text *collectionPathName, TT_ULong fontIndex, TT_Face *face)
Definition: ttapi.c:324
TT_Error TT_Get_Outline_BBox(TT_Outline *outline, TT_BBox *bbox)
Definition: ttapi.c:1786
TT_Error TT_Set_Face_Pointer(TT_Face face, void *data)
Definition: ttapi.c:444
TT_Error TT_Get_Name_ID(TT_Face face, TT_UShort nameIndex, TT_UShort *platformID, TT_UShort *encodingID, TT_UShort *languageID, TT_UShort *nameID)
Definition: ttapi.c:2057
TT_Error TT_Copy_Outline(TT_Outline *source, TT_Outline *target)
Definition: ttapi.c:1633
TT_Error TT_Get_CharMap_ID(TT_Face face, TT_UShort charmapIndex, TT_UShort *platformID, TT_UShort *encodingID)
Definition: ttapi.c:1877
TT_Error TT_Get_Glyph_Pixmap(TT_Glyph glyph, TT_Raster_Map *pixmap, TT_F26Dot6 xOffset, TT_F26Dot6 yOffset)
Definition: ttapi.c:1410
void * TT_Get_Face_Pointer(TT_Face face)
Definition: ttapi.c:480
void TT_Translate_Outline(TT_Outline *outline, TT_F26Dot6 xOffset, TT_F26Dot6 yOffset)
Definition: ttapi.c:1753
TT_Error TT_Done_Instance(TT_Instance instance)
Definition: ttapi.c:1091
TT_Error TT_Load_Glyph(TT_Instance instance, TT_Glyph glyph, TT_UShort glyphIndex, TT_UShort loadFlags)
Definition: ttapi.c:1188
TT_Error TT_Get_Instance_Metrics(TT_Instance instance, TT_Instance_Metrics *metrics)
Definition: ttapi.c:978
TT_Error TT_Set_Instance_PixelSizes(TT_Instance instance, TT_UShort pixelWidth, TT_UShort pixelHeight, TT_F26Dot6 pointSize)
Definition: ttapi.c:891
TT_Error TT_Get_Outline_Pixmap(TT_Engine engine, TT_Outline *outline, TT_Raster_Map *pixmap)
Definition: ttapi.c:1589
TT_Error TT_Done_Outline(TT_Outline *outline)
Definition: ttapi.c:1513
TT_Error TT_Set_Instance_Pointer(TT_Instance instance, void *data)
Definition: ttapi.c:1029
#define RENDER_Gray_Glyph(glyph, target, palette)
Definition: ttapi.c:58
TT_Error TT_Set_Raster_Gray_Palette(TT_Engine engine, Byte *palette)
Definition: ttapi.c:224
TT_Error TT_Get_Outline_Bitmap(TT_Engine engine, TT_Outline *outline, TT_Raster_Map *bitmap)
Definition: ttapi.c:1548
static TT_Error TTCache_Init(PEngine_Instance engine)
Definition: ttcache.c:436
static TT_Error TTCache_Done(PEngine_Instance engine)
Definition: ttcache.c:445
#define CACHE_New(_cache, _newobj, _parent)
Definition: ttcache.h:194
#define CACHE_Done(_cache, _obj)
Definition: ttcache.h:197
#define FT_EXPORT_FUNC(type)
Definition: ttconfig.h:194
static TT_Error TTExtend_Done(PEngine_Instance engine)
Definition: ttextend.c:67
static TT_Error TTExtend_Init(PEngine_Instance engine)
Definition: ttextend.c:47
TT_CharMap cmap
Definition: ttf2pfb.c:163
TT_Face_Properties properties
Definition: ttf2pfb.c:169
TT_Outline outline
Definition: ttf2pfb.c:167
TT_Instance instance
Definition: ttf2pfb.c:161
static TT_Error TTFile_Done(PEngine_Instance engine)
Definition: ttfile.c:211
TT_Error TT_Flush_Stream(TT_Stream *stream)
Definition: ttfile.c:880
static TT_Error TTFile_Init(PEngine_Instance engine)
Definition: ttfile.c:186
static TT_Error TT_Close_Stream(TT_Stream *stream)
Definition: ttfile.c:849
static TT_Error TT_Open_Stream(const TT_Text *filepathname, TT_Stream *stream)
Definition: ttfile.c:794
#define DONE_Stream(_stream)
Definition: ttfile.h:71
#define USE_Stream(original, duplicate)
Definition: ttfile.h:68
static TT_Error TTMemory_Init(void)
Definition: ttmemory.c:297
static TT_Error TTMemory_Done(void)
Definition: ttmemory.c:339
#define ALLOC(_pointer_, _size_)
Definition: ttmemory.h:62
#define MEM_Copy(dest, source, count)
Definition: ttmemory.h:44
#define MUTEX_Destroy(mutex)
Definition: ttmutex.h:52
#define MUTEX_Release(mutex)
Definition: ttmutex.h:54
#define MUTEX_Create(mutex)
Definition: ttmutex.h:51
#define MUTEX_Lock(mutex)
Definition: ttmutex.h:53
static TT_Error TTRaster_Done(PEngine_Instance engine)
Definition: ttraster.c:2651
static TT_Error TTRaster_Init(PEngine_Instance engine)
Definition: ttraster.c:2671