ReactOS 0.4.15-dev-8236-g99f0937
t1load.h File Reference
#include <ft2build.h>
#include "t1parse.h"
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)
 

Macro Definition Documentation

◆ T1_FONTDIR_AFTER_PRIVATE

#define T1_FONTDIR_AFTER_PRIVATE   ( 1 << 1 )

Definition at line 61 of file t1load.h.

◆ T1_PRIVATE

#define T1_PRIVATE   ( 1 << 0 )

Definition at line 60 of file t1load.h.

Typedef Documentation

◆ T1_Loader

◆ T1_LoaderRec

Function Documentation

◆ T1_Done_Blend()

T1_Done_Blend ( T1_Face  face)

Definition at line 637 of file t1load.c.

638 {
639 FT_Memory memory = face->root.memory;
640 PS_Blend blend = face->blend;
641
642
643 if ( blend )
644 {
645 FT_UInt num_designs = blend->num_designs;
646 FT_UInt num_axis = blend->num_axis;
647 FT_UInt n;
648
649
650 /* release design pos table */
651 FT_FREE( blend->design_pos[0] );
652 for ( n = 1; n < num_designs; n++ )
653 blend->design_pos[n] = NULL;
654
655 /* release blend `private' and `font info' dictionaries */
656 FT_FREE( blend->privates[1] );
657 FT_FREE( blend->font_infos[1] );
658 FT_FREE( blend->bboxes[1] );
659
660 for ( n = 0; n < num_designs; n++ )
661 {
662 blend->privates [n] = NULL;
663 blend->font_infos[n] = NULL;
664 blend->bboxes [n] = NULL;
665 }
666
667 /* release weight vectors */
668 FT_FREE( blend->weight_vector );
670
671 /* release axis names */
672 for ( n = 0; n < num_axis; n++ )
673 FT_FREE( blend->axis_names[n] );
674
675 /* release design map */
676 for ( n = 0; n < num_axis; n++ )
677 {
678 PS_DesignMap dmap = blend->design_map + n;
679
680
681 FT_FREE( dmap->design_points );
682 dmap->num_points = 0;
683 }
684
685 FT_FREE( face->blend );
686 }
687 }
#define NULL
Definition: types.h:112
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
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:116
PS_DesignMapRec design_map[T1_MAX_MM_AXIS]
Definition: t1tables.h:305
FT_Fixed * default_weight_vector
Definition: t1tables.h:308
PS_Private privates[T1_MAX_MM_DESIGNS+1]
Definition: t1tables.h:311
FT_BBox * bboxes[T1_MAX_MM_DESIGNS+1]
Definition: t1tables.h:315
PS_FontInfo font_infos[T1_MAX_MM_DESIGNS+1]
Definition: t1tables.h:310
FT_Fixed * design_pos[T1_MAX_MM_DESIGNS]
Definition: t1tables.h:304
FT_UInt num_designs
Definition: t1tables.h:300
FT_Fixed * weight_vector
Definition: t1tables.h:307
FT_UInt num_axis
Definition: t1tables.h:301
FT_String * axis_names[T1_MAX_MM_AXIS]
Definition: t1tables.h:303
FT_Byte num_points
Definition: t1tables.h:288
FT_Long * design_points
Definition: t1tables.h:289

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 445 of file t1load.c.

