ReactOS 0.4.16-dev-1067-ge98bba2
t1gload.c File Reference
#include <ft2build.h>
#include "t1gload.h"
#include "t1errors.h"
Include dependency graph for t1gload.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FT_COMPONENT   t1gload
 

Functions

static FT_Error T1_Parse_Glyph_And_Get_Char_String (T1_Decoder decoder, FT_UInt glyph_index, FT_Data *char_string, FT_Bool *force_scaling)
 
 T1_Parse_Glyph (T1_Decoder decoder, FT_UInt glyph_index)
 
 T1_Compute_Max_Advance (T1_Face face, FT_Pos *max_advance)
 
 T1_Get_Advances (FT_Face t1face, FT_UInt first, FT_UInt count, FT_Int32 load_flags, FT_Fixed *advances)
 
 T1_Load_Glyph (FT_GlyphSlot t1glyph, FT_Size t1size, FT_UInt glyph_index, FT_Int32 load_flags)
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   t1gload

Definition at line 39 of file t1gload.c.

Function Documentation

◆ T1_Compute_Max_Advance()

T1_Compute_Max_Advance ( T1_Face  face,
FT_Pos max_advance 
)

Definition at line 213 of file t1gload.c.

215 {
217#ifdef __REACTOS__
218 T1_DecoderRec *decoder_allocated = malloc(sizeof(*decoder_allocated));
219 if (!decoder_allocated)
220 return FT_THROW( Out_Of_Memory );
221 {
222/* Ugly but it allows us to reduce the diff */
223#define decoder (*decoder_allocated)
224#else
226#endif
227 FT_Int glyph_index;
228 T1_Font type1 = &face->type1;
229 PSAux_Service psaux = (PSAux_Service)face->psaux;
230
231
232 FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
233
234 *max_advance = 0;
235
236 /* initialize load decoder */
238 (FT_Face)face,
239 0, /* size */
240 0, /* glyph slot */
241 (FT_Byte**)type1->glyph_names,
242 face->blend,
243 0,
246 if ( error )
247#ifdef __REACTOS__
248 {
249 free(decoder_allocated);
250 return error;
251 }
252#else
253 return error;
254#endif
255
256 decoder.builder.metrics_only = 1;
257 decoder.builder.load_points = 0;
258
259 decoder.num_subrs = type1->num_subrs;
260 decoder.subrs = type1->subrs;
261 decoder.subrs_len = type1->subrs_len;
262 decoder.subrs_hash = type1->subrs_hash;
263
264 decoder.buildchar = face->buildchar;
265 decoder.len_buildchar = face->len_buildchar;
266
267 *max_advance = 0;
268
269 FT_TRACE6(( "T1_Compute_Max_Advance:\n" ));
270
271 /* for each glyph, parse the glyph charstring and extract */
272 /* the advance width */
273 for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ )
274 {
275 /* now get load the unscaled outline */
276 (void)T1_Parse_Glyph( &decoder, (FT_UInt)glyph_index );
277 if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )
278 *max_advance = decoder.builder.advance.x;
279
280 /* ignore the error if one occurred - skip to next glyph */
281 }
282
283 FT_TRACE6(( "T1_Compute_Max_Advance: max advance: %f\n",
284 *max_advance / 65536.0 ));
285
286 psaux->t1_decoder_funcs->done( &decoder );
287
288#ifdef __REACTOS__
289 free(decoder_allocated);
290#undef decoder
291 }
292#endif
293 return FT_Err_Ok;
294 }
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
WORD face[3]
Definition: mesh.c:4747
@ FT_RENDER_MODE_NORMAL
Definition: freetype.h:3256
return FT_Err_Ok
Definition: ftbbox.c:527
#define FT_ASSERT(condition)
Definition: ftdebug.h:239
#define FT_TRACE6(varformat)
Definition: ftdebug.h:191
#define FT_THROW(e)
Definition: ftdebug.h:241
unsigned char FT_Byte
Definition: fttypes.h:154
int FT_Error
Definition: fttypes.h:299
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
#define error(str)
Definition: mkdosfs.c:1605
struct PSAux_ServiceRec_ * PSAux_Service
const T1_Decoder_FuncsRec * t1_decoder_funcs
Definition: psaux.h:1351
void(* done)(T1_Decoder decoder)
Definition: psaux.h:918
FT_Error(* init)(T1_Decoder decoder, FT_Face face, FT_Size size, FT_GlyphSlot slot, FT_Byte **glyph_names, PS_Blend blend, FT_Bool hinting, FT_Render_Mode hint_mode, T1_Decoder_Callback callback)
Definition: psaux.h:907
FT_Byte ** subrs
Definition: t1types.h:112
FT_Int num_glyphs
Definition: t1types.h:116
FT_String ** glyph_names
Definition: t1types.h:117
FT_Int num_subrs
Definition: t1types.h:111
FT_Hash subrs_hash
Definition: t1types.h:114
FT_UInt * subrs_len
Definition: t1types.h:113
T1_Parse_Glyph(T1_Decoder decoder, FT_UInt glyph_index)
Definition: t1gload.c:166

