ReactOS 0.4.16-dev-2354-g16de117
sfdriver.c File Reference
Include dependency graph for sfdriver.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FT_COMPONENT   sfdriver
 
#define IS_WIN(n)
 
#define IS_APPLE(n)
 
#define PUT_EMBEDDED_BITMAPS(a)   NULL
 
#define PUT_COLOR_LAYERS(a)   NULL
 
#define PUT_PS_NAMES(a)   NULL
 

Typedefs

typedef int(* char_type_func) (int c)
 

Functions

static voidget_sfnt_table (TT_Face face, FT_Sfnt_Tag tag)
 
static FT_Error sfnt_table_info (TT_Face face, FT_UInt idx, FT_ULong *tag, FT_ULong *offset, FT_ULong *length)
 
 FT_DEFINE_SERVICE_SFNT_TABLEREC (sfnt_service_sfnt_table,(FT_SFNT_TableLoadFunc) tt_face_load_any,(FT_SFNT_TableGetFunc) get_sfnt_table,(FT_SFNT_TableInfoFunc) sfnt_table_info) static const unsigned char sfnt_ps_map[16]
 
static int sfnt_is_postscript (int c)
 
static charget_win_string (FT_Memory memory, FT_Stream stream, TT_Name entry, char_type_func char_type, FT_Bool report_invalid_characters)
 
static charget_apple_string (FT_Memory memory, FT_Stream stream, TT_Name entry, char_type_func char_type, FT_Bool report_invalid_characters)
 
static FT_Bool sfnt_get_name_id (TT_Face face, FT_UShort id, FT_Int *win, FT_Int *apple)
 
