ReactOS 0.4.16-dev-2332-g4cba65d
t1load.h File Reference
Include dependency graph for t1load.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  T1_Loader_
 

Macros

#define T1_PRIVATE   ( 1 << 0 )
 
#define T1_FONTDIR_AFTER_PRIVATE   ( 1 << 1 )
 

Typedefs

typedef FT_BEGIN_HEADER struct T1_Loader_ T1_LoaderRec
 
typedef FT_BEGIN_HEADER struct T1_Loader_T1_Loader
 

Functions

 T1_Open_Face (T1_Face face)
 
 T1_Get_Multi_Master (T1_Face face, FT_Multi_Master *master)
 
 T1_Get_MM_Var (T1_Face face, FT_MM_Var **master)
 
 T1_Set_MM_Blend (T1_Face face, FT_UInt num_coords, FT_Fixed *coords)
 
 T1_Get_MM_Blend (T1_Face face, FT_UInt num_coords, FT_Fixed *coords)
 
 T1_Set_MM_Design (T1_Face face, FT_UInt num_coords, FT_Long *coords)
 
 T1_Reset_MM_Blend (T1_Face face, FT_UInt instance_index)
 
 T1_Get_Var_Design (T1_Face face, FT_UInt num_coords, FT_Fixed *coords)
 
 T1_Set_Var_Design (T1_Face face, FT_UInt num_coords, FT_Fixed *coords)
 
 T1_Done_Blend (T1_Face face)
 
 T1_Set_MM_WeightVector (T1_Face face, FT_UInt len, FT_Fixed *weightvector)
 
 T1_Get_MM_WeightVector (T1_Face face, FT_UInt *len, FT_Fixed *weightvector)
 

Macro Definition Documentation

◆ T1_FONTDIR_AFTER_PRIVATE

#define T1_FONTDIR_AFTER_PRIVATE   ( 1 << 1 )

Definition at line 60 of file t1load.h.

◆ T1_PRIVATE

#define T1_PRIVATE   ( 1 << 0 )

Definition at line 59 of file t1load.h.

Typedef Documentation

◆ T1_Loader

◆ T1_LoaderRec

Function Documentation

◆ T1_Done_Blend()

T1_Done_Blend ( T1_Face  face)

Definition at line 734 of file t1load.c.

735 {
736 FT_Memory memory = face->root.memory;
737 PS_Blend blend = face->blend;
738
739
740 if ( blend )
741 {
742 FT_UInt num_designs = blend->num_designs;
743 FT_UInt num_axis = blend->num_axis;
744 FT_UInt n;
745
746
747 /* release design pos table */
748 FT_FREE( blend->design_pos[0] );
749 for ( n = 1; n < num_designs; n++ )
750 blend->design_pos[n] = NULL;
751
752 /* release blend `private' and `font info' dictionaries */
753 FT_FREE( blend->privates[1] );
754 FT_FREE( blend->font_infos[1] );
755 FT_FREE( blend->bboxes[1] );
756
757 for ( n = 0; n < num_designs; n++ )
758 {
759 blend->privates [n] = NULL;
760 blend->font_infos[n] = NULL;
761 blend->bboxes [n] = NULL;
762 }
763
764 /* release weight vectors */
765 FT_FREE( blend->weight_vector );
767
768 /* release axis names */
769 for ( n = 0; n < num_axis; n++ )
770 FT_FREE( blend->axis_names[n] );
771
772 /* release design map */
773 for ( n = 0; n < num_axis; n++ )
774 {
775 PS_DesignMap dmap = blend->design_map + n;
776
777
778 FT_FREE( dmap->design_points );
779 dmap->num_points = 0;
780 }
781
782 FT_FREE( face->blend );
783 }
784 }
#define NULL
Definition: types.h:112
#define FT_FREE(ptr)
Definition: ftmemory.h:337
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
unsigned int FT_UInt
Definition: fttypes.h:231
GLdouble n
Definition: glext.h:7729
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
static char memory[1024 *256]
Definition: process.c:122
PS_DesignMapRec design_map[T1_MAX_MM_AXIS]
Definition: t1tables.h:302
FT_Fixed * default_weight_vector
Definition: t1tables.h:305
PS_Private privates[T1_MAX_MM_DESIGNS+1]
Definition: t1tables.h:308
FT_BBox * bboxes[T1_MAX_MM_DESIGNS+1]
Definition: t1tables.h:312
PS_FontInfo font_infos[T1_MAX_MM_DESIGNS+1]
Definition: t1tables.h:307
FT_Fixed * design_pos[T1_MAX_MM_DESIGNS]
Definition: t1tables.h:301
FT_UInt num_designs
Definition: t1tables.h:297
FT_Fixed * weight_vector
Definition: t1tables.h:304
FT_UInt num_axis
Definition: t1tables.h:298
FT_String * axis_names[T1_MAX_MM_AXIS]
Definition: t1tables.h:300
FT_Byte num_points
Definition: t1tables.h:285
FT_Long * design_points
Definition: t1tables.h:286