Referenced by T1_Face_Init().

◆ T1_Get_Advances()

T1_Get_Advances ( FT_Face  t1face,
FT_UInt  first,
FT_UInt  count,
FT_Int32  load_flags,
FT_Fixed advances 
)

Definition at line 298 of file t1gload.c.

303 {
304 T1_Face face = (T1_Face)t1face;
305#ifdef __REACTOS__
306 T1_DecoderRec *decoder_allocated = malloc(sizeof(*decoder_allocated));
307 if (!decoder_allocated)
308 return FT_THROW( Out_Of_Memory );
309/* Ugly but it allows us to reduce the diff */
310#define decoder (*decoder_allocated)
311 {
312#else
314#endif
315 T1_Font type1 = &face->type1;
316 PSAux_Service psaux = (PSAux_Service)face->psaux;
317 FT_UInt nn;
319
320
321 FT_TRACE5(( "T1_Get_Advances:\n" ));
322
323 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
324 {
325 for ( nn = 0; nn < count; nn++ )
326 {
327 advances[nn] = 0;
328
329 FT_TRACE5(( " idx %d: advance height 0 font units\n",
330 first + nn ));
331 }
332
333#ifdef __REACTOS__
334 free(decoder_allocated);
335#endif
336 return FT_Err_Ok;
337 }
338
340 (FT_Face)face,
341 0, /* size */
342 0, /* glyph slot */
343 (FT_Byte**)type1->glyph_names,
344 face->blend,
345 0,
348 if ( error )
349#ifdef __REACTOS__
350 {
351 free(decoder_allocated);
352 return error;
353 }
354#else
355 return error;
356#endif
357
358 decoder.builder.metrics_only = 1;
359 decoder.builder.load_points = 0;
360
361 decoder.num_subrs = type1->num_subrs;
362 decoder.subrs = type1->subrs;
363 decoder.subrs_len = type1->subrs_len;
364 decoder.subrs_hash = type1->subrs_hash;
365
366 decoder.buildchar = face->buildchar;
367 decoder.len_buildchar = face->len_buildchar;
368
369 for ( nn = 0; nn < count; nn++ )
370 {
371 error = T1_Parse_Glyph( &decoder, first + nn );
372 if ( !error )
373 advances[nn] = FIXED_TO_INT( decoder.builder.advance.x );
374 else
375 advances[nn] = 0;
376
377 FT_TRACE5(( " idx %d: advance width %d font unit%s\n",
378 first + nn,
379 advances[nn],
380 advances[nn] == 1 ? "" : "s" ));
381 }
382
383#ifdef __REACTOS__
384 free(decoder_allocated);
385#undef decoder
386 }
387#endif
388 return FT_Err_Ok;
389 }
#define FT_LOAD_VERTICAL_LAYOUT
Definition: freetype.h:3031
#define FIXED_TO_INT(x)
Definition: ftcalc.h:450
#define FT_TRACE5(varformat)
Definition: ftdebug.h:190
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:199

◆ T1_Load_Glyph()

T1_Load_Glyph ( FT_GlyphSlot  t1glyph,
FT_Size  t1size,
FT_UInt  glyph_index,
FT_Int32  load_flags 
)

Definition at line 393 of file t1gload.c.

