ReactOS 0.4.16-dev-1067-ge98bba2
ttmtx.h File Reference
#include <ft2build.h>
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 229 of file ttmtx.c.

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

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

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