Referenced by T1_Face_Done(), and T1_Open_Face().

◆ T1_Get_MM_Blend()

T1_Get_MM_Blend ( T1_Face  face,
FT_UInt  num_coords,
FT_Fixed coords 
)

Definition at line 473 of file t1load.c.

476 {
477 PS_Blend blend = face->blend;
478
479 FT_Fixed axiscoords[4];
480 FT_UInt i, nc;
481
482
483 if ( !blend )
484 return FT_THROW( Invalid_Argument );
485
487 axiscoords,
488 blend->num_axis );
489
490 nc = num_coords;
491 if ( num_coords > blend->num_axis )
492 {
493 FT_TRACE2(( "T1_Get_MM_Blend: only using first %d of %d coordinates\n",
494 blend->num_axis, num_coords ));
495 nc = blend->num_axis;
496 }
497
498 for ( i = 0; i < nc; i++ )
499 coords[i] = axiscoords[i];
500 for ( ; i < num_coords; i++ )
501 coords[i] = 0x8000;
502
503 return FT_Err_Ok;
504 }
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_THROW(e)
Definition: ftdebug.h:243
#define FT_TRACE2(varformat)
Definition: ftdebug.h:189
signed long FT_Fixed
Definition: fttypes.h:287
GLuint coords
Definition: glext.h:7368
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static void mm_weights_unmap(FT_Fixed *weights, FT_Fixed *axiscoords, FT_UInt axis_count)
Definition: t1load.c:260

◆ T1_Get_MM_Var()

T1_Get_MM_Var ( T1_Face  face,
FT_MM_Var **  master 
)

Definition at line 302 of file t1load.c.