448 {
449 PS_Blend blend = face->blend;
450
451 FT_Fixed axiscoords[4];
452 FT_UInt i, nc;
453
454
455 if ( !blend )
456 return FT_THROW( Invalid_Argument );
457
459 axiscoords,
460 blend->num_axis );
461
462 nc = num_coords;
463 if ( num_coords > blend->num_axis )
464 {
465 FT_TRACE2(( "T1_Get_MM_Blend: only using first %d of %d coordinates\n",
466 blend->num_axis, num_coords ));
467 nc = blend->num_axis;
468 }
469
470 for ( i = 0; i < nc; i++ )
471 coords[i] = axiscoords[i];
472 for ( ; i < num_coords; i++ )
473 coords[i] = 0x8000;
474
475 return FT_Err_Ok;
476 }
return FT_Err_Ok
Definition: ftbbox.c:511
#define FT_THROW(e)
Definition: ftdebug.h:213
#define FT_TRACE2(varformat)
Definition: ftdebug.h:159
signed long FT_Fixed
Definition: fttypes.h:288
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
313
314 error = T1_Get_Multi_Master( face, &mmaster );
315 if ( error )
316 goto Exit;
317 if ( FT_ALLOC( mmvar,
318 sizeof ( FT_MM_Var ) +
319 mmaster.num_axis * sizeof ( FT_Var_Axis ) ) )
320 goto Exit;
321
322 mmvar->num_axis = mmaster.num_axis;
323 mmvar->num_designs = mmaster.num_designs;
324 mmvar->num_namedstyles = 0; /* Not supported */
325 mmvar->axis = (FT_Var_Axis*)&mmvar[1];
326 /* Point to axes after MM_Var struct */
327 mmvar->namedstyle = NULL;
328
329 for ( i = 0; i < mmaster.num_axis; i++ )
330 {
331 mmvar->axis[i].name = mmaster.axis[i].name;
332 mmvar->axis[i].minimum = INT_TO_FIXED( mmaster.axis[i].minimum );
333 mmvar->axis[i].maximum = INT_TO_FIXED( mmaster.axis[i].maximum );
334 mmvar->axis[i].def = ( mmvar->axis[i].minimum +
335 mmvar->axis[i].maximum ) / 2;
336 /* Does not apply. But this value is in range */
337 mmvar->axis[i].strid = ~0U; /* Does not apply */
338 mmvar->axis[i].tag = ~0U; /* Does not apply */
339
340 if ( !mmvar->axis[i].name )
341 continue;
342
343 if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
344 mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
345 else if ( ft_strcmp( mmvar->axis[i].name, "Width" ) == 0 )
346 mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'd', 't', 'h' );
347 else if ( ft_strcmp( mmvar->axis[i].name, "OpticalSize" ) == 0 )
348 mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' );
349 }
350
351 if ( blend->num_designs == ( 1U << blend->num_axis ) )
352 {
354 axiscoords,
355 blend->num_axis );
356
357 for ( i = 0; i < mmaster.num_axis; i++ )
358 mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i],
359 axiscoords[i] );
360 }
361
362 *master = mmvar;
363
364 Exit:
365 return error;
366 }
#define U(x)
Definition: wordpad.c:45
#define INT_TO_FIXED(x)
Definition: ftcalc.h:404
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
#define ft_strcmp
Definition: ftstdlib.h:86
int FT_Error
Definition: fttypes.h:300
#define FT_MAKE_TAG(_x1, _x2, _x3, _x4)
Definition: fttypes.h:480
#define error(str)
Definition: mkdosfs.c:1605
static void Exit(void)
Definition: sock.c:1330
FT_Var_Axis * axis
Definition: ftmm.h:242
FT_UInt num_designs
Definition: ftmm.h:240
FT_UInt num_namedstyles
Definition: ftmm.h:241
FT_UInt num_axis
Definition: ftmm.h:239
FT_Var_Named_Style * namedstyle
Definition: ftmm.h:243
FT_MM_Axis axis[T1_MAX_MM_AXIS]
Definition: ftmm.h:108
FT_UInt num_designs
Definition: ftmm.h:107
FT_UInt num_axis
Definition: ftmm.h:106
FT_ULong tag
Definition: ftmm.h:157
FT_UInt strid
Definition: ftmm.h:158
FT_Fixed def
Definition: ftmm.h:154
FT_Fixed maximum
Definition: ftmm.h:155
FT_String * name
Definition: ftmm.h:151
FT_Fixed minimum
Definition: ftmm.h:153
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:279
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

◆ 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 601 of file t1load.c.

604 {
605 PS_Blend blend = face->blend;
606
607 FT_Fixed axiscoords[4];
608 FT_UInt i, nc;
609
610
611 if ( !blend )
612 return FT_THROW( Invalid_Argument );
613
615 axiscoords,
616 blend->num_axis );
617
618 nc = num_coords;
619 if ( num_coords > blend->num_axis )
620 {
621 FT_TRACE2(( "T1_Get_Var_Design:"
622 " only using first %d of %d coordinates\n",
623 blend->num_axis, num_coords ));
624 nc = blend->num_axis;
625 }
626
627 for ( i = 0; i < nc; i++ )
628 coords[i] = mm_axis_unmap( &blend->design_map[i], axiscoords[i] );
629 for ( ; i < num_coords; i++ )
630 coords[i] = 0;
631
632 return FT_Err_Ok;
633 }

◆ T1_Open_Face()

T1_Open_Face ( T1_Face  face)

Definition at line 2301 of file t1load.c.

