ReactOS 0.4.16-dev-2357-g35d0dfe
t1gload.c File Reference
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 38 of file t1gload.c.

Function Documentation

◆ T1_Compute_Max_Advance()

T1_Compute_Max_Advance ( T1_Face  face,
FT_Pos max_advance 
)

Definition at line 212 of file t1gload.c.

214 {
216#ifdef __REACTOS__
217 T1_DecoderRec *decoder_allocated = malloc(sizeof(*decoder_allocated));
218 if (!decoder_allocated)
219 return FT_THROW( Out_Of_Memory );
220 {
221/* Ugly but it allows us to reduce the diff */
222#define decoder (*decoder_allocated)
223#else
225#endif
226 FT_Int glyph_index;
227 T1_Font type1 = &face->type1;
228 PSAux_Service psaux = (PSAux_Service)face->psaux;
229
230
231 FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) );
232
233 *max_advance = 0;
234
235 /* initialize load decoder */
237 (FT_Face)face,
238 0, /* size */
239 0, /* glyph slot */
240 (FT_Byte**)type1->glyph_names,
241 face->blend,
242 0,
245 if ( error )
246#ifdef __REACTOS__
247 {
248 free(decoder_allocated);
249 return error;
250 }
251#else
252 return error;
253#endif
254
255 decoder.builder.metrics_only = 1;
256 decoder.builder.load_points = 0;
257
258 decoder.num_subrs = type1->num_subrs;
259 decoder.subrs = type1->subrs;
260 decoder.subrs_len = type1->subrs_len;
261 decoder.subrs_hash = type1->subrs_hash;
262
263 decoder.buildchar = face->buildchar;
264 decoder.len_buildchar = face->len_buildchar;
265
266 *max_advance = 0;
267
268 FT_TRACE6(( "T1_Compute_Max_Advance:\n" ));
269
270 /* for each glyph, parse the glyph charstring and extract */
271 /* the advance width */
272 for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ )
273 {
274 /* now get load the unscaled outline */
275 (void)T1_Parse_Glyph( &decoder, (FT_UInt)glyph_index );
276 if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )
277 *max_advance = decoder.builder.advance.x;
278
279 /* ignore the error if one occurred - skip to next glyph */
280 }
281
282 FT_TRACE6(( "T1_Compute_Max_Advance: max advance: %f\n",
283 *max_advance / 65536.0 ));
284
285 psaux->t1_decoder_funcs->done( &decoder );
286
287#ifdef __REACTOS__
288 free(decoder_allocated);
289#undef decoder
290 }
291#endif
292 return FT_Err_Ok;
293 }
#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:3249
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_ASSERT(condition)
Definition: ftdebug.h:241
#define FT_TRACE6(varformat)
Definition: ftdebug.h:193
#define FT_THROW(e)
Definition: ftdebug.h:243
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:1350
void(* done)(T1_Decoder decoder)
Definition: psaux.h:917
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:906
FT_Byte ** subrs
Definition: t1types.h:111
FT_Int num_glyphs
Definition: t1types.h:115
FT_String ** glyph_names
Definition: t1types.h:116
FT_Int num_subrs
Definition: t1types.h:110
FT_Hash subrs_hash
Definition: t1types.h:113
FT_UInt * subrs_len
Definition: t1types.h:112
T1_Parse_Glyph(T1_Decoder decoder, FT_UInt glyph_index)
Definition: t1gload.c:165

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 297 of file t1gload.c.

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

◆ T1_Load_Glyph()

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

Definition at line 392 of file t1gload.c.

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

167 {
168 FT_Data glyph_data;
169 FT_Bool force_scaling = FALSE;
171 decoder, glyph_index, &glyph_data,
172 &force_scaling );
173
174
175#ifdef FT_CONFIG_OPTION_INCREMENTAL
176
177 if ( !error )
178 {
179 T1_Face face = (T1_Face)decoder->builder.face;
180
181
182 if ( face->root.internal->incremental_interface )
183 face->root.internal->incremental_interface->funcs->free_glyph_data(
184 face->root.internal->incremental_interface->object,
185 &glyph_data );
186 }
187
188#endif /* FT_CONFIG_OPTION_INCREMENTAL */
189
190 return error;
191 }
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 42 of file t1gload.c.

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

Referenced by T1_Load_Glyph(), and T1_Parse_Glyph().