304 {
305 FT_Memory memory = face->root.memory;
306 FT_MM_Var *mmvar = NULL;
307 FT_Multi_Master mmaster;
309 FT_UInt i;
310 FT_Fixed axiscoords[T1_MAX_MM_AXIS];
311 PS_Blend blend = face->blend;
312 FT_UShort* axis_flags;
313
314 FT_Offset mmvar_size;
315 FT_Offset axis_flags_size;
316 FT_Offset axis_size;
317
318
319 error = T1_Get_Multi_Master( face, &mmaster );
320 if ( error )
321 goto Exit;
322
323 /* the various `*_size' variables, which we also use as */
324 /* offsets into the `mmvar' array, must be multiples of the */
325 /* pointer size (except the last one); without such an */
326 /* alignment there might be runtime errors due to */
327 /* misaligned addresses */
328#undef ALIGN_SIZE
329#define ALIGN_SIZE( n ) \
330 ( ( (n) + sizeof (void*) - 1 ) & ~( sizeof (void*) - 1 ) )
331
332 mmvar_size = ALIGN_SIZE( sizeof ( FT_MM_Var ) );
333 axis_flags_size = ALIGN_SIZE( mmaster.num_axis *
334 sizeof ( FT_UShort ) );
335 axis_size = mmaster.num_axis * sizeof ( FT_Var_Axis );
336
337 if ( FT_ALLOC( mmvar, mmvar_size +
338 axis_flags_size +
339 axis_size ) )
340 goto Exit;
341
342 mmvar->num_axis = mmaster.num_axis;
343 mmvar->num_designs = mmaster.num_designs;
344 mmvar->num_namedstyles = 0; /* Not supported */
345
346 /* while axis flags are meaningless here, we have to provide the array */
347 /* to make `FT_Get_Var_Axis_Flags' work: the function expects that the */
348 /* values directly follow the data of `FT_MM_Var' */
349 axis_flags = (FT_UShort*)( (char*)mmvar + mmvar_size );
350 for ( i = 0; i < mmaster.num_axis; i++ )
351 axis_flags[i] = 0;
352
353 mmvar->axis = (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size );
354 mmvar->namedstyle = NULL;
355
356 for ( i = 0; i < mmaster.num_axis; i++ )
357 {
358 mmvar->axis[i].name = mmaster.axis[i].name;
359 mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum );
360 mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum );
361 mmvar->axis[i].strid = ~0U; /* Does not apply */
362 mmvar->axis[i].tag = ~0U; /* Does not apply */
363
364 if ( !mmvar->axis[i].name )
365 continue;
366
367 if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
368 mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
369 else if ( ft_strcmp( mmvar->axis[i].name, "Width" ) == 0 )
370 mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'd', 't', 'h' );
371 else if ( ft_strcmp( mmvar->axis[i].name, "OpticalSize" ) == 0 )
372 mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' );
373 }
374
376 axiscoords,
377 blend->num_axis );
378
379 for ( i = 0; i < mmaster.num_axis; i++ )
380 mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i],
381 axiscoords[i] );
382
383 *master = mmvar;
384
385 Exit:
386 return error;
387 }
#define U(x)
Definition: wordpad.c:45
#define INT_TO_FIXED(x)
Definition: ftcalc.h:448
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:311
struct FT_Var_Axis_ FT_Var_Axis
#define ft_strcmp
Definition: ftstdlib.h:86
int FT_Error
Definition: fttypes.h:299
unsigned short FT_UShort
Definition: fttypes.h:209
#define FT_MAKE_TAG(_x1, _x2, _x3, _x4)
Definition: fttypes.h:488
size_t FT_Offset
Definition: fttypes.h:323
#define error(str)
Definition: mkdosfs.c:1605
static void Exit(void)
Definition: sock.c:1330
FT_Var_Axis * axis
Definition: ftmm.h:247
FT_UInt num_designs
Definition: ftmm.h:245
FT_UInt num_namedstyles
Definition: ftmm.h:246
FT_UInt num_axis
Definition: ftmm.h:244
FT_Var_Named_Style * namedstyle
Definition: ftmm.h:248
FT_MM_Axis axis[T1_MAX_MM_AXIS]
Definition: ftmm.h:111
FT_UInt num_designs
Definition: ftmm.h:110
FT_UInt num_axis
Definition: ftmm.h:109
FT_ULong tag
Definition: ftmm.h:163
FT_UInt strid
Definition: ftmm.h:164
FT_Fixed def
Definition: ftmm.h:160
FT_Fixed maximum
Definition: ftmm.h:161
FT_String * name
Definition: ftmm.h:157
FT_Fixed minimum
Definition: ftmm.h:159
#define ALIGN_SIZE(n)
static FT_Fixed mm_axis_unmap(PS_DesignMap axismap, FT_Fixed ncv)
Definition: t1load.c:231
T1_Get_Multi_Master(T1_Face face, FT_Multi_Master *master)
Definition: t1load.c:192
#define T1_MAX_MM_AXIS
Definition: t1tables.h:276
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ T1_Get_MM_WeightVector()

