forked from minhngoc25a/freetype2
Changed to use cffgload.{c,h} instead of t2gload.{c,h}. Also, all
occurences of t2_ (T2_) were replaced with cff_ (CFF_, resp.).
This commit is contained in:
parent
8050a6b85d
commit
8d1f604993
|
@ -23,7 +23,7 @@
|
|||
#include FT_SOURCE_FILE(cff,cffparse.c)
|
||||
#include FT_SOURCE_FILE(cff,cffload.c)
|
||||
#include FT_SOURCE_FILE(cff,cffobjs.c)
|
||||
#include FT_SOURCE_FILE(cff,t2gload.c)
|
||||
#include FT_SOURCE_FILE(cff,cffgload.c)
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include FT_INTERNAL_CFF_ERRORS_H
|
||||
|
||||
#include FT_SOURCE_FILE(cff,cffdrivr.h)
|
||||
#include FT_SOURCE_FILE(cff,t2gload.h)
|
||||
#include FT_SOURCE_FILE(cff,cffgload.h)
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -35,7 +35,7 @@
|
|||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_t2driver
|
||||
#define FT_COMPONENT trace_cffdriver
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -98,7 +98,7 @@
|
|||
|
||||
|
||||
if ( !face )
|
||||
return T2_Err_Invalid_Face_Handle;
|
||||
return CFF_Err_Invalid_Face_Handle;
|
||||
|
||||
kerning->x = 0;
|
||||
kerning->y = 0;
|
||||
|
@ -133,7 +133,7 @@
|
|||
}
|
||||
|
||||
Exit:
|
||||
return T2_Err_Ok;
|
||||
return CFF_Err_Ok;
|
||||
|
||||
Found:
|
||||
kerning->x = pair->value;
|
||||
|
@ -171,8 +171,8 @@
|
|||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Load_Glyph( T2_GlyphSlot slot,
|
||||
T2_Size size,
|
||||
FT_Error Load_Glyph( CFF_GlyphSlot slot,
|
||||
CFF_Size size,
|
||||
FT_UShort glyph_index,
|
||||
FT_UInt load_flags )
|
||||
{
|
||||
|
@ -180,7 +180,7 @@
|
|||
|
||||
|
||||
if ( !slot )
|
||||
return T2_Err_Invalid_Glyph_Handle;
|
||||
return CFF_Err_Invalid_Glyph_Handle;
|
||||
|
||||
/* check whether we want a scaled outline or bitmap */
|
||||
if ( !size )
|
||||
|
@ -194,11 +194,11 @@
|
|||
{
|
||||
/* these two object must have the same parent */
|
||||
if ( size->face != slot->root.face )
|
||||
return T2_Err_Invalid_Face_Handle;
|
||||
return CFF_Err_Invalid_Face_Handle;
|
||||
}
|
||||
|
||||
/* now load the glyph outline if necessary */
|
||||
error = T2_Load_Glyph( slot, size, glyph_index, load_flags );
|
||||
error = CFF_Load_Glyph( slot, size, glyph_index, load_flags );
|
||||
|
||||
/* force drop-out mode to 2 - irrelevant now */
|
||||
/* slot->outline.dropout_mode = 2; */
|
||||
|
@ -235,16 +235,16 @@
|
|||
/* Glyph index. 0 means `undefined character code'. */
|
||||
/* */
|
||||
static
|
||||
FT_UInt t2_get_char_index( TT_CharMap charmap,
|
||||
FT_UInt cff_get_char_index( TT_CharMap charmap,
|
||||
FT_Long charcode )
|
||||
{
|
||||
FT_Error error;
|
||||
T2_Face face;
|
||||
CFF_Face face;
|
||||
TT_CMapTable* cmap;
|
||||
|
||||
|
||||
cmap = &charmap->cmap;
|
||||
face = (T2_Face)charmap->root.face;
|
||||
face = (CFF_Face)charmap->root.face;
|
||||
|
||||
/* Load table if needed */
|
||||
if ( !cmap->loaded )
|
||||
|
@ -277,7 +277,7 @@
|
|||
|
||||
|
||||
static
|
||||
FT_Module_Interface t2_get_interface( T2_Driver driver,
|
||||
FT_Module_Interface cff_get_interface( CFF_Driver driver,
|
||||
const char* interface )
|
||||
{
|
||||
FT_Module sfnt;
|
||||
|
@ -298,25 +298,25 @@
|
|||
/* begin with the FT_Module_Class fields */
|
||||
{
|
||||
ft_module_font_driver | ft_module_driver_scalable,
|
||||
sizeof( T2_DriverRec ),
|
||||
sizeof( CFF_DriverRec ),
|
||||
"cff",
|
||||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
0, /* module-specific interface */
|
||||
|
||||
(FT_Module_Constructor)T2_Init_Driver,
|
||||
(FT_Module_Destructor) T2_Done_Driver,
|
||||
(FT_Module_Requester) t2_get_interface,
|
||||
(FT_Module_Constructor)CFF_Init_Driver,
|
||||
(FT_Module_Destructor) CFF_Done_Driver,
|
||||
(FT_Module_Requester) cff_get_interface,
|
||||
},
|
||||
|
||||
/* now the specific driver fields */
|
||||
sizeof( TT_FaceRec ),
|
||||
sizeof( FT_SizeRec ),
|
||||
sizeof( T2_GlyphSlotRec ),
|
||||
sizeof( CFF_GlyphSlotRec ),
|
||||
|
||||
(FTDriver_initFace) T2_Init_Face,
|
||||
(FTDriver_doneFace) T2_Done_Face,
|
||||
(FTDriver_initFace) CFF_Init_Face,
|
||||
(FTDriver_doneFace) CFF_Done_Face,
|
||||
(FTDriver_initSize) 0,
|
||||
(FTDriver_doneSize) 0,
|
||||
(FTDriver_initGlyphSlot)0,
|
||||
|
@ -326,7 +326,7 @@
|
|||
(FTDriver_setPixelSizes)0,
|
||||
|
||||
(FTDriver_loadGlyph) Load_Glyph,
|
||||
(FTDriver_getCharIndex) t2_get_char_index,
|
||||
(FTDriver_getCharIndex) cff_get_char_index,
|
||||
|
||||
(FTDriver_getKerning) Get_Kerning,
|
||||
(FTDriver_attachFile) 0,
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_t2load
|
||||
#define FT_COMPONENT trace_cffload
|
||||
|
||||
|
||||
static
|
||||
|
@ -1257,7 +1257,7 @@
|
|||
}
|
||||
}
|
||||
else
|
||||
error = T2_Err_Invalid_Argument;
|
||||
error = CFF_Err_Invalid_Argument;
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
|
@ -1398,7 +1398,7 @@
|
|||
break;
|
||||
|
||||
default: /* hmm... that's wrong */
|
||||
error = T2_Err_Invalid_File_Format;
|
||||
error = CFF_Err_Invalid_File_Format;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
@ -2112,7 +2112,7 @@
|
|||
{
|
||||
FT_ERROR(( "CFF_Load_Font: incorrect face index = %d\n",
|
||||
face_index ));
|
||||
error = T2_Err_Invalid_Argument;
|
||||
error = CFF_Err_Invalid_Argument;
|
||||
}
|
||||
|
||||
/* in case of a font format check, simply exit now */
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_t2objs
|
||||
#define FT_COMPONENT trace_cffobjs
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -49,7 +49,7 @@
|
|||
/*************************************************************************/
|
||||
|
||||
static
|
||||
FT_String* T2_StrCopy( FT_Memory memory,
|
||||
FT_String* CFF_StrCopy( FT_Memory memory,
|
||||
const FT_String* source )
|
||||
{
|
||||
FT_Error error;
|
||||
|
@ -71,7 +71,7 @@
|
|||
/* this function is used to build a Unicode charmap from the glyph names */
|
||||
/* in a file */
|
||||
static
|
||||
FT_Error CFF_Build_Unicode_Charmap( T2_Face face,
|
||||
FT_Error CFF_Build_Unicode_Charmap( CFF_Face face,
|
||||
FT_ULong base_offset,
|
||||
PSNames_Interface* psnames )
|
||||
{
|
||||
|
@ -90,7 +90,7 @@
|
|||
if ( !charset_offset )
|
||||
{
|
||||
FT_ERROR(( "CFF_Build_Unicode_Charmap: charset table is missing\n" ));
|
||||
error = T2_Err_Invalid_File_Format;
|
||||
error = CFF_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
|||
goto Fail;
|
||||
|
||||
for ( ; gname < limit; gname++ )
|
||||
gname[0] = T2_Get_String( &font->string_index,
|
||||
gname[0] = CFF_Get_String( &font->string_index,
|
||||
GET_UShort(),
|
||||
psnames );
|
||||
FORGET_Frame();
|
||||
|
@ -155,7 +155,7 @@
|
|||
|
||||
for ( ; count > 0; count-- )
|
||||
{
|
||||
gname[0] = T2_Get_String( &font->string_index,
|
||||
gname[0] = CFF_Get_String( &font->string_index,
|
||||
first,
|
||||
psnames );
|
||||
gname++;
|
||||
|
@ -167,7 +167,7 @@
|
|||
|
||||
default: /* unknown charset format! */
|
||||
FT_ERROR(( "CFF_Build_Unicode_Charmap: unknown charset format!\n" ));
|
||||
error = T2_Err_Invalid_File_Format;
|
||||
error = CFF_Err_Invalid_File_Format;
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T2_Init_Face */
|
||||
/* CFF_Init_Face */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Initializes a given OpenType face object. */
|
||||
|
@ -260,8 +260,8 @@
|
|||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_LOCAL
|
||||
FT_Error T2_Init_Face( FT_Stream stream,
|
||||
T2_Face face,
|
||||
FT_Error CFF_Init_Face( FT_Stream stream,
|
||||
CFF_Face face,
|
||||
FT_Int face_index,
|
||||
FT_Int num_params,
|
||||
FT_Parameter* params )
|
||||
|
@ -297,7 +297,7 @@
|
|||
|
||||
/* if we are performing a simple font format check, exit immediately */
|
||||
if ( face_index < 0 )
|
||||
return T2_Err_Ok;
|
||||
return CFF_Err_Ok;
|
||||
|
||||
sfnt_format = 1;
|
||||
|
||||
|
@ -370,7 +370,7 @@
|
|||
/* we need the `PSNames' module for pure-CFF and CEF formats */
|
||||
if ( !psnames )
|
||||
{
|
||||
FT_ERROR(( "T2_Init_Face:" ));
|
||||
FT_ERROR(( "CFF_Init_Face:" ));
|
||||
FT_ERROR(( " cannot open CFF & CEF fonts\n" ));
|
||||
FT_ERROR(( " " ));
|
||||
FT_ERROR(( " without the `PSNames' module\n" ));
|
||||
|
@ -396,7 +396,7 @@
|
|||
/* retrieve font family & style name */
|
||||
root->family_name = CFF_Get_Name( &cff->name_index, face_index );
|
||||
if ( dict->cid_registry )
|
||||
root->style_name = T2_StrCopy( memory, "Regular" ); /* XXXX */
|
||||
root->style_name = CFF_StrCopy( memory, "Regular" ); /* XXXX */
|
||||
else
|
||||
root->style_name = CFF_Get_String( &cff->string_index,
|
||||
dict->weight,
|
||||
|
@ -496,7 +496,7 @@
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T2_Done_Face */
|
||||
/* CFF_Done_Face */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Finalizes a given face object. */
|
||||
|
@ -505,7 +505,7 @@
|
|||
/* face :: A pointer to the face object to destroy. */
|
||||
/* */
|
||||
FT_LOCAL
|
||||
void T2_Done_Face( T2_Face face )
|
||||
void CFF_Done_Face( CFF_Face face )
|
||||
{
|
||||
FT_Memory memory = face->root.memory;
|
||||
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
|
||||
|
@ -530,7 +530,7 @@
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T2_Init_Driver */
|
||||
/* CFF_Init_Driver */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Initializes a given OpenType driver object. */
|
||||
|
@ -542,7 +542,7 @@
|
|||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_LOCAL_DEF
|
||||
FT_Error T2_Init_Driver( T2_Driver driver )
|
||||
FT_Error CFF_Init_Driver( CFF_Driver driver )
|
||||
{
|
||||
/* init extension registry if needed */
|
||||
|
||||
|
@ -554,7 +554,7 @@
|
|||
|
||||
FT_UNUSED( driver );
|
||||
|
||||
return T2_Err_Ok;
|
||||
return CFF_Err_Ok;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -563,7 +563,7 @@
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* T2_Done_Driver */
|
||||
/* CFF_Done_Driver */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Finalizes a given OpenType driver. */
|
||||
|
@ -572,7 +572,7 @@
|
|||
/* driver :: A handle to the target OpenType driver. */
|
||||
/* */
|
||||
FT_LOCAL_DEF
|
||||
void T2_Done_Driver( T2_Driver driver )
|
||||
void CFF_Done_Driver( CFF_Driver driver )
|
||||
{
|
||||
/* destroy extensions registry if needed */
|
||||
|
||||
|
|
|
@ -33,36 +33,36 @@ FT_BEGIN_HEADER
|
|||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Type> */
|
||||
/* T2_Driver */
|
||||
/* CFF_Driver */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A handle to an OpenType driver object. */
|
||||
/* */
|
||||
typedef struct T2_DriverRec_* T2_Driver;
|
||||
typedef struct CFF_DriverRec_* CFF_Driver;
|
||||
|
||||
typedef TT_Face T2_Face;
|
||||
typedef TT_Face CFF_Face;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Type> */
|
||||
/* T2_Size */
|
||||
/* CFF_Size */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A handle to an OpenType size object. */
|
||||
/* */
|
||||
typedef FT_Size T2_Size;
|
||||
typedef FT_Size CFF_Size;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Type> */
|
||||
/* T2_GlyphSlot */
|
||||
/* CFF_GlyphSlot */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A handle to an OpenType glyph slot object. */
|
||||
/* */
|
||||
typedef struct T2_GlyphSlotRec_
|
||||
typedef struct CFF_GlyphSlotRec_
|
||||
{
|
||||
FT_GlyphSlotRec root;
|
||||
|
||||
|
@ -72,7 +72,7 @@ FT_BEGIN_HEADER
|
|||
FT_Fixed x_scale;
|
||||
FT_Fixed y_scale;
|
||||
|
||||
} T2_GlyphSlotRec, *T2_GlyphSlot;
|
||||
} CFF_GlyphSlotRec, *CFF_GlyphSlot;
|
||||
|
||||
|
||||
|
||||
|
@ -80,34 +80,34 @@ FT_BEGIN_HEADER
|
|||
/* */
|
||||
/* Subglyph transformation record. */
|
||||
/* */
|
||||
typedef struct T2_Transform_
|
||||
typedef struct CFF_Transform_
|
||||
{
|
||||
FT_Fixed xx, xy; /* transformation matrix coefficients */
|
||||
FT_Fixed yx, yy;
|
||||
FT_F26Dot6 ox, oy; /* offsets */
|
||||
|
||||
} T2_Transform;
|
||||
} CFF_Transform;
|
||||
|
||||
|
||||
/* this is only used in the case of a pure CFF font with no charmap */
|
||||
typedef struct T2_CharMapRec_
|
||||
typedef struct CFF_CharMapRec_
|
||||
{
|
||||
TT_CharMapRec root;
|
||||
PS_Unicodes unicodes;
|
||||
|
||||
} T2_CharMapRec, *T2_CharMap;
|
||||
} CFF_CharMapRec, *CFF_CharMap;
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* TrueType driver class. */
|
||||
/* */
|
||||
typedef struct T2_DriverRec_
|
||||
typedef struct CFF_DriverRec_
|
||||
{
|
||||
FT_DriverRec root;
|
||||
void* extension_component;
|
||||
|
||||
} T2_DriverRec;
|
||||
} CFF_DriverRec;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -115,14 +115,14 @@ FT_BEGIN_HEADER
|
|||
/* Face functions */
|
||||
/* */
|
||||
FT_LOCAL
|
||||
FT_Error T2_Init_Face( FT_Stream stream,
|
||||
T2_Face face,
|
||||
FT_Error CFF_Init_Face( FT_Stream stream,
|
||||
CFF_Face face,
|
||||
FT_Int face_index,
|
||||
FT_Int num_params,
|
||||
FT_Parameter* params );
|
||||
|
||||
FT_LOCAL
|
||||
void T2_Done_Face( T2_Face face );
|
||||
void CFF_Done_Face( CFF_Face face );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -130,10 +130,10 @@ FT_BEGIN_HEADER
|
|||
/* Driver functions */
|
||||
/* */
|
||||
FT_LOCAL
|
||||
FT_Error T2_Init_Driver( T2_Driver driver );
|
||||
FT_Error CFF_Init_Driver( CFF_Driver driver );
|
||||
|
||||
FT_LOCAL
|
||||
void T2_Done_Driver( T2_Driver driver );
|
||||
void CFF_Done_Driver( CFF_Driver driver );
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_t2parse
|
||||
#define FT_COMPONENT trace_cffparse
|
||||
|
||||
|
||||
#define T2_Err_Stack_Underflow FT_Err_Invalid_Argument
|
||||
#define T2_Err_Syntax_Error FT_Err_Invalid_Argument
|
||||
#define CFF_Err_Stack_Underflow FT_Err_Invalid_Argument
|
||||
#define CFF_Err_Syntax_Error FT_Err_Invalid_Argument
|
||||
|
||||
|
||||
enum
|
||||
|
@ -311,7 +311,7 @@
|
|||
FT_Fixed temp;
|
||||
|
||||
|
||||
error = T2_Err_Stack_Underflow;
|
||||
error = CFF_Err_Stack_Underflow;
|
||||
|
||||
if ( parser->top >= parser->stack + 6 )
|
||||
{
|
||||
|
@ -338,7 +338,7 @@
|
|||
offset->x >>= 16;
|
||||
offset->y >>= 16;
|
||||
|
||||
error = T2_Err_Ok;
|
||||
error = CFF_Err_Ok;
|
||||
}
|
||||
|
||||
return error;
|
||||
|
@ -354,7 +354,7 @@
|
|||
FT_Error error;
|
||||
|
||||
|
||||
error = T2_Err_Stack_Underflow;
|
||||
error = CFF_Err_Stack_Underflow;
|
||||
|
||||
if ( parser->top >= parser->stack + 4 )
|
||||
{
|
||||
|
@ -362,7 +362,7 @@
|
|||
bbox->yMin = cff_parse_num( data++ );
|
||||
bbox->xMax = cff_parse_num( data++ );
|
||||
bbox->yMax = cff_parse_num( data );
|
||||
error = T2_Err_Ok;
|
||||
error = CFF_Err_Ok;
|
||||
}
|
||||
|
||||
return error;
|
||||
|
@ -377,13 +377,13 @@
|
|||
FT_Error error;
|
||||
|
||||
|
||||
error = T2_Err_Stack_Underflow;
|
||||
error = CFF_Err_Stack_Underflow;
|
||||
|
||||
if ( parser->top >= parser->stack + 2 )
|
||||
{
|
||||
dict->private_size = cff_parse_num( data++ );
|
||||
dict->private_offset = cff_parse_num( data );
|
||||
error = T2_Err_Ok;
|
||||
error = CFF_Err_Ok;
|
||||
}
|
||||
|
||||
return error;
|
||||
|
@ -398,14 +398,14 @@
|
|||
FT_Error error;
|
||||
|
||||
|
||||
error = T2_Err_Stack_Underflow;
|
||||
error = CFF_Err_Stack_Underflow;
|
||||
|
||||
if ( parser->top >= parser->stack + 3 )
|
||||
{
|
||||
dict->cid_registry = (FT_UInt)cff_parse_num ( data++ );
|
||||
dict->cid_ordering = (FT_UInt)cff_parse_num ( data++ );
|
||||
dict->cid_supplement = (FT_ULong)cff_parse_num( data );
|
||||
error = T2_Err_Ok;
|
||||
error = CFF_Err_Ok;
|
||||
}
|
||||
|
||||
return error;
|
||||
|
@ -472,7 +472,7 @@
|
|||
FT_Byte* limit )
|
||||
{
|
||||
FT_Byte* p = start;
|
||||
FT_Error error = T2_Err_Ok;
|
||||
FT_Error error = CFF_Err_Ok;
|
||||
|
||||
|
||||
parser->top = parser->stack;
|
||||
|
@ -648,15 +648,15 @@
|
|||
return error;
|
||||
|
||||
Stack_Overflow:
|
||||
error = T2_Err_Invalid_Argument;
|
||||
error = CFF_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
|
||||
Stack_Underflow:
|
||||
error = T2_Err_Invalid_Argument;
|
||||
error = CFF_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
|
||||
Syntax_Error:
|
||||
error = T2_Err_Invalid_Argument;
|
||||
error = CFF_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue