sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
aflatin.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * aflatin.h
4 *
5 * Auto-fitter hinting routines for latin writing system
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 AFLATIN_H_
25#define AFLATIN_H_
26
27#include "afhints.h"
28
29
30FT_BEGIN_HEADER
31
32 /* the `latin' writing system */
33
34 AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin_writing_system_class )
35
36
37 /* constants are given with units_per_em == 2048 in mind */
38#define AF_LATIN_CONSTANT( metrics, c ) \
39 ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
40
41
42 /*************************************************************************/
43 /*************************************************************************/
44 /***** *****/
45 /***** L A T I N G L O B A L M E T R I C S *****/
46 /***** *****/
47 /*************************************************************************/
48 /*************************************************************************/
49
50
51 /*
52 * The following declarations could be embedded in the file `aflatin.c';
53 * they have been made semi-public to allow alternate writing system
54 * hinters to re-use some of them.
55 */
56
57
58#define AF_LATIN_IS_TOP_BLUE( b ) \
59 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_TOP )
60#define AF_LATIN_IS_SUB_TOP_BLUE( b ) \
61 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_SUB_TOP )
62#define AF_LATIN_IS_NEUTRAL_BLUE( b ) \
63 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_NEUTRAL )
64#define AF_LATIN_IS_X_HEIGHT_BLUE( b ) \
65 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_X_HEIGHT )
66#define AF_LATIN_IS_LONG_BLUE( b ) \
67 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_LONG )
68#define AF_LATIN_IS_CAPITAL_BOTTOM_BLUE( b ) \
69 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM )
70#define AF_LATIN_IS_SMALL_BOTTOM_BLUE( b ) \
71 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM )
72
73#define AF_LATIN_MAX_WIDTHS 16
74
75
76#define AF_LATIN_BLUE_ACTIVE ( 1U << 0 ) /* zone height is <= 3/4px */
77#define AF_LATIN_BLUE_TOP ( 1U << 1 ) /* we have a top blue zone */
78#define AF_LATIN_BLUE_SUB_TOP ( 1U << 2 ) /* we have a subscript */
79 /* top blue zone */
80#define AF_LATIN_BLUE_NEUTRAL ( 1U << 3 ) /* we have a neutral blue */
81 /* zone */
82#define AF_LATIN_BLUE_ADJUSTMENT ( 1U << 4 ) /* used for scale adjustm. */
83 /* optimization */
84#define AF_LATIN_BLUE_BOTTOM ( 1U << 5 ) /* we have a capital */
85 /* letter bottom blue zone */
86#define AF_LATIN_BLUE_BOTTOM_SMALL ( 1U << 6 ) /* we have a small letter */
87 /* bottom blue zone */
88
89
90 typedef struct AF_LatinBlueRec_
91 {
92 AF_WidthRec ref;
93 AF_WidthRec shoot;
94 FT_Pos ascender;
95 FT_Pos descender;
96 FT_UInt flags;
97
98 } AF_LatinBlueRec, *AF_LatinBlue;
99
100
101 typedef struct AF_LatinAxisRec_
102 {
103 FT_Fixed scale;
104 FT_Pos delta;
105
106 FT_UInt width_count; /* number of used widths */
107 AF_WidthRec widths[AF_LATIN_MAX_WIDTHS]; /* widths array */
108 FT_Pos edge_distance_threshold; /* used for creating edges */
109 FT_Pos standard_width; /* the default stem thickness */
110 FT_Bool extra_light; /* is standard width very light? */
111
112 /* ignored for horizontal metrics */
113 FT_UInt blue_count;
114 AF_LatinBlueRec blues[AF_BLUE_STRINGSET_MAX_LEN];
115
116 FT_Fixed org_scale;
117 FT_Pos org_delta;
118
119 } AF_LatinAxisRec, *AF_LatinAxis;
120
121
122 typedef struct AF_LatinMetricsRec_
123 {
124 AF_StyleMetricsRec root;
125 FT_UInt units_per_em;
126 AF_LatinAxisRec axis[AF_DIMENSION_MAX];
127
128 } AF_LatinMetricsRec, *AF_LatinMetrics;
129
130
131 FT_LOCAL( FT_Error )
132 af_latin_metrics_init( AF_StyleMetrics metrics,
133 FT_Face face );
134
135 FT_LOCAL( void )
136 af_latin_metrics_scale( AF_StyleMetrics metrics,
137 AF_Scaler scaler );
138
139 FT_LOCAL( void )
140 af_latin_metrics_init_widths( AF_LatinMetrics metrics,
141 FT_Face face );
142
143 FT_LOCAL( void )
144 af_latin_metrics_check_digits( AF_LatinMetrics metrics,
145 FT_Face face );
146
147
148 /*************************************************************************/
149 /*************************************************************************/
150 /***** *****/
151 /***** L A T I N G L Y P H A N A L Y S I S *****/
152 /***** *****/
153 /*************************************************************************/
154 /*************************************************************************/
155
156#define AF_LATIN_HINTS_HORZ_SNAP ( 1U << 0 ) /* stem width snapping */
157#define AF_LATIN_HINTS_VERT_SNAP ( 1U << 1 ) /* stem height snapping */
158#define AF_LATIN_HINTS_STEM_ADJUST ( 1U << 2 ) /* stem width/height */
159 /* adjustment */
160#define AF_LATIN_HINTS_MONO ( 1U << 3 ) /* monochrome rendering */
161
162
163#define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \
164 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP )
165
166#define AF_LATIN_HINTS_DO_VERT_SNAP( h ) \
167 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP )
168
169#define AF_LATIN_HINTS_DO_STEM_ADJUST( h ) \
170 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST )
171
172#define AF_LATIN_HINTS_DO_MONO( h ) \
173 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO )
174
175
176 /*
177 * The next functions shouldn't normally be exported. However, other
178 * writing systems might like to use these functions as-is.
179 */
180 FT_LOCAL( FT_Error )
181 af_latin_hints_compute_segments( AF_GlyphHints hints,
182 AF_Dimension dim );
183
184 FT_LOCAL( void )
185 af_latin_hints_link_segments( AF_GlyphHints hints,
186 FT_UInt width_count,
187 AF_WidthRec* widths,
188 AF_Dimension dim );
189
190 FT_LOCAL( FT_Error )
191 af_latin_hints_compute_edges( AF_GlyphHints hints,
192 AF_Dimension dim );
193
194 FT_LOCAL( FT_Error )
195 af_latin_hints_detect_features( AF_GlyphHints hints,
196 FT_UInt width_count,
197 AF_WidthRec* widths,
198 AF_Dimension dim );
199
200/* */
201
202FT_END_HEADER
203
204#endif /* AFLATIN_H_ */
205
206
207/* END */