ReactOS 0.4.15-dev-6662-g1b3eed5
pfrobjs.c File Reference
#include "pfrobjs.h"
#include "pfrload.h"
#include "pfrgload.h"
#include "pfrcmap.h"
#include "pfrsbit.h"
#include "pfrerror.h"
Include dependency graph for pfrobjs.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_pfr
 

Functions

 pfr_face_done (FT_Face pfrface)
 
 pfr_face_init (FT_Stream stream, FT_Face pfrface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
 
 pfr_slot_init (FT_GlyphSlot pfrslot)
 
 pfr_slot_done (FT_GlyphSlot pfrslot)
 
 pfr_slot_load (FT_GlyphSlot pfrslot, FT_Size pfrsize, FT_UInt gindex, FT_Int32 load_flags)
 
 pfr_face_get_kerning (FT_Face pfrface, FT_UInt glyph1, FT_UInt glyph2, FT_Vector *kerning)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_pfr

Definition at line 32 of file pfrobjs.c.

Function Documentation

◆ pfr_face_done()

pfr_face_done ( FT_Face  pfrface)

Definition at line 44 of file pfrobjs.c.

45 {
46 PFR_Face face = (PFR_Face)pfrface;
48
49
50 if ( !face )
51 return;
52
53 memory = pfrface->driver->root.memory;
54
55 /* we don't want dangling pointers */
56 pfrface->family_name = NULL;
57 pfrface->style_name = NULL;
58
59 /* finalize the physical font record */
60 pfr_phy_font_done( &face->phy_font, FT_FACE_MEMORY( face ) );
61
62 /* no need to finalize the logical font or the header */
63 FT_FREE( pfrface->available_sizes );
64 }
#define NULL
Definition: types.h:112
#define FT_FREE(ptr)
Definition: ftmemory.h:329
#define FT_FACE_MEMORY(x)
Definition: ftobjs.h:636
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
static char memory[1024 *256]
Definition: process.c:116
pfr_phy_font_done(PFR_PhyFont phy_font, FT_Memory memory)
Definition: pfrload.c:778
typedefFT_BEGIN_HEADER struct PFR_FaceRec_ * PFR_Face
Definition: pfrobjs.h:27
FT_ModuleRec root
Definition: ftobjs.h:829
FT_Driver driver
Definition: freetype.h:1111
FT_Bitmap_Size * available_sizes
Definition: freetype.h:1082
FT_String * style_name
Definition: freetype.h:1079
FT_String * family_name
Definition: freetype.h:1078
FT_Memory memory
Definition: ftobjs.h:537

◆ pfr_face_get_kerning()

pfr_face_get_kerning ( FT_Face  pfrface,
FT_UInt  glyph1,
FT_UInt  glyph2,
FT_Vector kerning 
)

Definition at line 471 of file pfrobjs.c.

475 {
476 PFR_Face face = (PFR_Face)pfrface;
478 PFR_PhyFont phy_font = &face->phy_font;
479 FT_UInt32 code1, code2, pair;
480
481
482 kerning->x = 0;
483 kerning->y = 0;
484
485 if ( glyph1 > 0 )
486 glyph1--;
487
488 if ( glyph2 > 0 )
489 glyph2--;
490
491 /* convert glyph indices to character codes */
492 if ( glyph1 > phy_font->num_chars ||
493 glyph2 > phy_font->num_chars )
494 goto Exit;
495
496 code1 = phy_font->chars[glyph1].char_code;
497 code2 = phy_font->chars[glyph2].char_code;
498 pair = PFR_KERN_INDEX( code1, code2 );
499
500 /* now search the list of kerning items */
501 {
502 PFR_KernItem item = phy_font->kern_items;
503 FT_Stream stream = pfrface->stream;
504
505
506 for ( ; item; item = item->next )
507 {
508 if ( pair >= item->pair1 && pair <= item->pair2 )
509 goto FoundPair;
510 }
511 goto Exit;
512
513 FoundPair: /* we found an item, now parse it and find the value if any */
514 if ( FT_STREAM_SEEK( item->offset ) ||
515 FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
516 goto Exit;
517
518 {
519 FT_UInt count = item->pair_count;
520 FT_UInt size = item->pair_size;
521 FT_UInt power = 1 << FT_MSB( count );
522 FT_UInt probe = power * size;
524 FT_Byte* base = stream->cursor;
525 FT_Bool twobytes = FT_BOOL( item->flags & PFR_KERN_2BYTE_CHAR );
526 FT_Bool twobyte_adj = FT_BOOL( item->flags & PFR_KERN_2BYTE_ADJ );
527 FT_Byte* p;
528 FT_UInt32 cpair;
529
530
531 if ( extra > 0 )
532 {
533 p = base + extra * size;
534
535 if ( twobytes )
536 cpair = FT_NEXT_ULONG( p );
537 else
538 cpair = PFR_NEXT_KPAIR( p );
539
540 if ( cpair == pair )
541 goto Found;
542
543 if ( cpair < pair )
544 {
545 if ( twobyte_adj )
546 p += 2;
547 else
548 p++;
549 base = p;
550 }
551 }
552
553 while ( probe > size )
554 {
555 probe >>= 1;
556 p = base + probe;
557
558 if ( twobytes )
559 cpair = FT_NEXT_ULONG( p );
560 else
561 cpair = PFR_NEXT_KPAIR( p );
562
563 if ( cpair == pair )
564 goto Found;
565
566 if ( cpair < pair )
567 base += probe;
568 }
569
570 p = base;
571
572 if ( twobytes )
573 cpair = FT_NEXT_ULONG( p );
574 else
575 cpair = PFR_NEXT_KPAIR( p );
576
577 if ( cpair == pair )
578 {
580
581
582 Found:
583 if ( twobyte_adj )
584 value = FT_PEEK_SHORT( p );
585 else
586 value = p[0];
587
588 kerning->x = item->base_adj + value;
589 }
590 }
591
593 }
594
595 Exit:
596 return error;
597 }
return Found
Definition: dirsup.c:1270
return FT_Err_Ok
Definition: ftbbox.c:511
FT_MSB(FT_UInt32 z)
Definition: ftcalc.c:114
#define FT_FRAME_ENTER(size)
Definition: ftstream.h:512
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:489
#define FT_FRAME_EXIT()
Definition: ftstream.h:517
#define FT_PEEK_SHORT(p)
Definition: ftstream.h:168
#define FT_NEXT_ULONG(buffer)
Definition: ftstream.h:238
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned char FT_Byte
Definition: fttypes.h:154
int FT_Error
Definition: fttypes.h:300
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_BOOL(x)
Definition: fttypes.h:578
signed int FT_Int
Definition: fttypes.h:220
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLfloat GLfloat p
Definition: glext.h:8902
@ extra
Definition: id3.c:95
#define error(str)
Definition: mkdosfs.c:1605
float power
Definition: d3drm.c:3372
static ATOM item
Definition: dde.c:856
#define PFR_KERN_INDEX(g1, g2)
Definition: pfrtypes.h:193
#define PFR_KERN_2BYTE_CHAR
Definition: pfrtypes.h:261
#define PFR_NEXT_KPAIR(p)
Definition: pfrtypes.h:199
#define PFR_KERN_2BYTE_ADJ
Definition: pfrtypes.h:262
static void Exit(void)
Definition: sock.c:1330
FT_Stream stream
Definition: freetype.h:1113
FT_Pos x
Definition: ftimage.h:76
FT_Pos y
Definition: ftimage.h:77
FT_UInt char_code
Definition: pfrtypes.h:157
PFR_KernItem kern_items
Definition: pfrtypes.h:242
FT_UInt num_chars
Definition: pfrtypes.h:237
PFR_Char chars
Definition: pfrtypes.h:239
Definition: _pair.h:47
Definition: parse.h:23
FT_UInt FT_UInt FT_Vector * kerning
Definition: ttdriver.c:204
Definition: pdh_main.c:94

Referenced by pfr_get_kerning().

◆ pfr_face_init()

pfr_face_init ( FT_Stream  stream,
FT_Face  pfrface,
FT_Int  face_index,
FT_Int  num_params,
FT_Parameter params 
)

Definition at line 68 of file pfrobjs.c.

73 {
74 PFR_Face face = (PFR_Face)pfrface;
76
77 FT_UNUSED( num_params );
79
80
81 FT_TRACE2(( "PFR driver\n" ));
82
83 /* load the header and check it */
84 error = pfr_header_load( &face->header, stream );
85 if ( error )
86 goto Exit;
87
88 if ( !pfr_header_check( &face->header ) )
89 {
90 FT_TRACE2(( " not a PFR font\n" ));
91 error = FT_THROW( Unknown_File_Format );
92 goto Exit;
93 }
94
95 /* check face index */
96 {
97 FT_Long num_faces;
98
99
101 face->header.log_dir_offset,
102 &num_faces );
103 if ( error )
104 goto Exit;
105
106 pfrface->num_faces = num_faces;
107 }
108
109 if ( face_index < 0 )
110 goto Exit;
111
112 if ( ( face_index & 0xFFFF ) >= pfrface->num_faces )
113 {
114 FT_ERROR(( "pfr_face_init: invalid face index\n" ));
115 error = FT_THROW( Invalid_Argument );
116 goto Exit;
117 }
118
119 /* load the face */
121 &face->log_font,
122 stream,
123 (FT_UInt)( face_index & 0xFFFF ),
124 face->header.log_dir_offset,
125 FT_BOOL( face->header.phy_font_max_size_high != 0 ) );
126 if ( error )
127 goto Exit;
128
129 /* now load the physical font descriptor */
130 error = pfr_phy_font_load( &face->phy_font, stream,
131 face->log_font.phys_offset,
132 face->log_font.phys_size );
133 if ( error )
134 goto Exit;
135
136 /* now set up all root face fields */
137 {
138 PFR_PhyFont phy_font = &face->phy_font;
139
140
141 pfrface->face_index = face_index & 0xFFFF;
142 pfrface->num_glyphs = (FT_Long)phy_font->num_chars + 1;
143
145
146 /* if gps_offset == 0 for all characters, we */
147 /* assume that the font only contains bitmaps */
148 {
149 FT_UInt nn;
150
151
152 for ( nn = 0; nn < phy_font->num_chars; nn++ )
153 if ( phy_font->chars[nn].gps_offset != 0 )
154 break;
155
156 if ( nn == phy_font->num_chars )
157 {
158 if ( phy_font->num_strikes > 0 )
159 pfrface->face_flags = 0; /* not scalable */
160 else
161 {
162 FT_ERROR(( "pfr_face_init: font doesn't contain glyphs\n" ));
163 error = FT_THROW( Invalid_File_Format );
164 goto Exit;
165 }
166 }
167 }
168
169 if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 )
171
172 if ( phy_font->flags & PFR_PHY_VERTICAL )
174 else
176
177 if ( phy_font->num_strikes > 0 )
179
180 if ( phy_font->num_kern_pairs > 0 )
182
183 /* If no family name was found in the `undocumented' auxiliary
184 * data, use the font ID instead. This sucks but is better than
185 * nothing.
186 */
187 pfrface->family_name = phy_font->family_name;
188 if ( !pfrface->family_name )
189 pfrface->family_name = phy_font->font_id;
190
191 /* note that the style name can be NULL in certain PFR fonts,
192 * probably meaning `Regular'
193 */
194 pfrface->style_name = phy_font->style_name;
195
196 pfrface->num_fixed_sizes = 0;
197 pfrface->available_sizes = NULL;
198
199 pfrface->bbox = phy_font->bbox;
200 pfrface->units_per_EM = (FT_UShort)phy_font->outline_resolution;
201 pfrface->ascender = (FT_Short) phy_font->bbox.yMax;
202 pfrface->descender = (FT_Short) phy_font->bbox.yMin;
203
204 pfrface->height = (FT_Short)( ( pfrface->units_per_EM * 12 ) / 10 );
205 if ( pfrface->height < pfrface->ascender - pfrface->descender )
206 pfrface->height = (FT_Short)(pfrface->ascender - pfrface->descender);
207
208 if ( phy_font->num_strikes > 0 )
209 {
210 FT_UInt n, count = phy_font->num_strikes;
212 PFR_Strike strike;
213 FT_Memory memory = pfrface->stream->memory;
214
215
216 if ( FT_NEW_ARRAY( pfrface->available_sizes, count ) )
217 goto Exit;
218
219 size = pfrface->available_sizes;
220 strike = phy_font->strikes;
221 for ( n = 0; n < count; n++, size++, strike++ )
222 {
223 size->height = (FT_Short)strike->y_ppm;
224 size->width = (FT_Short)strike->x_ppm;
225 size->size = (FT_Pos)( strike->y_ppm << 6 );
226 size->x_ppem = (FT_Pos)( strike->x_ppm << 6 );
227 size->y_ppem = (FT_Pos)( strike->y_ppm << 6 );
228 }
229 pfrface->num_fixed_sizes = (FT_Int)count;
230 }
231
232 /* now compute maximum advance width */
233 if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 )
234 pfrface->max_advance_width = (FT_Short)phy_font->standard_advance;
235 else
236 {
237 FT_Int max = 0;
238 FT_UInt count = phy_font->num_chars;
239 PFR_Char gchar = phy_font->chars;
240
241
242 for ( ; count > 0; count--, gchar++ )
243 {
244 if ( max < gchar->advance )
245 max = gchar->advance;
246 }
247
248 pfrface->max_advance_width = (FT_Short)max;
249 }
250
251 pfrface->max_advance_height = pfrface->height;
252
253 pfrface->underline_position = (FT_Short)( -pfrface->units_per_EM / 10 );
254 pfrface->underline_thickness = (FT_Short)( pfrface->units_per_EM / 30 );
255
256 /* create charmap */
257 {
258 FT_CharMapRec charmap;
259
260
261 charmap.face = pfrface;
264 charmap.encoding = FT_ENCODING_UNICODE;
265
266 error = FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL );
267 }
268
269 /* check whether we have loaded any kerning pairs */
270 if ( phy_font->num_kern_pairs )
272 }
273
274 Exit:
275 return error;
276 }
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
#define TT_MS_ID_UNICODE_CS
Definition: font.c:1181
#define TT_PLATFORM_MICROSOFT
Definition: font.c:1174
#define FT_FACE_FLAG_KERNING
Definition: freetype.h:1244
#define FT_FACE_FLAG_FIXED_SIZES
Definition: freetype.h:1239
#define FT_FACE_FLAG_SCALABLE
Definition: freetype.h:1238
#define FT_FACE_FLAG_FIXED_WIDTH
Definition: freetype.h:1240
#define FT_FACE_FLAG_VERTICAL
Definition: freetype.h:1243
#define FT_FACE_FLAG_HORIZONTAL
Definition: freetype.h:1242
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_TRACE2(varformat)
Definition: ftdebug.h:159
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:58
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:333
FT_CMap_New(FT_CMap_Class clazz, FT_Pointer init_data, FT_CharMap charmap, FT_CMap *acmap)
Definition: ftobjs.c:3614
signed long FT_Long
Definition: fttypes.h:242
unsigned short FT_UShort
Definition: fttypes.h:209
signed short FT_Short
Definition: fttypes.h:198
GLdouble n
Definition: glext.h:7729
GLenum const GLfloat * params
Definition: glext.h:5645
#define for
Definition: utility.h:88
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pfr_cmap_class_rec
Definition: pfrcmap.c:160
pfr_log_font_count(FT_Stream stream, FT_UInt32 section_offset, FT_Long *acount)
Definition: pfrload.c:289
pfr_log_font_load(PFR_LogFont log_font, FT_Stream stream, FT_UInt idx, FT_UInt32 section_offset, FT_Bool size_increment)
Definition: pfrload.c:327
pfr_header_load(PFR_Header header, FT_Stream stream)
Definition: pfrload.c:241
pfr_header_check(PFR_Header header)
Definition: pfrload.c:261
pfr_phy_font_load(PFR_PhyFont phy_font, FT_Stream stream, FT_UInt32 offset, FT_UInt32 size)
Definition: pfrload.c:822
#define PFR_PHY_PROPORTIONAL
Definition: pfrtypes.h:254
#define PFR_PHY_VERTICAL
Definition: pfrtypes.h:252
FT_Pos yMax
Definition: ftimage.h:118
FT_Pos yMin
Definition: ftimage.h:117
FT_Face face
Definition: freetype.h:842
FT_Encoding encoding
Definition: freetype.h:843
FT_UShort platform_id
Definition: freetype.h:844
FT_UShort encoding_id
Definition: freetype.h:845
FT_Long num_glyphs
Definition: freetype.h:1076
FT_Short height
Definition: freetype.h:1097
FT_Short underline_thickness
Definition: freetype.h:1103
FT_Short descender
Definition: freetype.h:1096
FT_BBox bbox
Definition: freetype.h:1092
FT_UShort units_per_EM
Definition: freetype.h:1094
FT_Int num_fixed_sizes
Definition: freetype.h:1081
FT_Long face_index
Definition: freetype.h:1071
FT_Short max_advance_height
Definition: freetype.h:1100
FT_Short underline_position
Definition: freetype.h:1102
FT_Short max_advance_width
Definition: freetype.h:1099
FT_Long face_flags
Definition: freetype.h:1073
FT_Long num_faces
Definition: freetype.h:1070
FT_Short ascender
Definition: freetype.h:1095
FT_Memory memory
Definition: ftsystem.h:341
FT_UInt32 gps_offset
Definition: pfrtypes.h:160
FT_Int advance
Definition: pfrtypes.h:158
FT_UInt outline_resolution
Definition: pfrtypes.h:211
FT_String * font_id
Definition: pfrtypes.h:224
FT_UInt flags
Definition: pfrtypes.h:214
FT_BBox bbox
Definition: pfrtypes.h:213
FT_String * family_name
Definition: pfrtypes.h:225
FT_UInt num_kern_pairs
Definition: pfrtypes.h:241
PFR_StrikeRec * strikes
Definition: pfrtypes.h:230
FT_Int standard_advance
Definition: pfrtypes.h:215
FT_String * style_name
Definition: pfrtypes.h:226
FT_UInt num_strikes
Definition: pfrtypes.h:228
FT_UInt x_ppm
Definition: pfrtypes.h:136
FT_UInt y_ppm
Definition: pfrtypes.h:137
#define max(a, b)
Definition: svc.c:63

