sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
afcjk.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * afcjk.h
4 *
5 * Auto-fitter hinting routines for CJK writing system (specification).
6 *
7 * Copyright (C) 2006-2025 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
23#ifndef AFCJK_H_
24#define AFCJK_H_
25
26#include "afhints.h"
27#include "aflatin.h"
28
29
30FT_BEGIN_HEADER
31
32
33 /* the CJK-specific writing system */
34
35 AF_DECLARE_WRITING_SYSTEM_CLASS( af_cjk_writing_system_class )
36
37
38 /*************************************************************************/
39 /*************************************************************************/
40 /***** *****/
41 /***** C J K G L O B A L M E T R I C S *****/
42 /***** *****/
43 /*************************************************************************/
44 /*************************************************************************/
45
46
47 /*
48 * CJK glyphs tend to fill the square. So we have both vertical and
49 * horizontal blue zones. But some glyphs have flat bounding strokes that
50 * leave some space between neighbour glyphs.
51 */
52
53#define AF_CJK_IS_TOP_BLUE( b ) \
54 ( (b)->properties & AF_BLUE_PROPERTY_CJK_TOP )
55#define AF_CJK_IS_HORIZ_BLUE( b ) \
56 ( (b)->properties & AF_BLUE_PROPERTY_CJK_HORIZ )
57#define AF_CJK_IS_RIGHT_BLUE AF_CJK_IS_TOP_BLUE
58
59#define AF_CJK_MAX_WIDTHS 16
60
61
62#define AF_CJK_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */
63#define AF_CJK_BLUE_TOP ( 1U << 1 ) /* result of AF_CJK_IS_TOP_BLUE */
64#define AF_CJK_BLUE_ADJUSTMENT ( 1U << 2 ) /* used for scale adjustment */
65 /* optimization */
66
67
68 typedef struct AF_CJKBlueRec_
69 {
70 AF_WidthRec ref;
71 AF_WidthRec shoot; /* undershoot */
72 FT_UInt flags;
73
74 } AF_CJKBlueRec, *AF_CJKBlue;
75
76
77 typedef struct AF_CJKAxisRec_
78 {
79 FT_Fixed scale;
80 FT_Pos delta;
81
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? */
87
88 /* used for horizontal metrics too for CJK */
89 FT_Bool control_overshoot;
90 FT_UInt blue_count;
91 AF_CJKBlueRec blues[AF_BLUE_STRINGSET_MAX_LEN];
92
93 FT_Fixed org_scale;
94 FT_Pos org_delta;
95
96 } AF_CJKAxisRec, *AF_CJKAxis;
97
98
99 typedef struct AF_CJKMetricsRec_
100 {
101 AF_StyleMetricsRec root;
102 FT_UInt units_per_em;
103 AF_CJKAxisRec axis[AF_DIMENSION_MAX];
104
105 } AF_CJKMetricsRec, *AF_CJKMetrics;
106
107
108#ifdef AF_CONFIG_OPTION_CJK
109 FT_LOCAL( FT_Error )
110 af_cjk_metrics_init( AF_StyleMetrics metrics,
111 FT_Face face );
112
113 FT_LOCAL( void )
114 af_cjk_metrics_scale( AF_StyleMetrics metrics,
115 AF_Scaler scaler );
116
117 FT_LOCAL( FT_Error )
118 af_cjk_hints_init( AF_GlyphHints hints,
119 AF_StyleMetrics metrics );
120
121 FT_LOCAL( FT_Error )
122 af_cjk_hints_apply( FT_UInt glyph_index,
123 AF_GlyphHints hints,
124 FT_Outline* outline,
125 AF_StyleMetrics metrics );
126
127 /* shared; called from afindic.c */
128 FT_LOCAL( void )
129 af_cjk_metrics_check_digits( AF_CJKMetrics metrics,
130 FT_Face face );
131
132 FT_LOCAL( void )
133 af_cjk_metrics_init_widths( AF_CJKMetrics metrics,
134 FT_Face face );
135#endif /* AF_CONFIG_OPTION_CJK */
136
137
138/* */
139
140FT_END_HEADER
141
142#endif /* AFCJK_H_ */
143
144
145/* END */