ReactOS  0.4.13-dev-922-g2fbff73
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 218 of file ttmtx.c.

223  {
224  FT_Error error;
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 
241  header = (TT_HoriHeader*)v;
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  }
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define error(str)
Definition: mkdosfs.c:1605
signed int FT_Int
Definition: fttypes.h:220
#define FT_READ_USHORT(var)
Definition: ftstream.h:309
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: parse.h:22
signed short FT_Short
Definition: fttypes.h:198
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:489
#define FT_FACE(x)
Definition: ftobjs.h:630
const GLdouble * v
Definition: gl.h:2040
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_READ_SHORT(var)
Definition: ftstream.h:308
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
unsigned short FT_UShort
Definition: fttypes.h:209
int k
Definition: mpi.c:3369
struct CFHEADER header
Definition: fdi.c:109
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
LOCAL int table_size
Definition: write.c:65

◆ tt_face_load_hhea()

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

Definition at line 124 of file ttmtx.c.

127  {
128  FT_Error error;
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 ),
148  FT_FRAME_SHORT ( Reserved[0] ),
149  FT_FRAME_SHORT ( Reserved[1] ),
150  FT_FRAME_SHORT ( Reserved[2] ),
151  FT_FRAME_SHORT ( Reserved[3] ),
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 
167  header = (TT_HoriHeader*)v;
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  }
int FT_Error
Definition: fttypes.h:300
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
#define error(str)
Definition: mkdosfs.c:1605
#define TTAG_vhea
Definition: tttags.h:104
#define TTAG_hhea
Definition: tttags.h:68
smooth NULL
Definition: ftsmooth.c:416
#define FT_STREAM_READ_FIELDS(fields, object)
Definition: ftstream.h:508
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
#define FT_FRAME_END
Definition: ftstream.h:118
#define FT_FRAME_USHORT(f)
Definition: ftstream.h:123
Definition: parse.h:22
#define FT_TRACE3(varformat)
Definition: ftdebug.h:160
Definition: hiveinit.c:368
#define FT_FRAME_ULONG(f)
Definition: ftstream.h:121
const GLdouble * v
Definition: gl.h:2040
#define FT_FRAME_SHORT(f)
Definition: ftstream.h:122
struct CFHEADER header
Definition: fdi.c:109
#define FT_FRAME_START(size)
Definition: ftstream.h:117
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ 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  }
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define error(str)
Definition: mkdosfs.c:1605
Definition: ecma_167.h:138
#define TTAG_hmtx
Definition: tttags.h:69
Definition: parse.h:22
#define TTAG_vmtx
Definition: tttags.h:105
Definition: hiveinit.c:368
#define FT_STREAM_POS()
Definition: ftstream.h:486
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
LOCAL int table_size
Definition: write.c:65
char * tag
Definition: main.c:59