ReactOS 0.4.15-dev-5664-g3bf4ef6
ttmtx.c File Reference
#include <ft2build.h>
#include "ttmtx.h"
#include "sferrors.h"
Include dependency graph for ttmtx.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FT_COMPONENT   trace_ttmtx
 
#define FT_STRUCTURE   TT_HoriHeader
 

Functions

 tt_face_load_hmtx (TT_Face face, FT_Stream stream, FT_Bool vertical)
 
 tt_face_load_hhea (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)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_ttmtx

Definition at line 48 of file ttmtx.c.

◆ FT_STRUCTURE

#define FT_STRUCTURE   TT_HoriHeader

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 218 of file ttmtx.c.

223 {
225 FT_Stream stream = face->root.stream;
227 FT_ULong table_pos, table_size, table_end;
228 FT_UShort k;
229
230#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
231 FT_Service_MetricsVariations var =
232 (FT_Service_MetricsVariations)face->var;
233#endif
234
235
236 if ( vertical )
237 {
238 void* v = &face->vertical;
239
240
242 table_pos = face->vert_metrics_offset;
243 table_size = face->vert_metrics_size;
244 }
245 else
246 {
247 header = &face->horizontal;
248 table_pos = face->horz_metrics_offset;
249 table_size = face->horz_metrics_size;
250 }
251
252 table_end = table_pos + table_size;
253
254 k = header->number_Of_HMetrics;
255
256 if ( k > 0 )
257 {
258 if ( gindex < (FT_UInt)k )
259 {
260 table_pos += 4 * gindex;
261 if ( table_pos + 4 > table_end )
262 goto NoData;
263
264 if ( FT_STREAM_SEEK( table_pos ) ||
265 FT_READ_USHORT( *aadvance ) ||
266 FT_READ_SHORT( *abearing ) )
267 goto NoData;
268 }
269 else
270 {
271 table_pos += 4 * ( k - 1 );
272 if ( table_pos + 4 > table_end )
273 goto NoData;
274
275 if ( FT_STREAM_SEEK( table_pos ) ||
276 FT_READ_USHORT( *aadvance ) )
277 goto NoData;
278
279 table_pos += 4 + 2 * ( gindex - k );
280 if ( table_pos + 2 > table_end )
281 *abearing = 0;
282 else
283 {
284 if ( !FT_STREAM_SEEK( table_pos ) )
285 (void)FT_READ_SHORT( *abearing );
286 }
287 }
288 }
289 else
290 {
291 NoData:
292 *abearing = 0;
293 *aadvance = 0;
294 }
295
296#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
297 if ( var )
298 {
299 FT_Face f = FT_FACE( face );
300 FT_Int a = (FT_Int)*aadvance;
301 FT_Int b = (FT_Int)*abearing;
302
303
304 if ( vertical )
305 {
306 if ( var->vadvance_adjust )
307 var->vadvance_adjust( f, gindex, &a );
308 if ( var->tsb_adjust )
309 var->tsb_adjust( f, gindex, &b );
310 }
311 else
312 {
313 if ( var->hadvance_adjust )
314 var->hadvance_adjust( f, gindex, &a );
315 if ( var->lsb_adjust )
316 var->lsb_adjust( f, gindex, &b );
317 }
318
319 *aadvance = (FT_UShort)a;
320 *abearing = (FT_Short)b;
321 }
322#endif
323 }
#define FT_FACE(x)
Definition: ftobjs.h:630
#define FT_READ_USHORT(var)
Definition: ftstream.h:309
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:489
#define FT_READ_SHORT(var)
Definition: ftstream.h:308
unsigned long FT_ULong
Definition: fttypes.h:253
int FT_Error
Definition: fttypes.h:300
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()

tt_face_load_hhea ( TT_Face  face,
FT_Stream  stream,
FT_Bool  vertical 
)

Definition at line 124 of file ttmtx.c.

127 {
130
131 static const FT_Frame_Field metrics_header_fields[] =
132 {
133#undef FT_STRUCTURE
134#define FT_STRUCTURE TT_HoriHeader
135
136 FT_FRAME_START( 36 ),
138 FT_FRAME_SHORT ( Ascender ),
139 FT_FRAME_SHORT ( Descender ),
140 FT_FRAME_SHORT ( Line_Gap ),
141 FT_FRAME_USHORT( advance_Width_Max ),
142 FT_FRAME_SHORT ( min_Left_Side_Bearing ),
143 FT_FRAME_SHORT ( min_Right_Side_Bearing ),
144 FT_FRAME_SHORT ( xMax_Extent ),
145 FT_FRAME_SHORT ( caret_Slope_Rise ),
146 FT_FRAME_SHORT ( caret_Slope_Run ),
147 FT_FRAME_SHORT ( caret_Offset ),
152 FT_FRAME_SHORT ( metric_Data_Format ),
153 FT_FRAME_USHORT( number_Of_HMetrics ),
155 };
156
157
158 if ( vertical )
159 {
160 void *v = &face->vertical;
161
162
163 error = face->goto_table( face, TTAG_vhea, stream, 0 );
164 if ( error )
165 goto Fail;
166
168 }
169 else
170 {
171 error = face->goto_table( face, TTAG_hhea, stream, 0 );
172 if ( error )
173 goto Fail;
174
175 header = &face->horizontal;
176 }
177
178 if ( FT_STREAM_READ_FIELDS( metrics_header_fields, header ) )
179 goto Fail;
180
181 FT_TRACE3(( "Ascender: %5d\n", header->Ascender ));
182 FT_TRACE3(( "Descender: %5d\n", header->Descender ));
183 FT_TRACE3(( "number_Of_Metrics: %5u\n", header->number_Of_HMetrics ));
184
185 header->long_metrics = NULL;
186 header->short_metrics = NULL;
187
188 Fail:
189 return error;
190 }
#define NULL
Definition: types.h:112
int Fail
Definition: ehthrow.cxx:24
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
#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:508
#define FT_FRAME_START(size)
Definition: ftstream.h:117
#define FT_FRAME_USHORT(f)
Definition: ftstream.h:123
#define TTAG_hhea
Definition: tttags.h:68
#define TTAG_vhea
Definition: tttags.h:104
_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 70 of file ttmtx.c.

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