static const charsfnt_get_ps_name (TT_Face face)
 
 FT_DEFINE_SERVICE_PSFONTNAMEREC (sfnt_service_ps_name,(FT_PsName_GetFunc) sfnt_get_ps_name) FT_DEFINE_SERVICE_TTCMAPSREC(tt_service_get_cmap_info
 
TT_CMap_Info_GetFunc tt_get_cmap_info FT_DEFINE_SERVICEDESCREC3 (sfnt_services, FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table, FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name, FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info) sfnt_get_interface(FT_Module module
 
return ft_service_list_lookup (sfnt_services, module_interface)
 

Variables

TT_CMap_Info_GetFunc tt_get_cmap_info const charmodule_interface
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   sfdriver

Definition at line 70 of file sfdriver.c.

◆ IS_APPLE

#define IS_APPLE (   n)
Value:
( (n)->platformID == 1 && \
(n)->encodingID == 0 )
GLdouble n
Definition: glext.h:7729

Definition at line 484 of file sfdriver.c.

◆ IS_WIN

#define IS_WIN (   n)
Value:
( (n)->platformID == 3 && \
( (n)->encodingID == 1 || (n)->encodingID == 0 ) )

Definition at line 481 of file sfdriver.c.

◆ PUT_COLOR_LAYERS

#define PUT_COLOR_LAYERS (   a)    NULL

Definition at line 1213 of file sfdriver.c.

◆ PUT_EMBEDDED_BITMAPS

#define PUT_EMBEDDED_BITMAPS (   a)    NULL

Definition at line 1207 of file sfdriver.c.

◆ PUT_PS_NAMES

#define PUT_PS_NAMES (   a)    NULL

Definition at line 1219 of file sfdriver.c.

Typedef Documentation

◆ char_type_func

typedef int(* char_type_func) (int c)

Definition at line 477 of file sfdriver.c.

Function Documentation

◆ FT_DEFINE_SERVICE_PSFONTNAMEREC()

FT_DEFINE_SERVICE_PSFONTNAMEREC ( sfnt_service_ps_name  ,
(FT_PsName_GetFunc sfnt_get_ps_name 
)

◆ FT_DEFINE_SERVICE_SFNT_TABLEREC()

FT_DEFINE_SERVICE_SFNT_TABLEREC ( sfnt_service_sfnt_table  ,
(FT_SFNT_TableLoadFunc tt_face_load_any,
(FT_SFNT_TableGetFunc get_sfnt_table,
(FT_SFNT_TableInfoFunc sfnt_table_info 
) const

◆ FT_DEFINE_SERVICEDESCREC3()

TT_CMap_Info_GetFunc tt_get_cmap_info FT_DEFINE_SERVICEDESCREC3 ( sfnt_services  ,
FT_SERVICE_ID_SFNT_TABLE  ,
sfnt_service_sfnt_table,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME  ,
sfnt_service_ps_name,
FT_SERVICE_ID_TT_CMAP  ,
tt_service_get_cmap_info 
)

◆ ft_service_list_lookup()

return ft_service_list_lookup ( sfnt_services  ,
module_interface   
)

◆ get_apple_string()

static char * get_apple_string ( FT_Memory  memory,
FT_Stream  stream,
TT_Name  entry,
char_type_func  char_type,
FT_Bool  report_invalid_characters 
)
static

Definition at line 547 of file sfdriver.c.

552 {
554
555 char* result = NULL;
556 FT_String* r;
557 FT_Char* p;
558 FT_UInt len;
559
560 FT_UNUSED( error );
561
562
563 if ( FT_ALLOC( result, entry->stringLength + 1 ) )
564 return NULL;
565
566 if ( FT_STREAM_SEEK( entry->stringOffset ) ||
567 FT_FRAME_ENTER( entry->stringLength ) )
568 goto get_apple_string_error;
569
570 r = (FT_String*)result;
571 p = (FT_Char*)stream->cursor;
572
573 for ( len = entry->stringLength; len > 0; len--, p++ )
574 {
575 if ( char_type( *p ) )
576 *r++ = *p;
577 else
578 {
579 if ( report_invalid_characters )
580 FT_TRACE0(( "get_apple_string:"
581 " Character `%c' (0x%X) invalid in PS name string\n",
582 *p, *p ));
583 break;
584 }
585 }
586 if ( !len )
587 *r = '\0';
588
590
591 if ( !len )
592 return result;
593
594 get_apple_string_error:
595 FT_FREE( result );
596
597 entry->stringOffset = 0;
598 entry->stringLength = 0;
599 FT_FREE( entry->string );
600
601 return NULL;
602 }
#define NULL
Definition: types.h:112
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_TRACE0(varformat)
Definition: ftdebug.h:187
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:311
#define FT_FREE(ptr)
Definition: ftmemory.h:337
#define FT_FRAME_ENTER(size)
Definition: ftstream.h:548
#define FT_STREAM_SEEK(position)
Definition: ftstream.h:525
#define FT_FRAME_EXIT()
Definition: ftstream.h:553
signed char FT_Char
Definition: fttypes.h:143
int FT_Error
Definition: fttypes.h:299
char FT_String
Definition: fttypes.h:187
unsigned int FT_UInt
Definition: fttypes.h:231
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
uint32_t entry
Definition: isohybrid.c:63
#define error(str)
Definition: mkdosfs.c:1605
#define for
Definition: utility.h:88
#define FT_UNUSED(arg)
Definition: parse.h:23
char_type
Definition: utilities.c:10

Referenced by sfnt_get_ps_name().

◆ get_sfnt_table()

static void * get_sfnt_table ( TT_Face  face,
FT_Sfnt_Tag  tag 
)
static

Definition at line 79 of file sfdriver.c.

81 {
82 void* table;
83
84
85 switch ( tag )
86 {
87 case FT_SFNT_HEAD:
88 table = &face->header;
89 break;
90
91 case FT_SFNT_HHEA:
92 table = &face->horizontal;
93 break;
94
95 case FT_SFNT_VHEA:
96 table = face->vertical_info ? &face->vertical : NULL;
97 break;
98
99 case FT_SFNT_OS2:
100 table = ( face->os2.version == 0xFFFFU ) ? NULL : &face->os2;
101 break;
102
103 case FT_SFNT_POST:
104 table = &face->postscript;
105 break;
106
107 case FT_SFNT_MAXP:
108 table = &face->max_profile;
109 break;
110
111 case FT_SFNT_PCLT:
112 table = face->pclt.Version ? &face->pclt : NULL;
113 break;
114
115 default:
116 table = NULL;
117 }
118
119 return table;
120 }
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
Definition: ecma_167.h:138
@ FT_SFNT_HHEA
Definition: tttables.h:625
@ FT_SFNT_MAXP
Definition: tttables.h:623
@ FT_SFNT_HEAD
Definition: tttables.h:622
@ FT_SFNT_PCLT
Definition: tttables.h:628
@ FT_SFNT_POST
Definition: tttables.h:627
@ FT_SFNT_VHEA
Definition: tttables.h:626
@ FT_SFNT_OS2
Definition: tttables.h:624

◆ get_win_string()

static char * get_win_string ( FT_Memory  memory,
FT_Stream  stream,
TT_Name  entry,
char_type_func  char_type,
FT_Bool  report_invalid_characters 
)
static

Definition at line 488 of file sfdriver.c.

493 {
495
496 char* result = NULL;
497 FT_String* r;
498 FT_Char* p;
499 FT_UInt len;
500
501 FT_UNUSED( error );
502
503
504 if ( FT_ALLOC( result, entry->stringLength / 2 + 1 ) )
505 return NULL;
506
507 if ( FT_STREAM_SEEK( entry->stringOffset ) ||
508 FT_FRAME_ENTER( entry->stringLength ) )
509 goto get_win_string_error;
510
511 r = (FT_String*)result;
512 p = (FT_Char*)stream->cursor;
513
514 for ( len = entry->stringLength / 2; len > 0; len--, p += 2 )
515 {
516 if ( p[0] == 0 && char_type( p[1] ) )
517 *r++ = p[1];
518 else
519 {
520 if ( report_invalid_characters )
521 FT_TRACE0(( "get_win_string:"
522 " Character 0x%X invalid in PS name string\n",
523 ((unsigned)p[0])*256 + (unsigned)p[1] ));
524 break;
525 }
526 }
527 if ( !len )
528 *r = '\0';
529
531
532 if ( !len )
533 return result;
534
535 get_win_string_error:
536 FT_FREE( result );
537
538 entry->stringLength = 0;
539 entry->stringOffset = 0;
540 FT_FREE( entry->string );
541
542 return NULL;
543 }

Referenced by sfnt_get_ps_name().

◆ sfnt_get_name_id()

static FT_Bool sfnt_get_name_id ( TT_Face  face,
FT_UShort  id,
FT_Int win,
FT_Int apple 
)
static

Definition at line 606 of file sfdriver.c.

610 {
611 FT_Int n;
612
613
614 *win = -1;
615 *apple = -1;
616
617 for ( n = 0; n < face->num_names; n++ )
618 {
619 TT_Name name = face->name_table.names + n;
620
621
622 if ( name->nameID == id && name->stringLength > 0 )
623 {
624 if ( IS_WIN( name ) && ( name->languageID == 0x409 || *win == -1 ) )
625 *win = n;
626
627 if ( IS_APPLE( name ) && ( name->languageID == 0 || *apple == -1 ) )
628 *apple = n;
629 }
630 }
631
632 return ( *win >= 0 ) || ( *apple >= 0 );
633 }
signed int FT_Int
Definition: fttypes.h:220
static real win[4][36]
#define IS_WIN(n)
Definition: sfdriver.c:481
#define IS_APPLE(n)
Definition: sfdriver.c:484
Definition: name.c:39

Referenced by sfnt_get_ps_name().

◆ sfnt_get_ps_name()

static const char * sfnt_get_ps_name ( TT_Face  face)
static

Definition at line 1044 of file sfdriver.c.

1045 {
1046 FT_Int found, win, apple;
1047 const char* result = NULL;
1048
1049
1050 if ( face->postscript_name )
1051 return face->postscript_name;
1052
1053#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
1054 if ( face->blend &&
1056 FT_IS_VARIATION( FT_FACE( face ) ) ) )
1057 {
1058 face->postscript_name = sfnt_get_var_ps_name( face );
1059 return face->postscript_name;
1060 }
1061#endif
1062
1063 /* scan the name table to see whether we have a Postscript name here, */
1064 /* either in Macintosh or Windows platform encodings */
1065 found = sfnt_get_name_id( face, TT_NAME_ID_PS_NAME, &win, &apple );
1066 if ( !found )
1067 return NULL;
1068
1069 /* prefer Windows entries over Apple */
1070 if ( win != -1 )
1071 result = get_win_string( face->root.memory,
1072 face->name_table.stream,
1073 face->name_table.names + win,
1075 1 );
1076 if ( !result && apple != -1 )
1077 result = get_apple_string( face->root.memory,
1078 face->name_table.stream,
1079 face->name_table.names + apple,
1081 1 );
1082
1083 face->postscript_name = result;
1084
1085 return result;
1086 }
#define FT_IS_VARIATION(face)
Definition: freetype.h:1401
#define FT_IS_NAMED_INSTANCE(face)
Definition: freetype.h:1383
#define FT_FACE(x)
Definition: ftobjs.h:597
static char * get_win_string(FT_Memory memory, FT_Stream stream, TT_Name entry, char_type_func char_type, FT_Bool report_invalid_characters)
Definition: sfdriver.c:488
static char * get_apple_string(FT_Memory memory, FT_Stream stream, TT_Name entry, char_type_func char_type, FT_Bool report_invalid_characters)
Definition: sfdriver.c:547
static FT_Bool sfnt_get_name_id(TT_Face face, FT_UShort id, FT_Int *win, FT_Int *apple)
Definition: sfdriver.c:606
static int sfnt_is_postscript(int c)
Definition: sfdriver.c:248
#define TT_NAME_ID_PS_NAME
Definition: ttnameid.h:798

◆ sfnt_is_postscript()

static int sfnt_is_postscript ( int  c)
static

Definition at line 248 of file sfdriver.c.

249 {
250 unsigned int cc;
251
252
253 if ( c < 0 || c >= 0x80 )
254 return 0;
255
256 cc = (unsigned int)c;
257
258 return sfnt_ps_map[cc >> 3] & ( 1 << ( cc & 0x07 ) );
259 }
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
const GLubyte * c
Definition: glext.h:8905
uint32_t cc
Definition: isohybrid.c:75

Referenced by sfnt_get_ps_name().

◆ sfnt_table_info()

static FT_Error sfnt_table_info ( TT_Face  face,
FT_UInt  idx,
FT_ULong tag,
FT_ULong offset,
FT_ULong length 
)
static

Definition at line 124 of file sfdriver.c.

129 {
130 if ( !offset || !length )
131 return FT_THROW( Invalid_Argument );
132
133 if ( !tag )
134 *length = face->num_tables;
135 else
136 {
137 if ( idx >= face->num_tables )
138 return FT_THROW( Table_Missing );
139
140 *tag = face->dir_tables[idx].Tag;
141 *offset = face->dir_tables[idx].Offset;
142 *length = face->dir_tables[idx].Length;
143 }
144
145 return FT_Err_Ok;
146 }
unsigned int idx
Definition: utils.c:41
#define FT_THROW(e)
Definition: ftdebug.h:243
GLintptr offset
Definition: glext.h:5920
GLuint GLsizei GLsizei * length
Definition: glext.h:6040

Variable Documentation

◆ module_interface

Initial value:

Definition at line 1196 of file sfdriver.c.

Referenced by af_get_interface(), and cff_get_interface().