1
0

ftgloadr.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /***************************************************************************/
  2. /* */
  3. /* ftgloadr.h */
  4. /* */
  5. /* The FreeType glyph loader (specification). */
  6. /* */
  7. /* Copyright 2002, 2003, 2005, 2006 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. /***************************************************************************/
  17. #ifndef __FTGLOADR_H__
  18. #define __FTGLOADR_H__
  19. #include <ft2build.h>
  20. #include FT_FREETYPE_H
  21. FT_BEGIN_HEADER
  22. /*************************************************************************/
  23. /* */
  24. /* <Struct> */
  25. /* FT_GlyphLoader */
  26. /* */
  27. /* <Description> */
  28. /* The glyph loader is an internal object used to load several glyphs */
  29. /* together (for example, in the case of composites). */
  30. /* */
  31. /* <Note> */
  32. /* The glyph loader implementation is not part of the high-level API, */
  33. /* hence the forward structure declaration. */
  34. /* */
  35. typedef struct FT_GlyphLoaderRec_* FT_GlyphLoader ;
  36. #if 0 /* moved to freetype.h in version 2.2 */
  37. #define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
  38. #define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
  39. #define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
  40. #define FT_SUBGLYPH_FLAG_SCALE 8
  41. #define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
  42. #define FT_SUBGLYPH_FLAG_2X2 0x80
  43. #define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
  44. #endif
  45. typedef struct FT_SubGlyphRec_
  46. {
  47. FT_Int index;
  48. FT_UShort flags;
  49. FT_Int arg1;
  50. FT_Int arg2;
  51. FT_Matrix transform;
  52. } FT_SubGlyphRec;
  53. typedef struct FT_GlyphLoadRec_
  54. {
  55. FT_Outline outline; /* outline */
  56. FT_Vector* extra_points; /* extra points table */
  57. FT_Vector* extra_points2; /* second extra points table */
  58. FT_UInt num_subglyphs; /* number of subglyphs */
  59. FT_SubGlyph subglyphs; /* subglyphs */
  60. } FT_GlyphLoadRec, *FT_GlyphLoad;
  61. typedef struct FT_GlyphLoaderRec_
  62. {
  63. FT_Memory memory;
  64. FT_UInt max_points;
  65. FT_UInt max_contours;
  66. FT_UInt max_subglyphs;
  67. FT_Bool use_extra;
  68. FT_GlyphLoadRec base;
  69. FT_GlyphLoadRec current;
  70. void* other; /* for possible future extension? */
  71. } FT_GlyphLoaderRec;
  72. /* create new empty glyph loader */
  73. FT_BASE( FT_Error )
  74. FT_GlyphLoader_New( FT_Memory memory,
  75. FT_GlyphLoader *aloader );
  76. /* add an extra points table to a glyph loader */
  77. FT_BASE( FT_Error )
  78. FT_GlyphLoader_CreateExtra( FT_GlyphLoader loader );
  79. /* destroy a glyph loader */
  80. FT_BASE( void )
  81. FT_GlyphLoader_Done( FT_GlyphLoader loader );
  82. /* reset a glyph loader (frees everything int it) */
  83. FT_BASE( void )
  84. FT_GlyphLoader_Reset( FT_GlyphLoader loader );
  85. /* rewind a glyph loader */
  86. FT_BASE( void )
  87. FT_GlyphLoader_Rewind( FT_GlyphLoader loader );
  88. /* check that there is enough space to add `n_points' and `n_contours' */
  89. /* to the glyph loader */
  90. FT_BASE( FT_Error )
  91. FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
  92. FT_UInt n_points,
  93. FT_UInt n_contours );
  94. #define FT_GLYPHLOADER_CHECK_P( _loader, _count ) \
  95. ( (_count) == 0 || ((_loader)->base.outline.n_points + \
  96. (_loader)->current.outline.n_points + \
  97. (unsigned long)(_count)) <= (_loader)->max_points )
  98. #define FT_GLYPHLOADER_CHECK_C( _loader, _count ) \
  99. ( (_count) == 0 || ((_loader)->base.outline.n_contours + \
  100. (_loader)->current.outline.n_contours + \
  101. (unsigned long)(_count)) <= (_loader)->max_contours )
  102. #define FT_GLYPHLOADER_CHECK_POINTS( _loader, _points,_contours ) \
  103. ( ( FT_GLYPHLOADER_CHECK_P( _loader, _points ) && \
  104. FT_GLYPHLOADER_CHECK_C( _loader, _contours ) ) \
  105. ? 0 \
  106. : FT_GlyphLoader_CheckPoints( (_loader), (_points), (_contours) ) )
  107. /* check that there is enough space to add `n_subs' sub-glyphs to */
  108. /* a glyph loader */
  109. FT_BASE( FT_Error )
  110. FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
  111. FT_UInt n_subs );
  112. /* prepare a glyph loader, i.e. empty the current glyph */
  113. FT_BASE( void )
  114. FT_GlyphLoader_Prepare( FT_GlyphLoader loader );
  115. /* add the current glyph to the base glyph */
  116. FT_BASE( void )
  117. FT_GlyphLoader_Add( FT_GlyphLoader loader );
  118. /* copy points from one glyph loader to another */
  119. FT_BASE( FT_Error )
  120. FT_GlyphLoader_CopyPoints( FT_GlyphLoader target,
  121. FT_GlyphLoader source );
  122. /* */
  123. FT_END_HEADER
  124. #endif /* __FTGLOADR_H__ */
  125. /* END */