397 {
398 T1_GlyphSlot glyph = (T1_GlyphSlot)t1glyph;
400#ifdef __REACTOS__
401 T1_DecoderRec *decoder_allocated = malloc(sizeof(*decoder_allocated));
402 if (!decoder_allocated)
403 return FT_THROW( Out_Of_Memory );
404/* Ugly but it allows us to reduce the diff */
405#define decoder (*decoder_allocated)
406 {
407#else
409#endif
410 T1_Face face = (T1_Face)t1glyph->face;
411 FT_Bool hinting;
412 FT_Bool scaled;
413 FT_Bool force_scaling = FALSE;
414 T1_Font type1 = &face->type1;
415 PSAux_Service psaux = (PSAux_Service)face->psaux;
416 const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
417
418 FT_Matrix font_matrix;
419 FT_Vector font_offset;
420 FT_Data glyph_data;
421 FT_Bool must_finish_decoder = FALSE;
422#ifdef FT_CONFIG_OPTION_INCREMENTAL
423 FT_Bool glyph_data_loaded = 0;
424#endif
425
426
427#ifdef FT_CONFIG_OPTION_INCREMENTAL
428 if ( glyph_index >= (FT_UInt)face->root.num_glyphs &&
429 !face->root.internal->incremental_interface )
430#else
431 if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
432#endif /* FT_CONFIG_OPTION_INCREMENTAL */
433 {
434 error = FT_THROW( Invalid_Argument );
435 goto Exit;
436 }
437
438 FT_TRACE1(( "T1_Load_Glyph: glyph index %d\n", glyph_index ));
439
440 FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
441
442 if ( load_flags & FT_LOAD_NO_RECURSE )
443 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
444
445 if ( t1size )
446 {
447 glyph->x_scale = t1size->metrics.x_scale;
448 glyph->y_scale = t1size->metrics.y_scale;
449 }
450 else
451 {
452 glyph->x_scale = 0x10000L;
453 glyph->y_scale = 0x10000L;
454 }
455
456 t1glyph->outline.n_points = 0;
457 t1glyph->outline.n_contours = 0;
458
459 hinting = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) &&
460 !( load_flags & FT_LOAD_NO_HINTING ) );
461 scaled = FT_BOOL( !( load_flags & FT_LOAD_NO_SCALE ) );
462
463 glyph->hint = hinting;
464 glyph->scaled = scaled;
466
467 error = decoder_funcs->init( &decoder,
468 t1glyph->face,
469 t1size,
470 t1glyph,
471 (FT_Byte**)type1->glyph_names,
472 face->blend,
473 hinting,
474 FT_LOAD_TARGET_MODE( load_flags ),
476 if ( error )
477 goto Exit;
478
479 must_finish_decoder = TRUE;
480
481 decoder.builder.no_recurse = FT_BOOL( load_flags & FT_LOAD_NO_RECURSE );
482
483 decoder.num_subrs = type1->num_subrs;
484 decoder.subrs = type1->subrs;
485 decoder.subrs_len = type1->subrs_len;
486 decoder.subrs_hash = type1->subrs_hash;
487
488 decoder.buildchar = face->buildchar;
489 decoder.len_buildchar = face->len_buildchar;
490
491 /* now load the unscaled outline */
493 &glyph_data,
494 &force_scaling );
495 if ( error )
496 goto Exit;
497#ifdef FT_CONFIG_OPTION_INCREMENTAL
498 glyph_data_loaded = 1;
499#endif
500
501 hinting = glyph->hint;
502 font_matrix = decoder.font_matrix;
503 font_offset = decoder.font_offset;
504
505 /* save new glyph tables */
506 decoder_funcs->done( &decoder );
507
508 must_finish_decoder = FALSE;
509
510 /* now, set the metrics -- this is rather simple, as */
511 /* the left side bearing is the xMin, and the top side */
512 /* bearing the yMax */
513 if ( !error )
514 {
515 t1glyph->outline.flags &= FT_OUTLINE_OWNER;
517
518 /* for composite glyphs, return only left side bearing and */
519 /* advance width */
520 if ( load_flags & FT_LOAD_NO_RECURSE )
521 {
523
524
525 t1glyph->metrics.horiBearingX =
526 FIXED_TO_INT( decoder.builder.left_bearing.x );
527 t1glyph->metrics.horiAdvance =
528 FIXED_TO_INT( decoder.builder.advance.x );
529
530 internal->glyph_matrix = font_matrix;
531 internal->glyph_delta = font_offset;
532 internal->glyph_transformed = 1;
533 }
534 else
535 {
536 FT_BBox cbox;
537 FT_Glyph_Metrics* metrics = &t1glyph->metrics;
538
539
540 /* copy the _unscaled_ advance width */
541 metrics->horiAdvance =
542 FIXED_TO_INT( decoder.builder.advance.x );
543 t1glyph->linearHoriAdvance =
544 FIXED_TO_INT( decoder.builder.advance.x );
545 t1glyph->internal->glyph_transformed = 0;
546
547 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
548 {
549 /* make up vertical ones */
550 metrics->vertAdvance = ( face->type1.font_bbox.yMax -
551 face->type1.font_bbox.yMin ) >> 16;
552 t1glyph->linearVertAdvance = metrics->vertAdvance;
553 }
554 else
555 {
556 metrics->vertAdvance =
557 FIXED_TO_INT( decoder.builder.advance.y );
558 t1glyph->linearVertAdvance =
559 FIXED_TO_INT( decoder.builder.advance.y );
560 }
561
563
564 if ( t1size && t1size->metrics.y_ppem < 24 )
566
567#if 1
568 /* apply the font matrix, if any */
569 if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||
570 font_matrix.xy != 0 || font_matrix.yx != 0 )
571 {
572 FT_Outline_Transform( &t1glyph->outline, &font_matrix );
573
574 metrics->horiAdvance = FT_MulFix( metrics->horiAdvance,
575 font_matrix.xx );
576 metrics->vertAdvance = FT_MulFix( metrics->vertAdvance,
577 font_matrix.yy );
578 }
579
580 if ( font_offset.x || font_offset.y )
581 {
582 FT_Outline_Translate( &t1glyph->outline,
583 font_offset.x,
584 font_offset.y );
585
586 metrics->horiAdvance += font_offset.x;
587 metrics->vertAdvance += font_offset.y;
588 }
589#endif
590
591 if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )
592 {
593 /* scale the outline and the metrics */
594 FT_Int n;
595 FT_Outline* cur = decoder.builder.base;
596 FT_Vector* vec = cur->points;
597 FT_Fixed x_scale = glyph->x_scale;
598 FT_Fixed y_scale = glyph->y_scale;
599
600
601 /* First of all, scale the points, if we are not hinting */
602 if ( !hinting || !decoder.builder.hints_funcs )
603 for ( n = cur->n_points; n > 0; n--, vec++ )
604 {
605 vec->x = FT_MulFix( vec->x, x_scale );
606 vec->y = FT_MulFix( vec->y, y_scale );
607 }
608
609 /* Then scale the metrics */
610 metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
611 metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
612 }
613
614 /* compute the other metrics */
615 FT_Outline_Get_CBox( &t1glyph->outline, &cbox );
616
617 metrics->width = cbox.xMax - cbox.xMin;
618 metrics->height = cbox.yMax - cbox.yMin;
619
620 metrics->horiBearingX = cbox.xMin;
621 metrics->horiBearingY = cbox.yMax;
622
623 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
624 {
625 /* make up vertical ones */
627 metrics->vertAdvance );
628 }
629 }
630
631 /* Set control data to the glyph charstrings. Note that this is */
632 /* _not_ zero-terminated. */
633 t1glyph->control_data = (FT_Byte*)glyph_data.pointer;
634 t1glyph->control_len = glyph_data.length;
635 }
636
637
638 Exit:
639
640#ifdef FT_CONFIG_OPTION_INCREMENTAL
641 if ( glyph_data_loaded && face->root.internal->incremental_interface )
642 {
643 face->root.internal->incremental_interface->funcs->free_glyph_data(
644 face->root.internal->incremental_interface->object,
645 &glyph_data );
646
647 /* Set the control data to null - it is no longer available if */
648 /* loaded incrementally. */
649 t1glyph->control_data = NULL;
650 t1glyph->control_len = 0;
651 }
652#endif
653
654 if ( must_finish_decoder )
655 decoder_funcs->done( &decoder );
656
657#ifdef __REACTOS__
658 free(decoder_allocated);
659#undef decoder
660 }
661#endif
662 return error;
663 }
ios_base &_STLP_CALL internal(ios_base &__s)
Definition: _ios_base.h:311
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FT_LOAD_TARGET_MODE(x)
Definition: freetype.h:3159
FT_BEGIN_HEADER struct FT_Glyph_Metrics_ FT_Glyph_Metrics
#define FT_LOAD_NO_SCALE
Definition: freetype.h:3027
#define FT_LOAD_NO_RECURSE
Definition: freetype.h:3036
#define FT_LOAD_NO_HINTING
Definition: freetype.h:3028
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:509
FT_Vector * vec
Definition: ftbbox.c:470
#define FT_TRACE1(varformat)
Definition: ftdebug.h:186
#define FT_OUTLINE_HIGH_PRECISION
Definition: ftimage.h:436
#define FT_OUTLINE_OWNER
Definition: ftimage.h:429
#define FT_OUTLINE_REVERSE_FILL
Definition: ftimage.h:431
ft_synthesize_vertical_metrics(FT_Glyph_Metrics *metrics, FT_Pos advance)
Definition: ftobjs.c:2977
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:509
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:698
FT_Outline_Get_CBox(const FT_Outline *outline, FT_BBox *acbox)
Definition: ftoutln.c:459
smooth FT_Module_Constructor FT_Module_Destructor FT_Module_Requester FT_GLYPH_FORMAT_OUTLINE
Definition: ftsmooth.c:465
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
signed long FT_Fixed
Definition: fttypes.h:287
#define FT_BOOL(x)
Definition: fttypes.h:591
FxCollectionEntry * cur
GLdouble n
Definition: glext.h:7729
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
static void Exit(void)
Definition: sock.c:1330
FT_Pos xMin
Definition: ftimage.h:121
FT_Pos yMax
Definition: ftimage.h:122
FT_Pos yMin
Definition: ftimage.h:121
FT_Pos xMax
Definition: ftimage.h:122
const FT_Byte * pointer
Definition: fttypes.h:415
FT_Int length
Definition: fttypes.h:416
void * control_data
Definition: freetype.h:1901
FT_Outline outline
Definition: freetype.h:1896
FT_Slot_Internal internal
Definition: freetype.h:1909
FT_Fixed linearHoriAdvance
Definition: freetype.h:1886
FT_Fixed linearVertAdvance
Definition: freetype.h:1887
FT_Glyph_Metrics metrics
Definition: freetype.h:1885
FT_Glyph_Format format
Definition: freetype.h:1890
FT_Fixed xx
Definition: fttypes.h:392
FT_Fixed yx
Definition: fttypes.h:393
FT_Fixed yy
Definition: fttypes.h:393
FT_Fixed xy
Definition: fttypes.h:392
short n_contours
Definition: ftimage.h:339
int flags
Definition: ftimage.h:346
short n_points
Definition: ftimage.h:340
FT_Size_Metrics metrics
Definition: freetype.h:1649
FT_Fixed y_scale
Definition: freetype.h:1614
FT_Fixed x_scale
Definition: freetype.h:1613
FT_UShort y_ppem
Definition: freetype.h:1611
FT_Bool glyph_transformed
Definition: ftobjs.h:429
FT_Pos x
Definition: ftimage.h:78
FT_Pos y
Definition: ftimage.h:79
FT_Bool scaled
Definition: t1objs.h:121
FT_Bool hint
Definition: t1objs.h:120
FT_Fixed x_scale
Definition: t1objs.h:123
FT_Fixed y_scale
Definition: t1objs.h:124
static FT_Error T1_Parse_Glyph_And_Get_Char_String(T1_Decoder decoder, FT_UInt glyph_index, FT_Data *char_string, FT_Bool *force_scaling)
Definition: t1gload.c:43
struct T1_GlyphSlotRec_ * T1_GlyphSlot
Definition: t1objs.h:56

