/src/3rdparty/freetype/src/cff/cffgload.h

https://bitbucket.org/ultra_iter/qt-vtl · C Header · 203 lines · 90 code · 47 blank · 66 comment · 0 complexity · 4a962fd0f49805a53fddf8a2bb297d26 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* cffgload.h */
  4. /* */
  5. /* OpenType Glyph Loader (specification). */
  6. /* */
  7. /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 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 __CFFGLOAD_H__
  18. #define __CFFGLOAD_H__
  19. #include <ft2build.h>
  20. #include FT_FREETYPE_H
  21. #include "cffobjs.h"
  22. FT_BEGIN_HEADER
  23. #define CFF_MAX_OPERANDS 48
  24. #define CFF_MAX_SUBRS_CALLS 32
  25. /*************************************************************************/
  26. /* */
  27. /* <Structure> */
  28. /* CFF_Builder */
  29. /* */
  30. /* <Description> */
  31. /* A structure used during glyph loading to store its outline. */
  32. /* */
  33. /* <Fields> */
  34. /* memory :: The current memory object. */
  35. /* */
  36. /* face :: The current face object. */
  37. /* */
  38. /* glyph :: The current glyph slot. */
  39. /* */
  40. /* loader :: The current glyph loader. */
  41. /* */
  42. /* base :: The base glyph outline. */
  43. /* */
  44. /* current :: The current glyph outline. */
  45. /* */
  46. /* last :: The last point position. */
  47. /* */
  48. /* pos_x :: The horizontal translation (if composite glyph). */
  49. /* */
  50. /* pos_y :: The vertical translation (if composite glyph). */
  51. /* */
  52. /* left_bearing :: The left side bearing point. */
  53. /* */
  54. /* advance :: The horizontal advance vector. */
  55. /* */
  56. /* bbox :: Unused. */
  57. /* */
  58. /* path_begun :: A flag which indicates that a new path has begun. */
  59. /* */
  60. /* load_points :: If this flag is not set, no points are loaded. */
  61. /* */
  62. /* no_recurse :: Set but not used. */
  63. /* */
  64. /* metrics_only :: A boolean indicating that we only want to compute */
  65. /* the metrics of a given glyph, not load all of its */
  66. /* points. */
  67. /* */
  68. /* hints_funcs :: Auxiliary pointer for hinting. */
  69. /* */
  70. /* hints_globals :: Auxiliary pointer for hinting. */
  71. /* */
  72. typedef struct CFF_Builder_
  73. {
  74. FT_Memory memory;
  75. TT_Face face;
  76. CFF_GlyphSlot glyph;
  77. FT_GlyphLoader loader;
  78. FT_Outline* base;
  79. FT_Outline* current;
  80. FT_Vector last;
  81. FT_Pos pos_x;
  82. FT_Pos pos_y;
  83. FT_Vector left_bearing;
  84. FT_Vector advance;
  85. FT_BBox bbox; /* bounding box */
  86. FT_Bool path_begun;
  87. FT_Bool load_points;
  88. FT_Bool no_recurse;
  89. FT_Bool metrics_only;
  90. void* hints_funcs; /* hinter-specific */
  91. void* hints_globals; /* hinter-specific */
  92. } CFF_Builder;
  93. /* execution context charstring zone */
  94. typedef struct CFF_Decoder_Zone_
  95. {
  96. FT_Byte* base;
  97. FT_Byte* limit;
  98. FT_Byte* cursor;
  99. } CFF_Decoder_Zone;
  100. typedef struct CFF_Decoder_
  101. {
  102. CFF_Builder builder;
  103. CFF_Font cff;
  104. FT_Fixed stack[CFF_MAX_OPERANDS + 1];
  105. FT_Fixed* top;
  106. CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
  107. CFF_Decoder_Zone* zone;
  108. FT_Int flex_state;
  109. FT_Int num_flex_vectors;
  110. FT_Vector flex_vectors[7];
  111. FT_Pos glyph_width;
  112. FT_Pos nominal_width;
  113. FT_Bool read_width;
  114. FT_Bool width_only;
  115. FT_Int num_hints;
  116. FT_Fixed* buildchar;
  117. FT_Int len_buildchar;
  118. FT_UInt num_locals;
  119. FT_UInt num_globals;
  120. FT_Int locals_bias;
  121. FT_Int globals_bias;
  122. FT_Byte** locals;
  123. FT_Byte** globals;
  124. FT_Byte** glyph_names; /* for pure CFF fonts only */
  125. FT_UInt num_glyphs; /* number of glyphs in font */
  126. FT_Render_Mode hint_mode;
  127. } CFF_Decoder;
  128. FT_LOCAL( void )
  129. cff_decoder_init( CFF_Decoder* decoder,
  130. TT_Face face,
  131. CFF_Size size,
  132. CFF_GlyphSlot slot,
  133. FT_Bool hinting,
  134. FT_Render_Mode hint_mode );
  135. FT_LOCAL( FT_Error )
  136. cff_decoder_prepare( CFF_Decoder* decoder,
  137. CFF_Size size,
  138. FT_UInt glyph_index );
  139. #if 0 /* unused until we support pure CFF fonts */
  140. /* Compute the maximum advance width of a font through quick parsing */
  141. FT_LOCAL( FT_Error )
  142. cff_compute_max_advance( TT_Face face,
  143. FT_Int* max_advance );
  144. #endif /* 0 */
  145. FT_LOCAL( FT_Error )
  146. cff_decoder_parse_charstrings( CFF_Decoder* decoder,
  147. FT_Byte* charstring_base,
  148. FT_ULong charstring_len );
  149. FT_LOCAL( FT_Error )
  150. cff_slot_load( CFF_GlyphSlot glyph,
  151. CFF_Size size,
  152. FT_UInt glyph_index,
  153. FT_Int32 load_flags );
  154. FT_END_HEADER
  155. #endif /* __CFFGLOAD_H__ */
  156. /* END */