1 /***************************************************************************/
5 /* Auto-fitter hinting routines for CJK writing system (specification). */
7 /* Copyright 2006, 2007, 2011-2014 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
29 /* the CJK-specific writing system */
31 AF_DECLARE_WRITING_SYSTEM_CLASS( af_cjk_writing_system_class )
34 /*************************************************************************/
35 /*************************************************************************/
37 /***** C J K G L O B A L M E T R I C S *****/
39 /*************************************************************************/
40 /*************************************************************************/
44 * CJK glyphs tend to fill the square. So we have both vertical and
45 * horizontal blue zones. But some glyphs have flat bounding strokes that
46 * leave some space between neighbour glyphs.
49 #define AF_CJK_IS_TOP_BLUE( b ) \
50 ( (b)->properties & AF_BLUE_PROPERTY_CJK_TOP )
51 #define AF_CJK_IS_HORIZ_BLUE( b ) \
52 ( (b)->properties & AF_BLUE_PROPERTY_CJK_HORIZ )
53 #define AF_CJK_IS_RIGHT_BLUE AF_CJK_IS_TOP_BLUE
55 #define AF_CJK_MAX_WIDTHS 16
60 AF_CJK_BLUE_ACTIVE = 1 << 0, /* set if zone height is <= 3/4px */
61 AF_CJK_BLUE_TOP = 1 << 1, /* result of AF_CJK_IS_TOP_BLUE */
62 AF_CJK_BLUE_ADJUSTMENT = 1 << 2, /* used for scale adjustment */
68 typedef struct AF_CJKBlueRec_
71 AF_WidthRec shoot; /* undershoot */
74 } AF_CJKBlueRec, *AF_CJKBlue;
77 typedef struct AF_CJKAxisRec_
82 FT_UInt width_count; /* number of used widths */
83 AF_WidthRec widths[AF_CJK_MAX_WIDTHS]; /* widths array */
84 FT_Pos edge_distance_threshold; /* used for creating edges */
85 FT_Pos standard_width; /* the default stem thickness */
86 FT_Bool extra_light; /* is standard width very light? */
88 /* used for horizontal metrics too for CJK */
89 FT_Bool control_overshoot;
91 AF_CJKBlueRec blues[AF_BLUE_STRINGSET_MAX];
96 } AF_CJKAxisRec, *AF_CJKAxis;
99 typedef struct AF_CJKMetricsRec_
101 AF_StyleMetricsRec root;
102 FT_UInt units_per_em;
103 AF_CJKAxisRec axis[AF_DIMENSION_MAX];
105 } AF_CJKMetricsRec, *AF_CJKMetrics;
108 #ifdef AF_CONFIG_OPTION_CJK
110 af_cjk_metrics_init( AF_CJKMetrics metrics,
114 af_cjk_metrics_scale( AF_CJKMetrics metrics,
118 af_cjk_hints_init( AF_GlyphHints hints,
119 AF_CJKMetrics metrics );
122 af_cjk_hints_apply( AF_GlyphHints hints,
124 AF_CJKMetrics metrics );
126 /* shared; called from afindic.c */
128 af_cjk_metrics_check_digits( AF_CJKMetrics metrics,
132 af_cjk_metrics_init_widths( AF_CJKMetrics metrics,
134 #endif /* AF_CONFIG_OPTION_CJK */
141 #endif /* __AFCJK_H__ */