sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
afglobal.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * afglobal.h
4 *
5 * Auto-fitter routines to compute global hinting values
6 * (specification).
7 *
8 * Copyright (C) 2003-2025 by
9 * David Turner, Robert Wilhelm, and Werner Lemberg.
10 *
11 * This file is part of the FreeType project, and may only be used,
12 * modified, and distributed under the terms of the FreeType project
13 * license, LICENSE.TXT. By continuing to use, modify, or distribute
14 * this file you indicate that you have read the license and
15 * understand and accept it fully.
16 *
17 */
18
19
24#ifndef AFGLOBAL_H_
25#define AFGLOBAL_H_
26
27
28#include "aftypes.h"
29#include "afmodule.h"
30#include "afshaper.h"
31
32
33FT_BEGIN_HEADER
34
35
36 FT_LOCAL_ARRAY( AF_WritingSystemClass )
37 af_writing_system_classes[];
38
39
40#undef SCRIPT
41#define SCRIPT( s, S, d, h, H, ss ) \
42 AF_DECLARE_SCRIPT_CLASS( af_ ## s ## _script_class )
43
44#include "afscript.h"
45
46 FT_LOCAL_ARRAY( AF_ScriptClass )
47 af_script_classes[];
48
49
50#undef STYLE
51#define STYLE( s, S, d, ws, sc, ss, c ) \
52 AF_DECLARE_STYLE_CLASS( af_ ## s ## _style_class )
53
54#include "afstyles.h"
55
56 FT_LOCAL_ARRAY( AF_StyleClass )
57 af_style_classes[];
58
59
60#ifdef FT_DEBUG_LEVEL_TRACE
61 FT_LOCAL_ARRAY( char* )
62 af_style_names[];
63#endif
64
65
66 /*
67 * Default values and flags for both autofitter globals (found in
68 * AF_ModuleRec) and face globals (in AF_FaceGlobalsRec).
69 */
70
71 /* index of fallback style in `af_style_classes' */
72#ifdef AF_CONFIG_OPTION_CJK
73#define AF_STYLE_FALLBACK AF_STYLE_HANI_DFLT
74#else
75#define AF_STYLE_FALLBACK AF_STYLE_NONE_DFLT
76#endif
77 /* default script for OpenType; ignored if HarfBuzz isn't used */
78#define AF_SCRIPT_DEFAULT AF_SCRIPT_LATN
79
80 /* a bit mask for AF_DIGIT, AF_NONBASE, and AF_HAS_CMAP_ENTRY */
81#define AF_STYLE_MASK 0x1FFF
82 /* an uncovered glyph */
83#define AF_STYLE_UNASSIGNED AF_STYLE_MASK
84
85 /* if this flag is set, we have an ASCII digit */
86#define AF_DIGIT 0x8000U
87 /* if this flag is set, we have a non-base character */
88#define AF_NONBASE 0x4000U
89 /* if this flag is set, the glyph has a (direct) cmap entry */
90#define AF_HAS_CMAP_ENTRY 0x2000U
91
92 /* `increase-x-height' property */
93#define AF_PROP_INCREASE_X_HEIGHT_MIN 6
94#define AF_PROP_INCREASE_X_HEIGHT_MAX 0
95
96
97 /************************************************************************/
98 /************************************************************************/
99 /***** *****/
100 /***** F A C E G L O B A L S *****/
101 /***** *****/
102 /************************************************************************/
103 /************************************************************************/
104
105
106 /*
107 * Note that glyph_styles[] maps each glyph to an index into the
108 * `af_style_classes' array.
109 *
110 */
111 typedef struct AF_FaceGlobalsRec_
112 {
113 FT_Face face;
114 FT_UInt glyph_count; /* unsigned face->num_glyphs */
115 FT_UShort* glyph_styles;
116
117#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
118 hb_font_t* hb_font;
119 hb_buffer_t* hb_buf; /* for feature comparison */
120
121 /* The GSUB table. */
122 FT_Byte* gsub;
123 /* Lookup offsets, with only SingleSubst and AlternateSubst non-NULL. */
124 FT_UInt32* gsub_lookups_single_alternate;
125#endif
126
127 /* per-face auto-hinter properties */
128 FT_UInt increase_x_height;
129
130 AF_StyleMetrics metrics[AF_STYLE_MAX];
131
132 /* Compute darkening amount once per size. Use this to check whether */
133 /* darken_{x,y} needs to be recomputed. */
134 FT_UShort stem_darkening_for_ppem;
135 /* Copy from e.g. AF_LatinMetrics.axis[AF_DIMENSION_HORZ] */
136 /* to compute the darkening amount. */
137 FT_Pos standard_vertical_width;
138 /* Copy from e.g. AF_LatinMetrics.axis[AF_DIMENSION_VERT] */
139 /* to compute the darkening amount. */
140 FT_Pos standard_horizontal_width;
141 /* The actual amount to darken a glyph along the X axis. */
142 FT_Pos darken_x;
143 /* The actual amount to darken a glyph along the Y axis. */
144 FT_Pos darken_y;
145 /* Amount to scale down by to keep emboldened points */
146 /* on the Y-axis in pre-computed blue zones. */
147 FT_Fixed scale_down_factor;
148 AF_Module module; /* to access global properties */
149
150 } AF_FaceGlobalsRec;
151
152
153 /*
154 * model the global hints data for a given face, decomposed into
155 * style-specific items
156 */
157
158 FT_LOCAL( FT_Error )
159 af_face_globals_new( FT_Face face,
160 AF_FaceGlobals *aglobals,
161 AF_Module module );
162
163 FT_LOCAL( FT_Error )
164 af_face_globals_get_metrics( AF_FaceGlobals globals,
165 FT_UInt gindex,
166 FT_UInt options,
167 AF_StyleMetrics *ametrics );
168
169 FT_LOCAL( void )
170 af_face_globals_free( void* globals );
171
172 FT_LOCAL( FT_Bool )
173 af_face_globals_is_digit( AF_FaceGlobals globals,
174 FT_UInt gindex );
175
176 /* */
177
178
179FT_END_HEADER
180
181#endif /* AFGLOBAL_H_ */
182
183
184/* END */