ReactOS 0.4.15-dev-5666-gc548b97
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   trace_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   trace_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 212 of file t1gload.c.

214 {
216#ifdef __REACTOS__
217 T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
218 if (!decoder)
219 return FT_THROW( Out_Of_Memory );
220 {
221/* Ugly but it allows us to reduce the diff */
222#define decoder (*decoder)
223#else
224 T1_DecoderRec decoder;
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 */
236 error = psaux->t1_decoder_funcs->init( &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);
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 /* for each glyph, parse the glyph charstring and extract */
269 /* the advance width */
270 for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ )
271 {
272 /* now get load the unscaled outline */
273 (void)T1_Parse_Glyph( &decoder, (FT_UInt)glyph_index );
274 if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )
275 *max_advance = decoder.builder.advance.x;
276
277 /* ignore the error if one occurred - skip to next glyph */
278 }
279
280 psaux->t1_decoder_funcs->done( &decoder );
281
282#ifdef __REACTOS__
283 free(&decoder);
284#undef decoder
285 }
286#endif
287 return FT_Err_Ok;
288 }
#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:3234
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
#define FT_THROW(e)
Definition: ftdebug.h:213
unsigned char FT_Byte
Definition: fttypes.h:154
int FT_Error
Definition: fttypes.h:300
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
FT_Pos x
Definition: ftimage.h:76
const T1_Decoder_FuncsRec * t1_decoder_funcs
Definition: psaux.h:1284
FT_Vector advance
Definition: psaux.h:793
FT_Bool metrics_only
Definition: psaux.h:800
FT_Bool load_points
Definition: psaux.h:797
FT_Byte ** subrs
Definition: psaux.h:909
FT_UInt * subrs_len
Definition: psaux.h:910
FT_UInt len_buildchar
Definition: psaux.h:928
FT_Int num_subrs
Definition: psaux.h:908
T1_BuilderRec builder
Definition: psaux.h:895
FT_Long * buildchar
Definition: psaux.h:927
FT_Hash subrs_hash
Definition: psaux.h:911
void(* done)(T1_Decoder decoder)
Definition: psaux.h:870
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:859
FT_Byte ** subrs
Definition: t1types.h:109
FT_Int num_glyphs
Definition: t1types.h:113
FT_String ** glyph_names
Definition: t1types.h:114
FT_Int num_subrs
Definition: t1types.h:108
FT_Hash subrs_hash
Definition: t1types.h:111
FT_UInt * subrs_len
Definition: t1types.h:110
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 292 of file t1gload.c.

297 {
298 T1_Face face = (T1_Face)t1face;
299#ifdef __REACTOS__
300 T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
301 if (!decoder)
302 return FT_THROW( Out_Of_Memory );
303/* Ugly but it allows us to reduce the diff */
304#define decoder (*decoder)
305 {
306#else
307 T1_DecoderRec decoder;
308#endif
309 T1_Font type1 = &face->type1;
310 PSAux_Service psaux = (PSAux_Service)face->psaux;
311 FT_UInt nn;
313
314
315 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
316 {
317 for ( nn = 0; nn < count; nn++ )
318 advances[nn] = 0;
319
320#ifdef __REACTOS__
321 free(&decoder);
322#endif
323 return FT_Err_Ok;
324 }
325
326 error = psaux->t1_decoder_funcs->init( &decoder,
327 (FT_Face)face,
328 0, /* size */
329 0, /* glyph slot */
330 (FT_Byte**)type1->glyph_names,
331 face->blend,
332 0,
335 if ( error )
336#ifdef __REACTOS__
337 {
338 free(&decoder);
339 return error;
340 }
341#else
342 return error;
343#endif
344
345 decoder.builder.metrics_only = 1;
346 decoder.builder.load_points = 0;
347
348 decoder.num_subrs = type1->num_subrs;
349 decoder.subrs = type1->subrs;
350 decoder.subrs_len = type1->subrs_len;
351 decoder.subrs_hash = type1->subrs_hash;
352
353 decoder.buildchar = face->buildchar;
354 decoder.len_buildchar = face->len_buildchar;
355
356 for ( nn = 0; nn < count; nn++ )
357 {
358 error = T1_Parse_Glyph( &decoder, first + nn );
359 if ( !error )
360 advances[nn] = FIXED_TO_INT( decoder.builder.advance.x );
361 else
362 advances[nn] = 0;
363 }
364
365#ifdef __REACTOS__
366 free(&decoder);
367#undef decoder
368 }
369#endif
370 return FT_Err_Ok;
371 }
#define FT_LOAD_VERTICAL_LAYOUT
Definition: freetype.h:3013
#define FIXED_TO_INT(x)
Definition: ftcalc.h:406
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
if(dx< 0)
Definition: linetemp.h:194
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:196

◆ T1_Load_Glyph()

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

Definition at line 375 of file t1gload.c.

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

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 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:404
#define FT_HINTING_FREETYPE
Definition: ftdriver.h:345
#define FT_FACE(x)
Definition: ftobjs.h:630
#define FT_FACE_DRIVER(x)
Definition: ftobjs.h:634
unsigned long FT_ULong
Definition: fttypes.h:253
#define FT_ERR_EQ(x, e)
Definition: fttypes.h:591
struct @1653::@1654 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:614
FT_GlyphSlot glyph
Definition: psaux.h:784
FT_Error(* parse_charstrings)(PS_Decoder *decoder, FT_Byte *charstring_base, FT_ULong charstring_len)
Definition: psaux.h:885
FT_Error(* parse_metrics)(T1_Decoder decoder, FT_Byte *base, FT_UInt len)
Definition: psaux.h:879

Referenced by T1_Load_Glyph(), and T1_Parse_Glyph().