T1_Get_MM_WeightVector ( T1_Face  face,
FT_UInt len,
FT_Fixed weightvector 
)

Definition at line 548 of file t1load.c.

551 {
552 PS_Blend blend = face->blend;
553 FT_UInt i;
554
555
556 if ( !blend )
557 return FT_THROW( Invalid_Argument );
558
559 if ( *len < blend->num_designs )
560 {
561 *len = blend->num_designs;
562 return FT_THROW( Invalid_Argument );
563 }
564
565 for ( i = 0; i < blend->num_designs; i++ )
566 weightvector[i] = blend->weight_vector[i];
567 for ( ; i < *len; i++ )
568 weightvector[i] = (FT_Fixed)0;
569
570 *len = blend->num_designs;
571
572 return FT_Err_Ok;
573 }
GLenum GLsizei len
Definition: glext.h:6722
#define for
Definition: utility.h:88

◆ T1_Get_Multi_Master()

T1_Get_Multi_Master ( T1_Face  face,
FT_Multi_Master master 
)

Definition at line 192 of file t1load.c.

194 {
195 PS_Blend blend = face->blend;
196 FT_UInt n;
198
199
200 error = FT_THROW( Invalid_Argument );
201
202 if ( blend )
203 {
204 master->num_axis = blend->num_axis;
205 master->num_designs = blend->num_designs;
206
207 for ( n = 0; n < blend->num_axis; n++ )
208 {
209 FT_MM_Axis* axis = master->axis + n;
210 PS_DesignMap map = blend->design_map + n;
211
212
213 axis->name = blend->axis_names[n];
214 axis->minimum = map->design_points[0];
215 axis->maximum = map->design_points[map->num_points - 1];
216 }
217
219 }
220
221 return error;
222 }
Definition: _map.h:48
FT_BEGIN_HEADER struct FT_MM_Axis_ FT_MM_Axis

Referenced by T1_Get_MM_Var().

◆ T1_Get_Var_Design()

T1_Get_Var_Design ( T1_Face  face,
FT_UInt  num_coords,
FT_Fixed coords 
)

Definition at line 698 of file t1load.c.

701 {
702 PS_Blend blend = face->blend;
703
704 FT_Fixed axiscoords[4];
705 FT_UInt i, nc;
706
707
708 if ( !blend )
709 return FT_THROW( Invalid_Argument );
710
712 axiscoords,
713 blend->num_axis );
714
715 nc = num_coords;
716 if ( num_coords > blend->num_axis )
717 {
718 FT_TRACE2(( "T1_Get_Var_Design:"
719 " only using first %d of %d coordinates\n",
720 blend->num_axis, num_coords ));
721 nc = blend->num_axis;
722 }
723
724 for ( i = 0; i < nc; i++ )
725 coords[i] = mm_axis_unmap( &blend->design_map[i], axiscoords[i] );
726 for ( ; i < num_coords; i++ )
727 coords[i] = 0;
728
729 return FT_Err_Ok;
730 }

◆ T1_Open_Face()

T1_Open_Face ( T1_Face  face)

Definition at line 2499 of file t1load.c.