◆ T1_Parse_Glyph()

T1_Parse_Glyph ( T1_Decoder  decoder,
FT_UInt  glyph_index 
)

Definition at line 166 of file t1gload.c.

168 {
169 FT_Data glyph_data;
170 FT_Bool force_scaling = FALSE;
172 decoder, glyph_index, &glyph_data,
173 &force_scaling );
174
175
176#ifdef FT_CONFIG_OPTION_INCREMENTAL
177
178 if ( !error )
179 {
180 T1_Face face = (T1_Face)decoder->builder.face;
181
182
183 if ( face->root.internal->incremental_interface )
184 face->root.internal->incremental_interface->funcs->free_glyph_data(
185 face->root.internal->incremental_interface->object,
186 &glyph_data );
187 }
188
189#endif /* FT_CONFIG_OPTION_INCREMENTAL */
190
191 return error;
192 }
if(dx< 0)
Definition: linetemp.h:194

Referenced by T1_Compute_Max_Advance(), T1_Get_Advances(), and T1_Load_Glyph().

◆ T1_Parse_Glyph_And_Get_Char_String()

static FT_Error T1_Parse_Glyph_And_Get_Char_String ( T1_Decoder  decoder,
FT_UInt  glyph_index,
FT_Data char_string,
FT_Bool force_scaling 
)
static