2302 {
2303 T1_LoaderRec loader;
2305 T1_Font type1 = &face->type1;
2306 PS_Private priv = &type1->private_dict;
2308
2309 PSAux_Service psaux = (PSAux_Service)face->psaux;
2310
2311
2312 t1_init_loader( &loader, face );
2313
2314 /* default values */
2315 face->ndv_idx = -1;
2316 face->cdv_idx = -1;
2317 face->len_buildchar = 0;
2318
2319 priv->blue_shift = 7;
2320 priv->blue_fuzz = 1;
2321 priv->lenIV = 4;
2322 priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );
2323 priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );
2324
2325 parser = &loader.parser;
2327 face->root.stream,
2328 face->root.memory,
2329 psaux );
2330 if ( error )
2331 goto Exit;
2332
2333 error = parse_dict( face, &loader,
2334 parser->base_dict, parser->base_len );
2335 if ( error )
2336 goto Exit;
2337
2338 error = T1_Get_Private_Dict( parser, psaux );
2339 if ( error )
2340 goto Exit;
2341
2342 error = parse_dict( face, &loader,
2343 parser->private_dict, parser->private_len );
2344 if ( error )
2345 goto Exit;
2346
2347 /* ensure even-ness of `num_blue_values' */
2348 priv->num_blue_values &= ~1;
2349
2350#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
2351
2352 if ( face->blend &&
2353 face->blend->num_default_design_vector != 0 &&
2354 face->blend->num_default_design_vector != face->blend->num_axis )
2355 {
2356 /* we don't use it currently so just warn, reset, and ignore */
2357 FT_ERROR(( "T1_Open_Face(): /DesignVector contains %u entries "
2358 "while there are %u axes.\n",
2359 face->blend->num_default_design_vector,
2360 face->blend->num_axis ));
2361
2362 face->blend->num_default_design_vector = 0;
2363 }
2364
2365 /* the following can happen for MM instances; we then treat the */
2366 /* font as a normal PS font */
2367 if ( face->blend &&
2368 ( !face->blend->num_designs || !face->blend->num_axis ) )
2370
2371 /* another safety check */
2372 if ( face->blend )
2373 {
2374 FT_UInt i;
2375
2376
2377 for ( i = 0; i < face->blend->num_axis; i++ )
2378 if ( !face->blend->design_map[i].num_points )
2379 {
2381 break;
2382 }
2383 }
2384
2385 if ( face->blend )
2386 {
2387 if ( face->len_buildchar > 0 )
2388 {
2389 FT_Memory memory = face->root.memory;
2390
2391
2392 if ( FT_NEW_ARRAY( face->buildchar, face->len_buildchar ) )
2393 {
2394 FT_ERROR(( "T1_Open_Face: cannot allocate BuildCharArray\n" ));
2395 face->len_buildchar = 0;
2396 goto Exit;
2397 }
2398 }
2399 }
2400 else
2401 face->len_buildchar = 0;
2402
2403#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */
2404
2405 /* now, propagate the subrs, charstrings, and glyphnames tables */
2406 /* to the Type1 data */
2407 type1->num_glyphs = loader.num_glyphs;
2408
2409 if ( loader.subrs.init )
2410 {
2411 type1->num_subrs = loader.num_subrs;
2412 type1->subrs_block = loader.subrs.block;
2413 type1->subrs = loader.subrs.elements;
2414 type1->subrs_len = loader.subrs.lengths;
2415 type1->subrs_hash = loader.subrs_hash;
2416
2417 /* prevent `t1_done_loader' from freeing the propagated data */
2418 loader.subrs.init = 0;
2419 loader.subrs_hash = NULL;
2420 }
2421
2422 if ( !IS_INCREMENTAL )
2423 if ( !loader.charstrings.init )
2424 {
2425 FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" ));
2426 error = FT_THROW( Invalid_File_Format );
2427 }
2428
2429 loader.charstrings.init = 0;
2430 type1->charstrings_block = loader.charstrings.block;
2431 type1->charstrings = loader.charstrings.elements;
2432 type1->charstrings_len = loader.charstrings.lengths;
2433
2434 /* we copy the glyph names `block' and `elements' fields; */
2435 /* the `lengths' field must be released later */
2436 type1->glyph_names_block = loader.glyph_names.block;
2437 type1->glyph_names = (FT_String**)loader.glyph_names.elements;
2438 loader.glyph_names.block = NULL;
2439 loader.glyph_names.elements = NULL;
2440
2441 /* we must now build type1.encoding when we have a custom array */
2443 {
2444 FT_Int charcode, idx, min_char, max_char;
2445 FT_Byte* glyph_name;
2446
2447
2448 /* OK, we do the following: for each element in the encoding */
2449 /* table, look up the index of the glyph having the same name */
2450 /* the index is then stored in type1.encoding.char_index, and */
2451 /* the name to type1.encoding.char_name */
2452
2453 min_char = 0;
2454 max_char = 0;
2455
2456 charcode = 0;
2457 for ( ; charcode < loader.encoding_table.max_elems; charcode++ )
2458 {
2459 FT_Byte* char_name;
2460
2461
2462 type1->encoding.char_index[charcode] = 0;
2463 type1->encoding.char_name [charcode] = (char *)".notdef";
2464
2465 char_name = loader.encoding_table.elements[charcode];
2466 if ( char_name )
2467 for ( idx = 0; idx < type1->num_glyphs; idx++ )
2468 {
2469 glyph_name = (FT_Byte*)type1->glyph_names[idx];
2470 if ( ft_strcmp( (const char*)char_name,
2471 (const char*)glyph_name ) == 0 )
2472 {
2473 type1->encoding.char_index[charcode] = (FT_UShort)idx;
2474 type1->encoding.char_name [charcode] = (char*)glyph_name;
2475
2476 /* Change min/max encoded char only if glyph name is */
2477 /* not /.notdef */
2478 if ( ft_strcmp( (const char*)".notdef",
2479 (const char*)glyph_name ) != 0 )
2480 {
2481 if ( charcode < min_char )
2482 min_char = charcode;
2483 if ( charcode >= max_char )
2484 max_char = charcode + 1;
2485 }
2486 break;
2487 }
2488 }
2489 }
2490
2491 type1->encoding.code_first = min_char;
2492 type1->encoding.code_last = max_char;
2493 type1->encoding.num_chars = loader.num_chars;
2494 }
2495
2496 Exit:
2497 t1_done_loader( &loader );
2498 return error;
2499 }
unsigned int idx
Definition: utils.c:41
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_NEW_ARRAY(ptr, count)
Definition: ftmemory.h:333
unsigned char FT_Byte
Definition: fttypes.h:154
unsigned short FT_UShort
Definition: fttypes.h:209
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:156
FT_Fixed expansion_factor
Definition: t1tables.h:169
FT_Int lenIV
Definition: t1tables.h:141
FT_Int blue_shift
Definition: t1tables.h:155
FT_Byte num_blue_values
Definition: t1tables.h:143
FT_Fixed blue_scale
Definition: t1tables.h:154
PS_PrivateRec private_dict
Definition: t1types.h:98
T1_EncodingType encoding_type
Definition: t1types.h:101
FT_Byte * subrs_block
Definition: t1types.h:104
FT_Byte ** subrs
Definition: t1types.h:109
FT_Int num_glyphs
Definition: t1types.h:113
FT_UInt * charstrings_len
Definition: t1types.h:116
FT_String ** glyph_names
Definition: t1types.h:114
T1_EncodingRec encoding
Definition: t1types.h:102
FT_Int num_subrs
Definition: t1types.h:108
FT_Byte * charstrings_block
Definition: t1types.h:105
FT_Hash subrs_hash
Definition: t1types.h:111
FT_Byte ** charstrings
Definition: t1types.h:115
FT_UInt * subrs_len
Definition: t1types.h:110
FT_Byte * glyph_names_block
Definition: t1types.h:106
Definition: import.c:81
static void t1_init_loader(T1_Loader loader, T1_Face face)
Definition: t1load.c:2268
#define IS_INCREMENTAL
Definition: t1load.c:78
T1_Done_Blend(T1_Face face)
Definition: t1load.c:637
static void t1_done_loader(T1_Loader loader)
Definition: t1load.c:2278
static FT_Error parse_dict(T1_Face face, T1_Loader loader, FT_Byte *base, FT_ULong size)
Definition: t1load.c:2071
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:136
T1_Get_Private_Dict(T1_Parser parser, PSAux_Service psaux)
Definition: t1parse.c:261
FT_BEGIN_HEADER struct T1_ParserRec_ * T1_Parser
@ T1_ENCODING_TYPE_ARRAY
Definition: t1tables.h:563

