/src/freetype/src/autofit/afcjk.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 141 lines · 73 code · 40 blank · 28 comment · 0 complexity · 02954e86d50b6d2764f0baceea3dbe13 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* afcjk.h */
  4. /* */
  5. /* Auto-fitter hinting routines for CJK script (specification). */
  6. /* */
  7. /* Copyright 2006, 2007, 2011 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 __AFCJK_H__
  18. #define __AFCJK_H__
  19. #include "afhints.h"
  20. #include "aflatin.h"
  21. FT_BEGIN_HEADER
  22. /* the CJK-specific script class */
  23. AF_DECLARE_SCRIPT_CLASS(af_cjk_script_class)
  24. /* CJK (global) metrics management */
  25. /*
  26. * CJK glyphs tend to fill the square. So we have both vertical and
  27. * horizontal blue zones. But some glyphs have flat bounding strokes that
  28. * leave some space between neighbour glyphs.
  29. */
  30. enum
  31. {
  32. AF_CJK_BLUE_TOP,
  33. AF_CJK_BLUE_BOTTOM,
  34. AF_CJK_BLUE_LEFT,
  35. AF_CJK_BLUE_RIGHT,
  36. AF_CJK_BLUE_MAX
  37. };
  38. #define AF_CJK_MAX_WIDTHS 16
  39. #define AF_CJK_MAX_BLUES AF_CJK_BLUE_MAX
  40. enum
  41. {
  42. AF_CJK_BLUE_ACTIVE = 1 << 0,
  43. AF_CJK_BLUE_IS_TOP = 1 << 1,
  44. AF_CJK_BLUE_IS_RIGHT = 1 << 2,
  45. AF_CJK_BLUE_ADJUSTMENT = 1 << 3, /* used for scale adjustment */
  46. /* optimization */
  47. AF_CJK_BLUE_FLAG_MAX
  48. };
  49. typedef struct AF_CJKBlueRec_
  50. {
  51. AF_WidthRec ref;
  52. AF_WidthRec shoot; /* undershoot */
  53. FT_UInt flags;
  54. } AF_CJKBlueRec, *AF_CJKBlue;
  55. typedef struct AF_CJKAxisRec_
  56. {
  57. FT_Fixed scale;
  58. FT_Pos delta;
  59. FT_UInt width_count;
  60. AF_WidthRec widths[AF_CJK_MAX_WIDTHS];
  61. FT_Pos edge_distance_threshold;
  62. FT_Pos standard_width;
  63. FT_Bool extra_light;
  64. /* used for horizontal metrics too for CJK */
  65. FT_Bool control_overshoot;
  66. FT_UInt blue_count;
  67. AF_CJKBlueRec blues[AF_CJK_BLUE_MAX];
  68. FT_Fixed org_scale;
  69. FT_Pos org_delta;
  70. } AF_CJKAxisRec, *AF_CJKAxis;
  71. typedef struct AF_CJKMetricsRec_
  72. {
  73. AF_ScriptMetricsRec root;
  74. FT_UInt units_per_em;
  75. AF_CJKAxisRec axis[AF_DIMENSION_MAX];
  76. } AF_CJKMetricsRec, *AF_CJKMetrics;
  77. FT_LOCAL( FT_Error )
  78. af_cjk_metrics_init( AF_CJKMetrics metrics,
  79. FT_Face face );
  80. FT_LOCAL( void )
  81. af_cjk_metrics_scale( AF_CJKMetrics metrics,
  82. AF_Scaler scaler );
  83. FT_LOCAL( FT_Error )
  84. af_cjk_hints_init( AF_GlyphHints hints,
  85. AF_CJKMetrics metrics );
  86. FT_LOCAL( FT_Error )
  87. af_cjk_hints_apply( AF_GlyphHints hints,
  88. FT_Outline* outline,
  89. AF_CJKMetrics metrics );
  90. /* Shared. called from afindic.c */
  91. FT_LOCAL( void )
  92. af_cjk_metrics_check_digits( AF_CJKMetrics metrics,
  93. FT_Face face );
  94. FT_LOCAL( void )
  95. af_cjk_metrics_init_widths( AF_CJKMetrics metrics,
  96. FT_Face face,
  97. FT_ULong charcode );
  98. /* */
  99. FT_END_HEADER
  100. #endif /* __AFCJK_H__ */
  101. /* END */