/src/compiler/android-ndk/jni/freetype/src/cff/cffgload.h

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