sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
autohint.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* autohint.h
4
*
5
* High-level 'autohint' module-specific interface (specification).
6
*
7
* Copyright (C) 1996-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
19
/**************************************************************************
20
*
21
* The auto-hinter is used to load and automatically hint glyphs if a
22
* format-specific hinter isn't available.
23
*
24
*/
25
26
31
#ifndef AUTOHINT_H_
32
#define AUTOHINT_H_
33
34
35
/**************************************************************************
36
*
37
* A small technical note regarding automatic hinting in order to clarify
38
* this module interface.
39
*
40
* An automatic hinter might compute two kinds of data for a given face:
41
*
42
* - global hints: Usually some metrics that describe global properties
43
* of the face. It is computed by scanning more or less
44
* aggressively the glyphs in the face, and thus can be
45
* very slow to compute (even if the size of global hints
46
* is really small).
47
*
48
* - glyph hints: These describe some important features of the glyph
49
* outline, as well as how to align them. They are
50
* generally much faster to compute than global hints.
51
*
52
* The current FreeType auto-hinter does a pretty good job while performing
53
* fast computations for both global and glyph hints. However, we might be
54
* interested in introducing more complex and powerful algorithms in the
55
* future, like the one described in the John D. Hobby paper, which
56
* unfortunately requires a lot more horsepower.
57
*
58
* Because a sufficiently sophisticated font management system would
59
* typically implement an LRU cache of opened face objects to reduce memory
60
* usage, it is a good idea to be able to avoid recomputing global hints
61
* every time the same face is re-opened.
62
*
63
* We thus provide the ability to cache global hints outside of the face
64
* object, in order to speed up font re-opening time. Of course, this
65
* feature is purely optional, so most client programs won't even notice
66
* it.
67
*
68
* I initially thought that it would be a good idea to cache the glyph
69
* hints too. However, my general idea now is that if you really need to
70
* cache these too, you are simply in need of a new font format, where all
71
* this information could be stored within the font file and decoded on the
72
* fly.
73
*
74
*/
75
76
77
#include <
freetype/freetype.h
>
78
79
80
FT_BEGIN_HEADER
81
82
83
typedef
struct
FT_AutoHinterRec_ *FT_AutoHinter;
84
85
86
/**************************************************************************
87
*
88
* @functype:
89
* FT_AutoHinter_GlobalGetFunc
90
*
91
* @description:
92
* Retrieve the global hints computed for a given face object. The
93
* resulting data is dissociated from the face and will survive a call to
94
* FT_Done_Face(). It must be discarded through the API
95
* FT_AutoHinter_GlobalDoneFunc().
96
*
97
* @input:
98
* hinter ::
99
* A handle to the source auto-hinter.
100
*
101
* face ::
102
* A handle to the source face object.
103
*
104
* @output:
105
* global_hints ::
106
* A typeless pointer to the global hints.
107
*
108
* global_len ::
109
* The size in bytes of the global hints.
110
*/
111
typedef
void
112
(*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter,
113
FT_Face face,
114
void
** global_hints,
115
long
* global_len );
116
117
118
/**************************************************************************
119
*
120
* @functype:
121
* FT_AutoHinter_GlobalDoneFunc
122
*
123
* @description:
124
* Discard the global hints retrieved through
125
* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints are
126
* freed from memory.
127
*
128
* @input:
129
* hinter ::
130
* A handle to the auto-hinter module.
131
*
132
* global ::
133
* A pointer to retrieved global hints to discard.
134
*/
135
typedef
void
136
(*FT_AutoHinter_GlobalDoneFunc)( FT_AutoHinter hinter,
137
void
* global );
138
139
140
/**************************************************************************
141
*
142
* @functype:
143
* FT_AutoHinter_GlobalResetFunc
144
*
145
* @description:
146
* This function is used to recompute the global metrics in a given font.
147
* This is useful when global font data changes (e.g. Multiple Masters
148
* fonts where blend coordinates change).
149
*
150
* @input:
151
* hinter ::
152
* A handle to the source auto-hinter.
153
*
154
* face ::
155
* A handle to the face.
156
*/
157
typedef
void
158
(*FT_AutoHinter_GlobalResetFunc)( FT_AutoHinter hinter,
159
FT_Face face );
160
161
162
/**************************************************************************
163
*
164
* @functype:
165
* FT_AutoHinter_GlyphLoadFunc
166
*
167
* @description:
168
* This function is used to load, scale, and automatically hint a glyph
169
* from a given face.
170
*
171
* @input:
172
* face ::
173
* A handle to the face.
174
*
175
* glyph_index ::
176
* The glyph index.
177
*
178
* load_flags ::
179
* The load flags.
180
*
181
* @note:
182
* This function is capable of loading composite glyphs by hinting each
183
* sub-glyph independently (which improves quality).
184
*
185
* It will call the font driver with @FT_Load_Glyph, with
186
* @FT_LOAD_NO_SCALE set.
187
*/
188
typedef
FT_Error
189
(*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter,
190
FT_GlyphSlot slot,
191
FT_Size size,
192
FT_UInt glyph_index,
193
FT_Int32 load_flags );
194
195
196
/**************************************************************************
197
*
198
* @struct:
199
* FT_AutoHinter_InterfaceRec
200
*
201
* @description:
202
* The auto-hinter module's interface.
203
*/
204
typedef
struct
FT_AutoHinter_InterfaceRec_
205
{
206
FT_AutoHinter_GlobalResetFunc reset_face;
207
FT_AutoHinter_GlobalGetFunc get_global_hints;
208
FT_AutoHinter_GlobalDoneFunc done_global_hints;
209
FT_AutoHinter_GlyphLoadFunc load_glyph;
210
211
} FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;
212
213
214
#define FT_DECLARE_AUTOHINTER_INTERFACE( class_ ) \
215
FT_CALLBACK_TABLE const FT_AutoHinter_InterfaceRec class_;
216
217
#define FT_DEFINE_AUTOHINTER_INTERFACE( \
218
class_, \
219
reset_face_, \
220
get_global_hints_, \
221
done_global_hints_, \
222
load_glyph_ ) \
223
FT_CALLBACK_TABLE_DEF \
224
const FT_AutoHinter_InterfaceRec class_ = \
225
{ \
226
reset_face_, \
227
get_global_hints_, \
228
done_global_hints_, \
229
load_glyph_ \
230
};
231
232
233
FT_END_HEADER
234
235
#endif
/* AUTOHINT_H_ */
236
237
238
/* END */
freetype.h
FT_AutoHinter_InterfaceRec_
Definition
autohint.h:205
freetype
include
freetype
internal
autohint.h
Generated by
1.18.0