Referenced by T1_Face_Init().

◆ T1_Reset_MM_Blend()

T1_Reset_MM_Blend ( T1_Face  face,
FT_UInt  instance_index 
)

Definition at line 567 of file t1load.c.

569 {
570 FT_UNUSED( instance_index );
571
572 return T1_Set_MM_Blend( face, 0, NULL );
573 }
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
T1_Set_MM_Blend(T1_Face face, FT_UInt num_coords, FT_Fixed *coords)
Definition: t1load.c:424

◆ T1_Set_MM_Blend()

T1_Set_MM_Blend ( T1_Face  face,
FT_UInt  num_coords,
FT_Fixed coords 
)

Definition at line 424 of file t1load.c.

427 {
429
430
431 error = t1_set_mm_blend( face, num_coords, coords );
432 if ( error )
433 return error;
434
435 if ( num_coords )
436 face->root.face_flags |= FT_FACE_FLAG_VARIATION;
437 else
438 face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
439
440 return FT_Err_Ok;
441 }
#define FT_FACE_FLAG_VARIATION
Definition: freetype.h:1253
static FT_Error t1_set_mm_blend(T1_Face face, FT_UInt num_coords, FT_Fixed *coords)
Definition: t1load.c:370

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 480 of file t1load.c.

483 {
485 PS_Blend blend = face->blend;
486 FT_UInt n, p;
487 FT_Fixed final_blends[T1_MAX_MM_DESIGNS];
488
489
490 if ( !blend )
491 return FT_THROW( Invalid_Argument );
492
493 if ( num_coords > blend->num_axis )
494 num_coords = blend->num_axis;
495
496 /* compute the blend coordinates through the blend design map */
497
498 for ( n = 0; n < blend->num_axis; n++ )
499 {
500 FT_Long design;
501 FT_Fixed the_blend;
502 PS_DesignMap map = blend->design_map + n;
503 FT_Long* designs = map->design_points;
504 FT_Fixed* blends = map->blend_points;
505 FT_Int before = -1, after = -1;
506
507
508 /* use a default value if we don't have a coordinate */
509 if ( n < num_coords )
510 design = coords[n];
511 else
512 design = ( designs[map->num_points - 1] - designs[0] ) / 2;
513
514 for ( p = 0; p < (FT_UInt)map->num_points; p++ )
515 {
516 FT_Long p_design = designs[p];
517
518
519 /* exact match? */
520 if ( design == p_design )
521 {
522 the_blend = blends[p];
523 goto Found;
524 }
525
526 if ( design < p_design )
527 {
528 after = (FT_Int)p;
529 break;
530 }
531
532 before = (FT_Int)p;
533 }
534
535 /* now interpolate if necessary */
536 if ( before < 0 )
537 the_blend = blends[0];
538
539 else if ( after < 0 )
540 the_blend = blends[map->num_points - 1];
541
542 else
543 the_blend = FT_MulDiv( design - designs[before],
544 blends [after] - blends [before],
545 designs[after] - designs[before] );
546
547 Found:
548 final_blends[n] = the_blend;
549 }
550
551 error = t1_set_mm_blend( face, blend->num_axis, final_blends );
552 if ( error )
553 return error;
554
555 if ( num_coords )
556 face->root.face_flags |= FT_FACE_FLAG_VARIATION;
557 else
558 face->root.face_flags &= ~FT_FACE_FLAG_VARIATION;
559
560 return FT_Err_Ok;
561 }
return Found
Definition: dirsup.c:1270
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:416
signed long FT_Long
Definition: fttypes.h:242
GLfloat GLfloat p
Definition: glext.h:8902
#define T1_MAX_MM_DESIGNS
Definition: t1tables.h:276
__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_Var_Design()

T1_Set_Var_Design ( T1_Face  face,
FT_UInt  num_coords,
FT_Fixed coords 
)

Definition at line 582 of file t1load.c.

585 {
586 FT_Long lcoords[T1_MAX_MM_AXIS];
587 FT_UInt i;
588
589
590 if ( num_coords > T1_MAX_MM_AXIS )
591 num_coords = T1_MAX_MM_AXIS;
592
593 for ( i = 0; i < num_coords; i++ )
594 lcoords[i] = FIXED_TO_INT( coords[i] );
595
596 return T1_Set_MM_Design( face, num_coords, lcoords );
597 }
#define FIXED_TO_INT(x)
Definition: ftcalc.h:406
T1_Set_MM_Design(T1_Face face, FT_UInt num_coords, FT_Long *coords)
Definition: t1load.c:480