ReactOS 0.4.16-dev-2357-g35d0dfe
ttmtx.h File Reference
Include dependency graph for ttmtx.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

FT_BEGIN_HEADER tt_face_load_hhea (TT_Face face, FT_Stream stream, FT_Bool vertical)
 
 tt_face_load_hmtx (TT_Face face, FT_Stream stream, FT_Bool vertical)
 
 tt_face_get_metrics (TT_Face face, FT_Bool vertical, FT_UInt gindex, FT_Short *abearing, FT_UShort *aadvance)
 

Function Documentation

◆ tt_face_get_metrics()

tt_face_get_metrics ( TT_Face  face,
FT_Bool  vertical,
FT_UInt  gindex,
FT_Short abearing,
FT_UShort aadvance 
)

Definition at line 228 of file ttmtx.c.

233 {
235 FT_Stream stream = face->root.stream;
237 FT_ULong table_pos, table_size, table_end;
238 FT_UShort k;
239
240#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
241 FT_Service_MetricsVariations var =
242 (FT_Service_MetricsVariations)face->var;
243#endif
244
245
246 if ( vertical )
247 {
248 void* v = &face->vertical;
249
250
252 table_pos = face->vert_metrics_offset;
253 table_size = face->vert_metrics_size;
254 }
255 else
256 {
257 header = &face->horizontal;
258 table_pos = face->horz_metrics_offset;
259 table_size = face->horz_metrics_size;
260 }
261
262 table_end = table_pos + table_size;
263
264 k = header->number_Of_HMetrics;
265
266 if ( k > 0 )
267 {
268 if ( gindex < (FT_UInt)k )
269 {
270 table_pos += 4 * gindex;
271 if ( table_pos + 4 > table_end )
272 goto NoData;
273
274 if ( FT_STREAM_SEEK( table_pos ) ||
275 FT_READ_USHORT( *aadvance ) ||
276 FT_READ_SHORT( *abearing ) )
277 goto NoData;
278 }
279 else
280 {
281 table_pos += 4 * ( k - 1 );
282 if ( table_pos + 2 > table_end )
283 goto NoData;
284
285 if ( FT_STREAM_SEEK( table_pos ) ||
286 FT_READ_USHORT( *aadvance ) )
287 goto NoData;
288
289 table_pos += 4 + 2 * ( gindex - k );
290 if ( table_pos + 2 > table_end )
291 *abearing = 0;
292 else
293 {
294 if ( FT_STREAM_SEEK( table_pos ) )
295 *abearing = 0;
296 else
297 (void)FT_READ_SHORT( *abearing );
298 }
299 }
300 }
301 else
302 {
303 NoData:
304 *abearing = 0;
305 *aadvance = 0;
306 }
307
308#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
309 if ( var )
310 {
311 FT_Face f = FT_FACE( face );
312 FT_Int a = (FT_Int)*aadvance;
313 FT_Int b = (FT_Int)*abearing;
314
315
316 if ( vertical )
317 {
318 if ( var->vadvance_adjust )
319 var->vadvance_adjust( f, gindex, &a );
320 if ( var->tsb_adjust )
321 var->tsb_adjust( f, gindex, &b );
322 }
323 else
324 {
325 if ( var->hadvance_adjust )
326 var->hadvance_adjust( f, gindex, &a );
327 if ( var->lsb_adjust )
328 var->lsb_adjust( f, gindex, &b );
329 }
330
331 *aadvance = (FT_UShort)a;
332 *abearing = (FT_Short)b;
333 }
334#endif
335 }
#define FT_FACE(x)
Definition: ftobjs.h:597
#define FT_READ_USHORT(var)
Definition: ftstream.h:339
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:525
#define FT_READ_SHORT(var)
Definition: ftstream.h:338
unsigned long FT_ULong
Definition: fttypes.h:253
int FT_Error
Definition: fttypes.h:299
unsigned short FT_UShort
Definition: fttypes.h:209
signed short FT_Short
Definition: fttypes.h:198
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
const GLdouble * v
Definition: gl.h:2040
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
const char * var
Definition: shader.c:5666
int k
Definition: mpi.c:3369
LOCAL int table_size
Definition: write.c:65
Definition: parse.h:23

