/src/3rdparty/freetype/src/pshinter/pshrec.h

https://bitbucket.org/ultra_iter/qt-vtl · C Header · 176 lines · 75 code · 50 blank · 51 comment · 0 complexity · 5b73f68172c5bf43b5a7c5192cd915c4 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* pshrec.h */
  4. /* */
  5. /* Postscript (Type1/Type2) hints recorder (specification). */
  6. /* */
  7. /* Copyright 2001, 2002, 2003, 2006, 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. /**************************************************************************/
  18. /* */
  19. /* The functions defined here are called from the Type 1, CID and CFF */
  20. /* font drivers to record the hints of a given character/glyph. */
  21. /* */
  22. /* The hints are recorded in a unified format, and are later processed */
  23. /* by the `optimizer' and `fitter' to adjust the outlines to the pixel */
  24. /* grid. */
  25. /* */
  26. /**************************************************************************/
  27. #ifndef __PSHREC_H__
  28. #define __PSHREC_H__
  29. #include <ft2build.h>
  30. #include FT_INTERNAL_POSTSCRIPT_HINTS_H
  31. #include "pshglob.h"
  32. FT_BEGIN_HEADER
  33. /*************************************************************************/
  34. /*************************************************************************/
  35. /***** *****/
  36. /***** GLYPH HINTS RECORDER INTERNALS *****/
  37. /***** *****/
  38. /*************************************************************************/
  39. /*************************************************************************/
  40. /* handle to hint record */
  41. typedef struct PS_HintRec_* PS_Hint;
  42. /* hint types */
  43. typedef enum PS_Hint_Type_
  44. {
  45. PS_HINT_TYPE_1 = 1,
  46. PS_HINT_TYPE_2 = 2
  47. } PS_Hint_Type;
  48. /* hint flags */
  49. typedef enum PS_Hint_Flags_
  50. {
  51. PS_HINT_FLAG_GHOST = 1,
  52. PS_HINT_FLAG_BOTTOM = 2
  53. } PS_Hint_Flags;
  54. /* hint descriptor */
  55. typedef struct PS_HintRec_
  56. {
  57. FT_Int pos;
  58. FT_Int len;
  59. FT_UInt flags;
  60. } PS_HintRec;
  61. #define ps_hint_is_active( x ) ( (x)->flags & PS_HINT_FLAG_ACTIVE )
  62. #define ps_hint_is_ghost( x ) ( (x)->flags & PS_HINT_FLAG_GHOST )
  63. #define ps_hint_is_bottom( x ) ( (x)->flags & PS_HINT_FLAG_BOTTOM )
  64. /* hints table descriptor */
  65. typedef struct PS_Hint_TableRec_
  66. {
  67. FT_UInt num_hints;
  68. FT_UInt max_hints;
  69. PS_Hint hints;
  70. } PS_Hint_TableRec, *PS_Hint_Table;
  71. /* hint and counter mask descriptor */
  72. typedef struct PS_MaskRec_
  73. {
  74. FT_UInt num_bits;
  75. FT_UInt max_bits;
  76. FT_Byte* bytes;
  77. FT_UInt end_point;
  78. } PS_MaskRec, *PS_Mask;
  79. /* masks and counters table descriptor */
  80. typedef struct PS_Mask_TableRec_
  81. {
  82. FT_UInt num_masks;
  83. FT_UInt max_masks;
  84. PS_Mask masks;
  85. } PS_Mask_TableRec, *PS_Mask_Table;
  86. /* dimension-specific hints descriptor */
  87. typedef struct PS_DimensionRec_
  88. {
  89. PS_Hint_TableRec hints;
  90. PS_Mask_TableRec masks;
  91. PS_Mask_TableRec counters;
  92. } PS_DimensionRec, *PS_Dimension;
  93. /* glyph hints descriptor */
  94. /* dimension 0 => X coordinates + vertical hints/stems */
  95. /* dimension 1 => Y coordinates + horizontal hints/stems */
  96. typedef struct PS_HintsRec_
  97. {
  98. FT_Memory memory;
  99. FT_Error error;
  100. FT_UInt32 magic;
  101. PS_Hint_Type hint_type;
  102. PS_DimensionRec dimension[2];
  103. } PS_HintsRec, *PS_Hints;
  104. /* */
  105. /* initialize hints recorder */
  106. FT_LOCAL( FT_Error )
  107. ps_hints_init( PS_Hints hints,
  108. FT_Memory memory );
  109. /* finalize hints recorder */
  110. FT_LOCAL( void )
  111. ps_hints_done( PS_Hints hints );
  112. /* initialize Type1 hints recorder interface */
  113. FT_LOCAL( void )
  114. t1_hints_funcs_init( T1_Hints_FuncsRec* funcs );
  115. /* initialize Type2 hints recorder interface */
  116. FT_LOCAL( void )
  117. t2_hints_funcs_init( T2_Hints_FuncsRec* funcs );
  118. #ifdef DEBUG_HINTER
  119. extern PS_Hints ps_debug_hints;
  120. extern int ps_debug_no_horz_hints;
  121. extern int ps_debug_no_vert_hints;
  122. #endif
  123. /* */
  124. FT_END_HEADER
  125. #endif /* __PS_HINTER_RECORD_H__ */
  126. /* END */