2500 {
2501 T1_LoaderRec loader;
2503 T1_Font type1 = &face->type1;
2504 PS_Private priv = &type1->private_dict;
2506
2507 PSAux_Service psaux = (PSAux_Service)face->psaux;
2508
2509
2510 t1_init_loader( &loader, face );
2511
2512 /* default values */
2513 face->ndv_idx = -1;
2514 face->cdv_idx = -1;
2515 face->len_buildchar = 0;
2516
2517 priv->blue_shift = 7;
2518 priv->blue_fuzz = 1;
2519 priv->lenIV = 4;
2520 priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
2521 priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
2522
2523 parser = &loader.parser;
2525 face->root.stream,
2526 face->root.memory,
2527 psaux );
2528 if ( error )
2529 goto Exit;
2530
2531 FT_TRACE4(( " top dictionary:\n" ));
2532 error = parse_dict( face, &loader,
2533 parser->base_dict, parser->base_len );
2534 if ( error )
2535 goto Exit;
2536
2537 error = T1_Get_Private_Dict( parser, psaux );
2538 if ( error )
2539 goto Exit;
2540
2541 FT_TRACE4(( " private dictionary:\n" ));
2542 error = parse_dict( face, &loader,
2543 parser->private_dict, parser->private_len );
2544 if ( error )
2545 goto Exit;
2546
2547 /* ensure even-ness of `num_blue_values' */
2548 priv->num_blue_values &= ~1;
2549
2550#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
2551
2552 /* we don't support Multiple Master fonts with intermediate designs; */
2553 /* this implies that `num_designs' must be equal to `2^^num_axis' */
2554 if ( face->blend &&
2555 face->blend->num_designs != ( 1U << face->blend->num_axis ) )
2556 {
2557 FT_ERROR(( "T1_Open_Face:"
2558 " number-of-designs != 2 ^^ number-of-axes\n" ));
2560 }
2561
2562 if ( face->blend &&
2563 face->blend->num_default_design_vector != 0 &&
2564 face->blend->num_default_design_vector != face->blend->num_axis )
2565 {
2566 /* we don't use it currently so just warn, reset, and ignore */
2567 FT_ERROR(( "T1_Open_Face(): /DesignVector contains %u entries "
2568 "while there are %u axes.\n",
2569 face->blend->num_default_design_vector,
2570 face->blend->num_axis ));
2571
2572 face->blend->num_default_design_vector = 0;
2573 }
2574
2575 /* the following can happen for MM instances; we then treat the */
2576 /* font as a normal PS font */
2577 if ( face->blend &&
2578 ( !face->blend->num_designs || !face->blend->num_axis ) )
2580
2581 /* another safety check */
2582 if ( face->blend )
2583 {
2584 FT_UInt i;
2585
2586
2587 for ( i = 0; i < face->blend->num_axis; i++ )
2588 if ( !face->blend->design_map[i].num_points )
2589 {
2591 break;
2592 }
2593 }
2594
2595 if ( face->blend )
2596 {
2597 if ( face->len_buildchar > 0 )
2598 {
2599 FT_Memory memory = face->root.memory;
2600
2601
2602 if ( FT_NEW_ARRAY( face->buildchar, face->len_buildchar ) )
2603 {
2604 FT_ERROR(( "T1_Open_Face: cannot allocate BuildCharArray\n" ));
2605 face->len_buildchar = 0;
2606 goto Exit;
2607 }
2608 }
2609 }
2610 else
2611 face->len_buildchar = 0;
2612
2613#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */
2614
2615 /* now, propagate the subrs, charstrings, and glyphnames tables */
2616 /* to the Type1 data */
2617 type1->num_glyphs = loader.num_glyphs;
2618
2619 if ( loader.subrs.init )
2620 {
2621 type1->num_subrs = loader.num_subrs;
2622 type1->subrs_block = loader.subrs.block;
2623 type1->subrs = loader.subrs.elements;
2624 type1->subrs_len = loader.subrs.lengths;
2625 type1->subrs_hash = loader.subrs_hash;
2626
2627 /* prevent `t1_done_loader' from freeing the propagated data */
2628 loader.subrs.init = 0;
2629 loader.subrs_hash = NULL;
2630 }
2631
2632 if ( !IS_INCREMENTAL )
2633 if ( !loader.charstrings.init )
2634 {
2635 FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" ));
2636 error = FT_THROW( Invalid_File_Format );
2637 }
2638
2639 loader.charstrings.init = 0;
2640 type1->charstrings_block = loader.charstrings.block;
2641 type1->charstrings = loader.charstrings.elements;
2642 type1->charstrings_len = loader.charstrings.lengths;
2643
2644 /* we copy the glyph names `block' and `elements' fields; */
2645 /* the `lengths' field must be released later */
2646 type1->glyph_names_block = loader.glyph_names.block;
2647 type1->glyph_names = (FT_String**)loader.glyph_names.elements;
2648 loader.glyph_names.block = NULL;
2649 loader.glyph_names.elements = NULL;
2650
2651 /* we must now build type1.encoding when we have a custom array */
2653 {
2654 FT_Int charcode, idx, min_char, max_char;
2655
2656
2657 /* OK, we do the following: for each element in the encoding */
2658 /* table, look up the index of the glyph having the same name */
2659 /* the index is then stored in type1.encoding.char_index, and */
2660 /* the name to type1.encoding.char_name */
2661
2662 min_char = 0;
2663 max_char = 0;
2664
2665 charcode = 0;
2666 for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
2667 {
2668 const FT_String* char_name =
2669 (const FT_String*)loader.encoding_table.elements[charcode];
2670
2671
2672 type1->encoding.char_index[charcode] = 0;
2673 type1->encoding.char_name [charcode] = ".notdef";
2674
2675 if ( char_name )
2676 for ( idx = 0; idx < type1->num_glyphs; idx++ )
2677 {
2678 const FT_String* glyph_name = type1->glyph_names[idx];
2679
2680
2681 if ( ft_strcmp( char_name, glyph_name ) == 0 )
2682 {
2683 type1->encoding.char_index[charcode] = (FT_UShort)idx;
2684 type1->encoding.char_name [charcode] = glyph_name;
2685
2686 /* Change min/max encoded char only if glyph name is */
2687 /* not /.notdef */
2688 if ( ft_strcmp( ".notdef", glyph_name ) != 0 )
2689 {
2690 if ( charcode < min_char )
2691 min_char = charcode;
2692 if ( charcode >= max_char )
2693 max_char = charcode + 1;
2694 }
2695 break;
2696 }
2697 }
2698 }
2699
2700 type1->encoding.code_first = min_char;
2701 type1->encoding.code_last = max_char;
2702 type1->encoding.num_chars = loader.num_chars;
2703 }
2704
2705 /* some sanitizing to avoid overflows later on; */
2706 /* the upper limits are ad-hoc values */
2707 if ( priv->blue_shift > 1000 || priv->blue_shift < 0 )
2708 {
2709 FT_TRACE2(( "T1_Open_Face:"
2710 " setting unlikely BlueShift value %d to default (7)\n",
2711 priv->blue_shift ));
2712 priv->blue_shift = 7;
2713 }
2714
2715 if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 )
2716 {
2717 FT_TRACE2(( "T1_Open_Face:"
2718 " setting unlikely BlueFuzz value %d to default (1)\n",
2719 priv->blue_fuzz ));
2720 priv->blue_fuzz = 1;
2721 }
2722
2723 Exit:
2724 t1_done_loader( &loader );
2725 return error;
2726 }
unsigned int idx
Definition: utils.c:41
#define FT_ERROR(varformat)
Definition: ftdebug.h:211
#define FT_TRACE4(varformat)
Definition: ftdebug.h:191
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:341
char FT_String
Definition: fttypes.h:187
signed int FT_Int
Definition: fttypes.h:220
if(dx< 0)
Definition: linetemp.h:194
struct PSAux_ServiceRec_ * PSAux_Service
FT_Int blue_fuzz
Definition: t1tables.h:154
FT_Fixed expansion_factor
Definition: t1tables.h:167
FT_Int lenIV
Definition: t1tables.h:139
FT_Int blue_shift
Definition: t1tables.h:153
FT_Byte num_blue_values
Definition: t1tables.h:141
FT_Fixed blue_scale
Definition: t1tables.h:152
PS_PrivateRec private_dict
Definition: t1types.h:100
T1_EncodingType encoding_type
Definition: t1types.h:103
FT_Byte * subrs_block
Definition: t1types.h:106
FT_Byte ** subrs
Definition: t1types.h:111
FT_Int num_glyphs
Definition: t1types.h:115
FT_UInt * charstrings_len
Definition: t1types.h:118
FT_String ** glyph_names
Definition: t1types.h:116
T1_EncodingRec encoding
Definition: t1types.h:104
FT_Int num_subrs
Definition: t1types.h:110
FT_Byte * charstrings_block
Definition: t1types.h:107
FT_Hash subrs_hash
Definition: t1types.h:113
FT_Byte ** charstrings
Definition: t1types.h:117
FT_UInt * subrs_len
Definition: t1types.h:112
FT_Byte * glyph_names_block
Definition: t1types.h:108
Definition: import.c:81
static void t1_init_loader(T1_Loader loader, T1_Face face)
Definition: t1load.c:2466
#define IS_INCREMENTAL
Definition: t1load.c:78
T1_Done_Blend(T1_Face face)
Definition: t1load.c:734
static void t1_done_loader(T1_Loader loader)
Definition: t1load.c:2476
static FT_Error parse_dict(T1_Face face, T1_Loader loader, FT_Byte *base, FT_ULong size)
Definition: t1load.c:2268
FT_BEGIN_HEADER struct T1_Loader_ T1_LoaderRec
T1_New_Parser(T1_Parser parser, FT_Stream stream, FT_Memory memory, PSAux_Service psaux)
Definition: t1parse.c:135
T1_Get_Private_Dict(T1_Parser parser, PSAux_Service psaux)
Definition: t1parse.c:260
FT_BEGIN_HEADER struct T1_ParserRec_ * T1_Parser
@ T1_ENCODING_TYPE_ARRAY
Definition: t1tables.h:566