Definition at line 43 of file t1gload.c.

47 {
48 T1_Face face = (T1_Face)decoder->builder.face;
49 T1_Font type1 = &face->type1;
51
52 PSAux_Service psaux = (PSAux_Service)face->psaux;
53 const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
54 PS_Decoder psdecoder;
55
56#ifdef FT_CONFIG_OPTION_INCREMENTAL
58 face->root.internal->incremental_interface;
59#endif
60
61#ifdef T1_CONFIG_OPTION_OLD_ENGINE
63#endif
64
65
66 decoder->font_matrix = type1->font_matrix;
67 decoder->font_offset = type1->font_offset;
68
69#ifdef FT_CONFIG_OPTION_INCREMENTAL
70
71 /* For incremental fonts get the character data using the */
72 /* callback function. */
73 if ( inc )
74 error = inc->funcs->get_glyph_data( inc->object,
75 glyph_index, char_string );
76 else
77
78#endif /* FT_CONFIG_OPTION_INCREMENTAL */
79
80 /* For ordinary fonts get the character data stored in the face record. */
81 {
82 char_string->pointer = type1->charstrings[glyph_index];
83 char_string->length = (FT_Int)type1->charstrings_len[glyph_index];
84 }
85
86 if ( !error )
87 {
88 /* choose which renderer to use */
89#ifdef T1_CONFIG_OPTION_OLD_ENGINE
90 if ( driver->hinting_engine == FT_HINTING_FREETYPE ||
91 decoder->builder.metrics_only )
92 error = decoder_funcs->parse_charstrings_old(
93 decoder,
94 (FT_Byte*)char_string->pointer,
95 (FT_UInt)char_string->length );
96#else
97 if ( decoder->builder.metrics_only )
98 error = decoder_funcs->parse_metrics(
99 decoder,
100 (FT_Byte*)char_string->pointer,
101 (FT_UInt)char_string->length );
102#endif
103 else
104 {
105 CFF_SubFontRec subfont;
106
107
108 psaux->ps_decoder_init( &psdecoder, decoder, TRUE );
109
110 psaux->t1_make_subfont( FT_FACE( face ),
111 &face->type1.private_dict, &subfont );
112 psdecoder.current_subfont = &subfont;
113
114 error = decoder_funcs->parse_charstrings(
115 &psdecoder,
116 (FT_Byte*)char_string->pointer,
117 (FT_ULong)char_string->length );
118
119 /* Adobe's engine uses 16.16 numbers everywhere; */
120 /* as a consequence, glyphs larger than 2000ppem get rejected */
121 if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
122 {
123 /* this time, we retry unhinted and scale up the glyph later on */
124 /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */
125 /* 0x400 for both `x_scale' and `y_scale' in this case) */
126 ((T1_GlyphSlot)decoder->builder.glyph)->hint = FALSE;
127
128 *force_scaling = TRUE;
129
130 error = decoder_funcs->parse_charstrings(
131 &psdecoder,
132 (FT_Byte*)char_string->pointer,
133 (FT_ULong)char_string->length );
134 }
135 }
136 }
137
138#ifdef FT_CONFIG_OPTION_INCREMENTAL
139
140 /* Incremental fonts can optionally override the metrics. */
141 if ( !error && inc && inc->funcs->get_glyph_metrics )
142 {
144
145
146 metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
147 metrics.bearing_y = 0;
148 metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
149 metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y );
150
151 error = inc->funcs->get_glyph_metrics( inc->object,
152 glyph_index, FALSE, &metrics );
153
154 decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
155 decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
156 decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v );
157 }
158
159#endif /* FT_CONFIG_OPTION_INCREMENTAL */
160
161 return error;
162 }
#define INT_TO_FIXED(x)
Definition: ftcalc.h:448
#define FT_HINTING_FREETYPE
Definition: ftdriver.h:344
#define FT_FACE(x)
Definition: ftobjs.h:599
#define FT_FACE_DRIVER(x)
Definition: ftobjs.h:603
unsigned long FT_ULong
Definition: fttypes.h:253
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:604
struct @1717::@1718 driver
FT_BEGIN_HEADER struct PS_DriverRec_ * PS_Driver
FT_Incremental_GetGlyphDataFunc get_glyph_data
Definition: ftincrem.h:273
FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics
Definition: ftincrem.h:275
const FT_Incremental_FuncsRec * funcs
Definition: ftincrem.h:318
CFF_SubFont current_subfont
Definition: psaux.h:646

Referenced by T1_Load_Glyph(), and T1_Parse_Glyph().