◆ pfr_slot_done()

pfr_slot_done ( FT_GlyphSlot  pfrslot)

Definition at line 301 of file pfrobjs.c.

302 {
303 PFR_Slot slot = (PFR_Slot)pfrslot;
304
305
306 pfr_glyph_done( &slot->glyph );
307 }
pfr_glyph_done(PFR_Glyph glyph)
Definition: pfrgload.c:53
struct PFR_SlotRec_ * PFR_Slot
Definition: pfrobjs.h:31
Definition: vfat.h:185

◆ pfr_slot_init()

pfr_slot_init ( FT_GlyphSlot  pfrslot)

Definition at line 288 of file pfrobjs.c.

289 {
290 PFR_Slot slot = (PFR_Slot)pfrslot;
291 FT_GlyphLoader loader = pfrslot->internal->loader;
292
293
294 pfr_glyph_init( &slot->glyph, loader );
295
296 return 0;
297 }
pfr_glyph_init(PFR_Glyph glyph, FT_GlyphLoader loader)
Definition: pfrgload.c:40
FT_Slot_Internal internal
Definition: freetype.h:1940
FT_GlyphLoader loader
Definition: ftobjs.h:467

◆ pfr_slot_load()

pfr_slot_load ( FT_GlyphSlot  pfrslot,
FT_Size  pfrsize,
FT_UInt  gindex,
FT_Int32  load_flags 
)