Referenced by T1_Face_Init().

◆ T1_Reset_MM_Blend()

T1_Reset_MM_Blend ( T1_Face  face,
FT_UInt  instance_index 
)

Definition at line 664 of file t1load.c.

666 {
667 FT_UNUSED( instance_index );
668
669 return T1_Set_MM_Blend( face, 0, NULL );
670 }
#define FT_UNUSED(arg)
T1_Set_MM_Blend(T1_Face face, FT_UInt num_coords, FT_Fixed *coords)
Definition: t1load.c:452

◆ T1_Set_MM_Blend()

T1_Set_MM_Blend ( T1_Face  face,
FT_UInt  num_coords,
FT_Fixed coords 
)

Definition at line 452 of file t1load.c.

455 {
457
458
459 error = t1_set_mm_blend( face, num_coords, coords );
460 if ( error )
461 return error;
462
463 if ( num_coords )
464 face->root.face_flags |= FT_FACE_FLAG_VARIATION;
465 else
466 face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
467
468 return FT_Err_Ok;
469 }
#define FT_FACE_FLAG_VARIATION
Definition: freetype.h:1212
static FT_Error t1_set_mm_blend(T1_Face face, FT_UInt num_coords, FT_Fixed *coords)
Definition: t1load.c:391

Referenced by T1_Reset_MM_Blend().