◆ tt_face_load_hhea()

FT_BEGIN_HEADER tt_face_load_hhea ( TT_Face  face,
FT_Stream  stream,
FT_Bool  vertical 
)

Definition at line 129 of file ttmtx.c.

132 {
135
136 static const FT_Frame_Field metrics_header_fields[] =
137 {
138#undef FT_STRUCTURE
139#define FT_STRUCTURE TT_HoriHeader
140
141 FT_FRAME_START( 36 ),
143 FT_FRAME_SHORT ( Ascender ),
144 FT_FRAME_SHORT ( Descender ),
145 FT_FRAME_SHORT ( Line_Gap ),
146 FT_FRAME_USHORT( advance_Width_Max ),
147 FT_FRAME_SHORT ( min_Left_Side_Bearing ),
148 FT_FRAME_SHORT ( min_Right_Side_Bearing ),
149 FT_FRAME_SHORT ( xMax_Extent ),
150 FT_FRAME_SHORT ( caret_Slope_Rise ),
151 FT_FRAME_SHORT ( caret_Slope_Run ),
152 FT_FRAME_SHORT ( caret_Offset ),
157 FT_FRAME_SHORT ( metric_Data_Format ),
158 FT_FRAME_USHORT( number_Of_HMetrics ),
160 };
161
162
163 if ( vertical )
164 {
165 void *v = &face->vertical;
166
167
168 error = face->goto_table( face, TTAG_vhea, stream, 0 );
169 if ( error )
170 goto Fail;
171
173 }
174 else
175 {
176 error = face->goto_table( face, TTAG_hhea, stream, 0 );
177 if ( error )
178 goto Fail;
179
180 header = &face->horizontal;
181 }
182
183 if ( FT_STREAM_READ_FIELDS( metrics_header_fields, header ) )
184 goto Fail;
185
186 FT_TRACE3(( "Ascender: %5d\n", header->Ascender ));
187 FT_TRACE3(( "Descender: %5d\n", header->Descender ));
188 FT_TRACE3(( "number_Of_Metrics: %5u\n", header->number_Of_HMetrics ));
189
190 header->long_metrics = NULL;
191 header->short_metrics = NULL;
192
193 Fail:
194 return error;
195 }
#define NULL
Definition: types.h:112
int Fail
Definition: ehthrow.cxx:24
#define FT_TRACE3(varformat)
Definition: ftdebug.h:190
#define FT_FRAME_END
Definition: ftstream.h:118
#define FT_FRAME_SHORT(f)
Definition: ftstream.h:122
#define FT_FRAME_ULONG(f)
Definition: ftstream.h:121
#define FT_STREAM_READ_FIELDS(fields, object)
Definition: ftstream.h:544
#define FT_FRAME_START(size)
Definition: ftstream.h:117
#define FT_FRAME_USHORT(f)
Definition: ftstream.h:123
#define TTAG_hhea
Definition: tttags.h:69
#define TTAG_vhea
Definition: tttags.h:105
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Reserved_ PVOID Reserved
Definition: winddi.h:3974

◆ tt_face_load_hmtx()

tt_face_load_hmtx ( TT_Face  face,
FT_Stream  stream,
FT_Bool  vertical 
)

Definition at line 72 of file ttmtx.c.

75 {
78 FT_ULong* ptable_offset;
79 FT_ULong* ptable_size;
80
81
82 if ( vertical )
83 {
84 tag = TTAG_vmtx;
85 ptable_offset = &face->vert_metrics_offset;
86 ptable_size = &face->vert_metrics_size;
87 }
88 else
89 {
90 tag = TTAG_hmtx;
91 ptable_offset = &face->horz_metrics_offset;
92 ptable_size = &face->horz_metrics_size;
93 }
94
95 error = face->goto_table( face, tag, stream, &table_size );
96 if ( error )
97 goto Fail;
98
99 *ptable_size = table_size;
100 *ptable_offset = FT_STREAM_POS();
101
102 Fail:
103 return error;
104 }
#define FT_STREAM_POS()
Definition: ftstream.h:522
Definition: ecma_167.h:138
#define TTAG_hmtx
Definition: tttags.h:70
#define TTAG_vmtx
Definition: tttags.h:106