Definition at line 311 of file pfrobjs.c.

315 {
316 PFR_Slot slot = (PFR_Slot)pfrslot;
317 PFR_Size size = (PFR_Size)pfrsize;
319 PFR_Face face = (PFR_Face)pfrslot->face;
320 PFR_Char gchar;
321 FT_Outline* outline = &pfrslot->outline;
322 FT_ULong gps_offset;
323
324
325 FT_TRACE1(( "pfr_slot_load: glyph index %d\n", gindex ));
326
327 if ( gindex > 0 )
328 gindex--;
329
330 if ( !face || gindex >= face->phy_font.num_chars )
331 {
332 error = FT_THROW( Invalid_Argument );
333 goto Exit;
334 }
335
336 /* try to load an embedded bitmap */
337 if ( ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) == 0 )
338 {
340 slot,
341 size,
342 gindex,
343 ( load_flags & FT_LOAD_BITMAP_METRICS_ONLY ) != 0 );
344 if ( !error )
345 goto Exit;
346 }
347
348 if ( load_flags & FT_LOAD_SBITS_ONLY )
349 {
350 error = FT_THROW( Invalid_Argument );
351 goto Exit;
352 }
353
354 gchar = face->phy_font.chars + gindex;
356 outline->n_points = 0;
357 outline->n_contours = 0;
358 gps_offset = face->header.gps_section_offset;
359
360 /* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */
361 error = pfr_glyph_load( &slot->glyph, face->root.stream,
362 gps_offset, gchar->gps_offset, gchar->gps_size );
363
364 if ( !error )
365 {
366 FT_BBox cbox;
367 FT_Glyph_Metrics* metrics = &pfrslot->metrics;
369 FT_UInt em_metrics, em_outline;
370 FT_Bool scaling;
371
372
373 scaling = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
374
375 /* copy outline data */
376 *outline = slot->glyph.loader->base.outline;
377
378 outline->flags &= ~FT_OUTLINE_OWNER;
380
381 if ( size && pfrsize->metrics.y_ppem < 24 )
383
384 /* compute the advance vector */
385 metrics->horiAdvance = 0;
386 metrics->vertAdvance = 0;
387
388 advance = gchar->advance;
389 em_metrics = face->phy_font.metrics_resolution;
390 em_outline = face->phy_font.outline_resolution;
391
392 if ( em_metrics != em_outline )
394 (FT_Long)em_outline,
395 (FT_Long)em_metrics );
396
397 if ( face->phy_font.flags & PFR_PHY_VERTICAL )
398 metrics->vertAdvance = advance;
399 else
400 metrics->horiAdvance = advance;
401
402 pfrslot->linearHoriAdvance = metrics->horiAdvance;
403 pfrslot->linearVertAdvance = metrics->vertAdvance;
404
405 /* make up vertical metrics(?) */
406 metrics->vertBearingX = 0;
407 metrics->vertBearingY = 0;
408
409#if 0 /* some fonts seem to be broken here! */
410
411 /* Apply the font matrix, if any. */
412 /* TODO: Test existing fonts with unusual matrix */
413 /* whether we have to adjust Units per EM. */
414 {
415 FT_Matrix font_matrix;
416
417
418 font_matrix.xx = face->log_font.matrix[0] << 8;
419 font_matrix.yx = face->log_font.matrix[1] << 8;
420 font_matrix.xy = face->log_font.matrix[2] << 8;
421 font_matrix.yy = face->log_font.matrix[3] << 8;
422
423 FT_Outline_Transform( outline, &font_matrix );
424 }
425#endif
426
427 /* scale when needed */
428 if ( scaling )
429 {
430 FT_Int n;
431 FT_Fixed x_scale = pfrsize->metrics.x_scale;
432 FT_Fixed y_scale = pfrsize->metrics.y_scale;
433 FT_Vector* vec = outline->points;
434
435
436 /* scale outline points */
437 for ( n = 0; n < outline->n_points; n++, vec++ )
438 {
439 vec->x = FT_MulFix( vec->x, x_scale );
440 vec->y = FT_MulFix( vec->y, y_scale );
441 }
442
443 /* scale the advance */
444 metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
445 metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
446 }
447
448 /* compute the rest of the metrics */
450
451 metrics->width = cbox.xMax - cbox.xMin;
452 metrics->height = cbox.yMax - cbox.yMin;
453 metrics->horiBearingX = cbox.xMin;
454 metrics->horiBearingY = cbox.yMax - metrics->height;
455 }
456
457 Exit:
458 return error;
459 }
FT_BEGIN_HEADER struct FT_Glyph_Metrics_ FT_Glyph_Metrics
#define FT_LOAD_SBITS_ONLY
Definition: freetype.h:3032
#define FT_LOAD_NO_BITMAP
Definition: freetype.h:3012
#define FT_LOAD_NO_SCALE
Definition: freetype.h:3009
#define FT_LOAD_BITMAP_METRICS_ONLY
Definition: freetype.h:3026
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:416
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
FT_Vector * vec
Definition: ftbbox.c:448
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
#define FT_OUTLINE_HIGH_PRECISION
Definition: ftimage.h:435
#define FT_OUTLINE_REVERSE_FILL
Definition: ftimage.h:430
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:711
FT_Outline_Get_CBox(const FT_Outline *outline, FT_BBox *acbox)
Definition: ftoutln.c:478
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
Definition: ftsmooth.c:426
unsigned long FT_ULong
Definition: fttypes.h:253
signed long FT_Fixed
Definition: fttypes.h:288
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
pfr_glyph_load(PFR_Glyph glyph, FT_Stream stream, FT_ULong gps_offset, FT_ULong offset, FT_ULong size)
Definition: pfrgload.c:835
struct PFR_SizeRec_ * PFR_Size
Definition: pfrobjs.h:29
pfr_slot_load_bitmap(PFR_Slot glyph, PFR_Size size, FT_UInt glyph_index, FT_Bool metrics_only)
Definition: pfrsbit.c:579
FT_Pos xMin
Definition: ftimage.h:117
FT_Pos xMax
Definition: ftimage.h:118
FT_Outline outline
Definition: freetype.h:1927
FT_Fixed linearHoriAdvance
Definition: freetype.h:1917
FT_Fixed linearVertAdvance
Definition: freetype.h:1918
FT_Glyph_Metrics metrics
Definition: freetype.h:1916
FT_Glyph_Format format
Definition: freetype.h:1921
FT_Fixed xx
Definition: fttypes.h:387
FT_Fixed yx
Definition: fttypes.h:388
FT_Fixed yy
Definition: fttypes.h:388
FT_Fixed xy
Definition: fttypes.h:387
FT_Size_Metrics metrics
Definition: freetype.h:1677
FT_Fixed y_scale
Definition: freetype.h:1644
FT_Fixed x_scale
Definition: freetype.h:1643
FT_UShort y_ppem
Definition: freetype.h:1641
Definition: mesh.c:5330