◆ T1_Set_MM_Design()

T1_Set_MM_Design ( T1_Face  face,
FT_UInt  num_coords,
FT_Long coords 
)

Definition at line 577 of file t1load.c.

580 {
582 PS_Blend blend = face->blend;
583 FT_UInt n, p;
584 FT_Fixed final_blends[T1_MAX_MM_DESIGNS];
585
586
587 if ( !blend )
588 return FT_THROW( Invalid_Argument );
589
590 if ( num_coords > blend->num_axis )
591 num_coords = blend->num_axis;
592
593 /* compute the blend coordinates through the blend design map */
594
595 for ( n = 0; n < blend->num_axis; n++ )
596 {
597 FT_Long design;
598 FT_Fixed the_blend;
599 PS_DesignMap map = blend->design_map + n;
600 FT_Long* designs = map->design_points;
601 FT_Fixed* blends = map->blend_points;
602 FT_Int before = -1, after = -1;
603
604
605 /* use a default value if we don't have a coordinate */
606 if ( n < num_coords )
607 design = coords[n];
608 else
609 design = ( designs[map->num_points - 1] - designs[0] ) / 2;
610
611 for ( p = 0; p < (FT_UInt)map->num_points; p++ )
612 {
613 FT_Long p_design = designs[p];
614
615
616 /* exact match? */
617 if ( design == p_design )
618 {
619 the_blend = blends[p];
620 goto Found;
621 }
622
623 if ( design < p_design )
624 {
625 after = (FT_Int)p;
626 break;
627 }
628
629 before = (FT_Int)p;
630 }
631
632 /* now interpolate if necessary */
633 if ( before < 0 )
634 the_blend = blends[0];
635
636 else if ( after < 0 )
637 the_blend = blends[map->num_points - 1];
638
639 else
640 the_blend = FT_MulDiv( design - designs[before],
641 blends [after] - blends [before],
642 designs[after] - designs[before] );
643
644 Found:
645 final_blends[n] = the_blend;
646 }
647
648 error = t1_set_mm_blend( face, blend->num_axis, final_blends );
649 if ( error )
650 return error;
651
652 if ( num_coords )
653 face->root.face_flags |= FT_FACE_FLAG_VARIATION;
654 else
655 face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
656
657 return FT_Err_Ok;
658 }
return Found
Definition: dirsup.c:1270
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:415
signed long FT_Long
Definition: fttypes.h:242
GLfloat GLfloat p
Definition: glext.h:8902
#define T1_MAX_MM_DESIGNS
Definition: t1tables.h:273
__inline int before(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2390
__inline int after(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2395

Referenced by T1_Set_Var_Design().

◆ T1_Set_MM_WeightVector()

T1_Set_MM_WeightVector ( T1_Face  face,
FT_UInt  len,
FT_Fixed weightvector 
)

Definition at line 508 of file t1load.c.

511 {
512 PS_Blend blend = face->blend;
513 FT_UInt i, n;
514
515
516 if ( !blend )
517 return FT_THROW( Invalid_Argument );
518
519 if ( !len && !weightvector )
520 {
521 for ( i = 0; i < blend->num_designs; i++ )
522 blend->weight_vector[i] = blend->default_weight_vector[i];
523 }
524 else
525 {
526 if ( !weightvector )
527 return FT_THROW( Invalid_Argument );
528
529 n = len < blend->num_designs ? len : blend->num_designs;
530
531 for ( i = 0; i < n; i++ )
532 blend->weight_vector[i] = weightvector[i];
533
534 for ( ; i < blend->num_designs; i++ )
535 blend->weight_vector[i] = (FT_Fixed)0;
536
537 if ( len )
538 face->root.face_flags |= FT_FACE_FLAG_VARIATION;
539 else
540 face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
541 }
542
543 return FT_Err_Ok;
544 }

◆ T1_Set_Var_Design()

T1_Set_Var_Design ( T1_Face  face,
FT_UInt  num_coords,
FT_Fixed coords 
)

Definition at line 679 of file t1load.c.

682 {
683 FT_Long lcoords[T1_MAX_MM_AXIS];
684 FT_UInt i;
685
686
687 if ( num_coords > T1_MAX_MM_AXIS )
688 num_coords = T1_MAX_MM_AXIS;
689
690 for ( i = 0; i < num_coords; i++ )
691 lcoords[i] = FIXED_TO_INT( coords[i] );
692
693 return T1_Set_MM_Design( face, num_coords, lcoords );
694 }
#define FIXED_TO_INT(x)
Definition: ftcalc.h:450
T1_Set_MM_Design(T1_Face face, FT_UInt num_coords, FT_Long *coords)
Definition: t1load.c:577