A new formatting orgy.
Added some `#if 0' to completely disable the CID AFM stuff. In case this is not correct please fix.
This commit is contained in:
parent
9c05268eae
commit
9ca2af3838
@ -115,7 +115,7 @@ const FT_DriverInterface* ft_default_drivers[] =
|
||||
/* library :: A handle to a new library object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeTyoe error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
FT_EXPORT_FUNC( FT_Error ) FT_Init_FreeType( FT_Library* library )
|
||||
{
|
||||
|
@ -78,7 +78,7 @@
|
||||
/* formats. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Only horizontal layouts (left-to-right & right-to-left) are */
|
||||
@ -181,7 +181,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Set_Char_Sizes( T2_Size size,
|
||||
@ -239,7 +239,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Set_Pixel_Sizes( T2_Size size,
|
||||
@ -277,7 +277,7 @@
|
||||
/* whether to hint the outline, etc). */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Load_Glyph( T2_GlyphSlot slot,
|
||||
|
@ -550,7 +550,7 @@
|
||||
/* charstring_len :: The length in bytes of the charstring stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error T2_Parse_CharStrings( T2_Decoder* decoder,
|
||||
|
@ -68,7 +68,7 @@
|
||||
/* face :: The newly built face object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeTrue error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error T2_Init_Face( FT_Stream stream,
|
||||
@ -205,7 +205,7 @@
|
||||
/* size :: A handle to the size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error T2_Init_Size( T2_Size size )
|
||||
@ -247,7 +247,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error T2_Reset_Size( T2_Size size )
|
||||
@ -288,7 +288,7 @@
|
||||
/* slot :: The glyph record to build. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error T2_Init_GlyphSlot( T2_GlyphSlot slot )
|
||||
@ -342,7 +342,7 @@
|
||||
/* driver :: A handle to the target driver object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error T2_Init_Driver( T2_Driver driver )
|
||||
|
@ -36,9 +36,11 @@
|
||||
#define FT_COMPONENT trace_cidafm
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
LOCAL_FUNC
|
||||
void CID_Done_AFM( FT_Memory memory,
|
||||
T1_AFM* afm )
|
||||
void CID_Done_AFM( FT_Memory memory,
|
||||
T1_AFM* afm )
|
||||
{
|
||||
FREE( afm->kern_pairs );
|
||||
afm->num_pairs = 0;
|
||||
@ -178,7 +180,7 @@
|
||||
limit = (FT_Byte*)stream->limit;
|
||||
p = start;
|
||||
|
||||
/* we are now going to count the occurences of "KP" or "KPX" in */
|
||||
/* we are now going to count the occurences of `KP' or `KPX' in */
|
||||
/* the AFM file. */
|
||||
count = 0;
|
||||
for ( p = start; p < limit - 3; p++ )
|
||||
@ -279,5 +281,7 @@
|
||||
kerning->y = 0;
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <cidobjs.h>
|
||||
|
||||
|
||||
typedef struct T1_Kern_Pair_
|
||||
{
|
||||
FT_UInt glyph1;
|
||||
@ -39,21 +40,22 @@
|
||||
|
||||
#if 0
|
||||
|
||||
LOCAL_DEF
|
||||
FT_Error CID_Read_AFM( FT_Face face,
|
||||
FT_Stream stream );
|
||||
LOCAL_DEF
|
||||
FT_Error CID_Read_AFM( FT_Face t1_face,
|
||||
FT_Stream stream );
|
||||
|
||||
LOCAL_DEF
|
||||
void CID_Done_AFM( FT_Memory memory,
|
||||
T1_AFM* afm );
|
||||
LOCAL_DEF
|
||||
void CID_Done_AFM( FT_Memory memory,
|
||||
T1_AFM* afm );
|
||||
|
||||
LOCAL_DEF
|
||||
void CID_Get_Kerning( T1_AFM* afm,
|
||||
FT_UInt glyph1,
|
||||
FT_UInt glyph2,
|
||||
FT_Vector* kerning );
|
||||
LOCAL_DEF
|
||||
void CID_Get_Kerning( T1_AFM* afm,
|
||||
FT_UInt glyph1,
|
||||
FT_UInt glyph2,
|
||||
FT_Vector* kerning );
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* CIDAFM_H */
|
||||
|
||||
|
@ -473,7 +473,7 @@
|
||||
/* achar :: The accent character's StandardEncoding charcode. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type 1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error t1operator_seac( CID_Decoder* decoder,
|
||||
@ -626,7 +626,7 @@
|
||||
/* charstring_len :: The length in bytes of the charstring stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error CID_Parse_CharStrings( CID_Decoder* decoder,
|
||||
|
@ -72,7 +72,7 @@
|
||||
/* size :: A handle to the size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error CID_Init_Size( T1_Size size )
|
||||
@ -96,7 +96,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error CID_Reset_Size( T1_Size size )
|
||||
@ -201,7 +201,7 @@
|
||||
/* face :: The newly built face object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error CID_Init_Face( FT_Stream stream,
|
||||
@ -458,7 +458,7 @@
|
||||
/* slot :: The glyph record to build. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error CID_Init_GlyphSlot( T1_GlyphSlot glyph )
|
||||
@ -486,7 +486,7 @@
|
||||
/* driver :: A handle to the target driver object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error CID_Init_Driver( T1_Driver driver )
|
||||
|
@ -67,7 +67,7 @@
|
||||
/* reallocations. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error T1_New_Table( T1_Table* table,
|
||||
@ -157,7 +157,7 @@
|
||||
/* length :: The length in bytes of the source object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success. An error is returned if */
|
||||
/* FreeType error code. 0 means success. An error is returned if */
|
||||
/* reallocation fails. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
|
@ -75,7 +75,7 @@
|
||||
}
|
||||
|
||||
|
||||
#ifdef xxxT1_CONFIG_OPTION_NO_AFM
|
||||
#ifndef T1_CONFIG_OPTION_NO_AFM
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -116,21 +116,29 @@
|
||||
FT_UInt right_glyph,
|
||||
FT_Vector* kerning )
|
||||
{
|
||||
#if 0
|
||||
|
||||
T1_AFM* afm;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
kerning->x = 0;
|
||||
kerning->y = 0;
|
||||
|
||||
#if 0
|
||||
|
||||
afm = (T1_AFM*)face->afm_data;
|
||||
if ( afm )
|
||||
CID_Get_Kerning( afm, left_glyph, right_glyph, kerning );
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
#endif /* xxxT1_CONFIG_OPTION_NO_AFM */
|
||||
#endif /* !T1_CONFIG_OPTION_NO_AFM */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -157,7 +165,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Set_Char_Sizes( T1_Size size,
|
||||
@ -194,7 +202,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Set_Pixel_Sizes( T1_Size size,
|
||||
@ -329,7 +337,7 @@
|
||||
(FTDriver_initFace) CID_Init_Face,
|
||||
(FTDriver_doneFace) CID_Done_Face,
|
||||
|
||||
#ifndef xxxxT1_CONFIG_OPTION_NO_AFM
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
(FTDriver_getKerning) 0,
|
||||
#else
|
||||
(FTDriver_getKerning) Get_Kerning,
|
||||
|
@ -59,7 +59,7 @@
|
||||
/* table :: A pointer to a cmap object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* The function assumes that the stream is already in use (i.e., */
|
||||
@ -281,7 +281,7 @@
|
||||
/* cmap :: A handle to a cmap object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_CharMap_Free( TT_Face face,
|
||||
|
@ -96,7 +96,7 @@
|
||||
/* length :: The length of the table if found, undefined otherwise. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Goto_Table( TT_Face face,
|
||||
@ -141,7 +141,7 @@
|
||||
/* sfnt :: The SFNT header. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* The stream cursor must be at the font file's origin. */
|
||||
@ -275,7 +275,7 @@
|
||||
/* sfnt :: The SFNT directory header. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* The stream cursor must be at the font file's origin. */
|
||||
@ -373,7 +373,7 @@
|
||||
/* buffer :: The address of target buffer. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Any( TT_Face face,
|
||||
@ -436,7 +436,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Header( TT_Face face,
|
||||
@ -507,7 +507,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_MaxProfile( TT_Face face,
|
||||
@ -597,7 +597,7 @@
|
||||
/* vertical :: A boolean flag. If set, load vertical metrics. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error TT_Load_Metrics( TT_Face face,
|
||||
@ -733,7 +733,7 @@
|
||||
/* vertical :: A boolean flag. If set, load vertical metrics. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Metrics_Header( TT_Face face,
|
||||
@ -829,7 +829,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Names( TT_Face face,
|
||||
@ -1020,7 +1020,7 @@
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_CMap( TT_Face face,
|
||||
@ -1129,7 +1129,7 @@
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_OS2( TT_Face face,
|
||||
@ -1263,7 +1263,7 @@
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_PostScript( TT_Face face,
|
||||
@ -1318,7 +1318,7 @@
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_PCLT( TT_Face face,
|
||||
@ -1389,7 +1389,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Gasp( TT_Face face,
|
||||
@ -1461,7 +1461,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Kern( TT_Face face,
|
||||
@ -1566,7 +1566,7 @@
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Hdmx( TT_Face face,
|
||||
|
@ -427,7 +427,7 @@
|
||||
/* You must not modify the returned string! */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Get_PS_Name( TT_Face face,
|
||||
|
@ -211,7 +211,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Load_SBit_Const_Metrics( TT_SBit_Range* range,
|
||||
@ -243,7 +243,7 @@
|
||||
/* load_offsets :: A flag whether to load the glyph offset table. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Load_SBit_Range_Codes( TT_SBit_Range* range,
|
||||
@ -306,7 +306,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Load_SBit_Range( TT_SBit_Range* range,
|
||||
@ -381,7 +381,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_SBit_Strikes( TT_Face face,
|
||||
@ -631,7 +631,7 @@
|
||||
/* aglyph_offset :: The offset of the glyph data in `EBDT' table. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means the glyph index was found. */
|
||||
/* FreeType error code. 0 means the glyph index was found. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Find_SBit_Range( FT_UInt glyph_index,
|
||||
@ -735,7 +735,7 @@
|
||||
/* aglyph_offset :: The offset of the glyph data in `EBDT' table. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. Returns */
|
||||
/* FreeType error code. 0 means success. Returns */
|
||||
/* TT_Err_Invalid_Argument if no sbit exists for the requested glyph. */
|
||||
/* */
|
||||
static
|
||||
@ -800,7 +800,7 @@
|
||||
/* big_metrics :: A big SBit metrics structure for the glyph. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* The stream cursor must be positioned at the glyph's offset within */
|
||||
@ -1349,7 +1349,7 @@
|
||||
/* metrics :: A big sbit metrics structure for the glyph image. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. Returns an error if no */
|
||||
/* FreeType error code. 0 means success. Returns an error if no */
|
||||
/* glyph sbit exists for the index. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
|
@ -75,7 +75,7 @@
|
||||
/* formats. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Only horizontal layouts (left-to-right & right-to-left) are */
|
||||
@ -178,7 +178,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Set_Char_Sizes( TT_Size size,
|
||||
@ -238,7 +238,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Set_Pixel_Sizes( TT_Size size,
|
||||
@ -280,7 +280,7 @@
|
||||
/* whether to hint the outline, etc). */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Load_Glyph( TT_GlyphSlot slot,
|
||||
|
@ -1293,7 +1293,7 @@
|
||||
/* whether to hint the outline, etc). */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Glyph( TT_Size size,
|
||||
|
@ -257,7 +257,7 @@
|
||||
/* exec :: The target execution context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Goto_CodeRange( TT_ExecContext exec,
|
||||
@ -307,7 +307,7 @@
|
||||
/* exec :: The target execution context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Set_CodeRange( TT_ExecContext exec,
|
||||
@ -339,7 +339,7 @@
|
||||
/* exec :: The target execution context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Does not set the Error variable. */
|
||||
@ -378,7 +378,7 @@
|
||||
/* memory :: A handle to the parent memory object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Only the glyph loader and debugger should call this function. */
|
||||
@ -433,7 +433,7 @@
|
||||
/* exec :: A handle to the target execution context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Init_Context( TT_ExecContext exec,
|
||||
@ -504,7 +504,7 @@
|
||||
/* buff :: The address of the buffer base pointer. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Update_Max( FT_Memory memory,
|
||||
@ -546,7 +546,7 @@
|
||||
/* exec :: A handle to the target execution context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Only the glyph loader and debugger should call this function. */
|
||||
@ -649,7 +649,7 @@
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Only the glyph loader and debugger should call this function. */
|
||||
@ -696,7 +696,7 @@
|
||||
/* exec :: A handle to the target execution context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueTyoe error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Only the glyph loader and debugger should call this function. */
|
||||
@ -834,7 +834,7 @@
|
||||
/* exec :: A handle to the target execution context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Only the glyph loader and debugger should call this function. */
|
||||
@ -6781,7 +6781,7 @@
|
||||
/* exec :: A handle to the target execution context. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* Only the object manager and debugger should call this function. */
|
||||
|
@ -201,7 +201,7 @@
|
||||
/* face :: The newly built face object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error TT_Init_Face( FT_Stream stream,
|
||||
@ -320,7 +320,7 @@
|
||||
/* size :: A handle to the size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error TT_Init_Size( TT_Size size )
|
||||
@ -709,7 +709,7 @@
|
||||
/* slot :: The glyph record to build. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Init_GlyphSlot( TT_GlyphSlot slot )
|
||||
@ -767,7 +767,7 @@
|
||||
/* driver :: A handle to the target driver object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Init_Driver( TT_Driver driver )
|
||||
|
@ -50,7 +50,7 @@
|
||||
/* stream :: The input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Locations( TT_Face face,
|
||||
@ -143,7 +143,7 @@
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_CVT( TT_Face face,
|
||||
@ -210,7 +210,7 @@
|
||||
/* stream :: A handle to the input stream. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
FT_Error TT_Load_Programs( TT_Face face,
|
||||
|
@ -1,51 +1,86 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* t1afm.c - support for reading Type 1 AFM files
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* t1afm.c */
|
||||
/* */
|
||||
/* AFM support for Type 1 fonts (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <t1afm.h>
|
||||
#include <freetype/internal/ftstream.h>
|
||||
#include <freetype/internal/t1types.h>
|
||||
#include <stdlib.h> /* for qsort */
|
||||
#include <t1afm.h>
|
||||
|
||||
#include <stdlib.h> /* for qsort() */
|
||||
#include <string.h> /* for strcmp() */
|
||||
#include <ctype.h> /* for isalnum() */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_t1afm
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
void T1_Done_AFM( FT_Memory memory, T1_AFM* afm )
|
||||
void T1_Done_AFM( FT_Memory memory,
|
||||
T1_AFM* afm )
|
||||
{
|
||||
FREE( afm->kern_pairs );
|
||||
afm->num_pairs = 0;
|
||||
}
|
||||
|
||||
|
||||
#undef IS_KERN_PAIR
|
||||
#define IS_KERN_PAIR(p) ( p[0] == 'K' && p[1] == 'P' )
|
||||
#define IS_KERN_PAIR( p ) ( p[0] == 'K' && p[1] == 'P' )
|
||||
|
||||
#define IS_ALPHANUM(c) ( (c >= 'A' && c <= 'Z') || \
|
||||
(c >= 'a' && c <= 'z') || \
|
||||
(c >= '0' && c <= '9') || \
|
||||
(c == '_' && c == '.') )
|
||||
#define IS_ALPHANUM( c ) ( isalnum( c ) || \
|
||||
c == '_' || \
|
||||
c == '.' )
|
||||
|
||||
/* read a glyph name and return the equivalent glyph index */
|
||||
|
||||
/* read a glyph name and return the equivalent glyph index */
|
||||
static
|
||||
FT_UInt afm_atoindex( FT_Byte* *start, FT_Byte* limit, T1_Font* type1 )
|
||||
FT_UInt afm_atoindex( FT_Byte** start,
|
||||
FT_Byte* limit,
|
||||
T1_Font* type1 )
|
||||
{
|
||||
FT_Byte* p = *start;
|
||||
FT_Int len;
|
||||
FT_UInt result = 0;
|
||||
char temp[64];
|
||||
FT_Byte* p = *start;
|
||||
FT_Int len;
|
||||
FT_UInt result = 0;
|
||||
char temp[64];
|
||||
|
||||
|
||||
/* skip whitespace */
|
||||
while ( (*p == ' ' || *p == '\t' || *p == ':' || *p == ';') && p < limit )
|
||||
while ( ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' ) &&
|
||||
p < limit )
|
||||
p++;
|
||||
*start = p;
|
||||
|
||||
/* now, read glyph name */
|
||||
while ( IS_ALPHANUM(*p) && p < limit ) p++;
|
||||
while ( IS_ALPHANUM( *p ) && p < limit )
|
||||
p++;
|
||||
|
||||
len = p - *start;
|
||||
if (len > 0 && len < 64)
|
||||
|
||||
if ( len > 0 && len < 64 )
|
||||
{
|
||||
FT_Int n;
|
||||
|
||||
|
||||
/* copy glyph name to intermediate array */
|
||||
MEM_Copy( temp, *start, len );
|
||||
temp[len] = 0;
|
||||
@ -55,7 +90,8 @@
|
||||
{
|
||||
char* gname = (char*)type1->glyph_names[n];
|
||||
|
||||
if ( gname && gname[0] == temp[0] && strcmp(gname,temp) == 0 )
|
||||
|
||||
if ( gname && gname[0] == temp[0] && strcmp( gname, temp ) == 0 )
|
||||
{
|
||||
result = n;
|
||||
break;
|
||||
@ -67,16 +103,18 @@
|
||||
}
|
||||
|
||||
|
||||
/* read an integer */
|
||||
/* read an integer */
|
||||
static
|
||||
int afm_atoi( FT_Byte** start, FT_Byte* limit )
|
||||
int afm_atoi( FT_Byte** start,
|
||||
FT_Byte* limit )
|
||||
{
|
||||
FT_Byte* p = *start;
|
||||
int sum = 0;
|
||||
int sign = 1;
|
||||
|
||||
|
||||
/* skip everything that is not a number */
|
||||
while ( p < limit && (*p < '0' || *p > '9') )
|
||||
while ( p < limit && !isdigit( *p ) )
|
||||
{
|
||||
sign = 1;
|
||||
if (*p == '-')
|
||||
@ -85,38 +123,41 @@
|
||||
p++;
|
||||
}
|
||||
|
||||
while ( p < limit && (*p >= '0' && *p < '9') )
|
||||
while ( p < limit && isdigit( *p ) )
|
||||
{
|
||||
sum = sum*10 + (*p - '0');
|
||||
sum = sum * 10 + ( *p - '0' );
|
||||
p++;
|
||||
}
|
||||
*start = p;
|
||||
return sum*sign;
|
||||
|
||||
return sum * sign;
|
||||
}
|
||||
|
||||
|
||||
#undef KERN_INDEX
|
||||
#define KERN_INDEX(g1,g2) (((FT_ULong)g1 << 16) | g2)
|
||||
#define KERN_INDEX( g1, g2 ) ( ( (FT_ULong)g1 << 16 ) | g2 )
|
||||
|
||||
/* compare two kerning pairs */
|
||||
|
||||
/* compare two kerning pairs */
|
||||
static
|
||||
int compare_kern_pairs( const void* a, const void* b )
|
||||
int compare_kern_pairs( const void* a,
|
||||
const void* b )
|
||||
{
|
||||
T1_Kern_Pair* pair1 = (T1_Kern_Pair*)a;
|
||||
T1_Kern_Pair* pair2 = (T1_Kern_Pair*)b;
|
||||
|
||||
FT_ULong index1 = KERN_INDEX(pair1->glyph1,pair1->glyph2);
|
||||
FT_ULong index2 = KERN_INDEX(pair2->glyph1,pair2->glyph2);
|
||||
FT_ULong index1 = KERN_INDEX( pair1->glyph1, pair1->glyph2 );
|
||||
FT_ULong index2 = KERN_INDEX( pair2->glyph1, pair2->glyph2 );
|
||||
|
||||
return ( index1 < index2 ? -1 :
|
||||
( index1 > index2 ? 1 : 0 ));
|
||||
|
||||
return ( index1 - index2 );
|
||||
}
|
||||
|
||||
|
||||
/* parse an AFM file - for now, only read the kerning pairs */
|
||||
/* parse an AFM file - for now, only read the kerning pairs */
|
||||
LOCAL_FUNC
|
||||
FT_Error T1_Read_AFM( FT_Face t1_face,
|
||||
FT_Stream stream )
|
||||
FT_Error T1_Read_AFM( FT_Face t1_face,
|
||||
FT_Stream stream )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Memory memory = stream->memory;
|
||||
@ -128,28 +169,29 @@
|
||||
T1_Font* type1 = &((T1_Face)t1_face)->type1;
|
||||
T1_AFM* afm = 0;
|
||||
|
||||
if ( ACCESS_Frame(stream->size) )
|
||||
|
||||
if ( ACCESS_Frame( stream->size ) )
|
||||
return error;
|
||||
|
||||
start = (FT_Byte*)stream->cursor;
|
||||
limit = (FT_Byte*)stream->limit;
|
||||
p = start;
|
||||
|
||||
/* we are now going to count the occurences of "KP" or "KPX" in */
|
||||
/* the AFM file.. */
|
||||
/* we are now going to count the occurences of `KP' or `KPX' in */
|
||||
/* the AFM file. */
|
||||
count = 0;
|
||||
for ( p = start; p < limit-3; p++ )
|
||||
for ( p = start; p < limit - 3; p++ )
|
||||
{
|
||||
if ( IS_KERN_PAIR(p) )
|
||||
if ( IS_KERN_PAIR( p ) )
|
||||
count++;
|
||||
}
|
||||
|
||||
/* Actually, kerning pairs are simply optional !! */
|
||||
if (count == 0)
|
||||
/* Actually, kerning pairs are simply optional! */
|
||||
if ( count == 0 )
|
||||
goto Exit;
|
||||
|
||||
/* allocate the pairs */
|
||||
if ( ALLOC( afm, sizeof(*afm ) ) ||
|
||||
if ( ALLOC( afm, sizeof ( *afm ) ) ||
|
||||
ALLOC_ARRAY( afm->kern_pairs, count, T1_Kern_Pair ) )
|
||||
goto Exit;
|
||||
|
||||
@ -160,15 +202,17 @@
|
||||
/* save in face object */
|
||||
((T1_Face)t1_face)->afm_data = afm;
|
||||
|
||||
for ( p = start; p < limit-3; p++ )
|
||||
for ( p = start; p < limit - 3; p++ )
|
||||
{
|
||||
if ( IS_KERN_PAIR(p) )
|
||||
if ( IS_KERN_PAIR( p ) )
|
||||
{
|
||||
FT_Byte* q;
|
||||
|
||||
|
||||
/* skip keyword (KP or KPX) */
|
||||
q = p+2;
|
||||
if (*q == 'X') q++;
|
||||
q = p + 2;
|
||||
if ( *q == 'X' )
|
||||
q++;
|
||||
|
||||
pair->glyph1 = afm_atoindex( &q, limit, type1 );
|
||||
pair->glyph2 = afm_atoindex( &q, limit, type1 );
|
||||
@ -183,18 +227,20 @@
|
||||
}
|
||||
|
||||
/* now, sort the kern pairs according to their glyph indices */
|
||||
qsort( afm->kern_pairs, count, sizeof(T1_Kern_Pair), compare_kern_pairs );
|
||||
qsort( afm->kern_pairs, count, sizeof ( T1_Kern_Pair ),
|
||||
compare_kern_pairs );
|
||||
|
||||
Exit:
|
||||
if (error)
|
||||
if ( error )
|
||||
FREE( afm );
|
||||
|
||||
FORGET_Frame();
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* find the kerning for a given glyph pair */
|
||||
/* find the kerning for a given glyph pair */
|
||||
LOCAL_FUNC
|
||||
void T1_Get_Kerning( T1_AFM* afm,
|
||||
FT_UInt glyph1,
|
||||
@ -202,28 +248,35 @@
|
||||
FT_Vector* kerning )
|
||||
{
|
||||
T1_Kern_Pair *min, *mid, *max;
|
||||
FT_ULong index = KERN_INDEX(glyph1,glyph2);
|
||||
FT_ULong index = KERN_INDEX( glyph1, glyph2 );
|
||||
|
||||
|
||||
/* simple binary search */
|
||||
min = afm->kern_pairs;
|
||||
max = min + afm->num_pairs-1;
|
||||
max = min + afm->num_pairs - 1;
|
||||
|
||||
while (min <= max)
|
||||
while ( min <= max )
|
||||
{
|
||||
FT_ULong midi;
|
||||
|
||||
mid = min + (max-min)/2;
|
||||
midi = KERN_INDEX(mid->glyph1,mid->glyph2);
|
||||
|
||||
mid = min + ( max - min ) / 2;
|
||||
midi = KERN_INDEX( mid->glyph1, mid->glyph2 );
|
||||
if ( midi == index )
|
||||
{
|
||||
*kerning = mid->kerning;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( midi < index ) min = mid+1;
|
||||
else max = mid-1;
|
||||
if ( midi < index )
|
||||
min = mid + 1;
|
||||
else
|
||||
max = mid - 1;
|
||||
}
|
||||
|
||||
kerning->x = 0;
|
||||
kerning->y = 0;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1,47 +1,59 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* t1afm.h - support for reading Type 1 AFM files
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* t1afm.h */
|
||||
/* */
|
||||
/* AFM support for Type 1 fonts (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef T1AFM_H
|
||||
#define T1AFM_H
|
||||
|
||||
#include <freetype/internal/ftobjs.h>
|
||||
|
||||
/* In this version, we only read the kerning table from the */
|
||||
/* AFM file. We may add support for ligatures a bit later.. */
|
||||
|
||||
typedef struct T1_Kern_Pair_
|
||||
{
|
||||
FT_UInt glyph1;
|
||||
FT_UInt glyph2;
|
||||
FT_Vector kerning;
|
||||
typedef struct T1_Kern_Pair_
|
||||
{
|
||||
FT_UInt glyph1;
|
||||
FT_UInt glyph2;
|
||||
FT_Vector kerning;
|
||||
|
||||
} T1_Kern_Pair;
|
||||
} T1_Kern_Pair;
|
||||
|
||||
typedef struct T1_AFM_
|
||||
{
|
||||
FT_Int num_pairs;
|
||||
T1_Kern_Pair* kern_pairs;
|
||||
|
||||
} T1_AFM;
|
||||
|
||||
|
||||
typedef struct T1_AFM_
|
||||
{
|
||||
FT_Int num_pairs;
|
||||
T1_Kern_Pair* kern_pairs;
|
||||
LOCAL_DEF
|
||||
FT_Error T1_Read_AFM( FT_Face face,
|
||||
FT_Stream stream );
|
||||
|
||||
} T1_AFM;
|
||||
LOCAL_DEF
|
||||
void T1_Done_AFM( FT_Memory memory,
|
||||
T1_AFM* afm );
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Get_Kerning( T1_AFM* afm,
|
||||
FT_UInt glyph1,
|
||||
FT_UInt glyph2,
|
||||
FT_Vector* kerning );
|
||||
|
||||
LOCAL_DEF
|
||||
FT_Error T1_Read_AFM( FT_Face face,
|
||||
FT_Stream stream );
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Done_AFM( FT_Memory memory,
|
||||
T1_AFM* afm );
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Get_Kerning( T1_AFM* afm,
|
||||
FT_UInt glyph1,
|
||||
FT_UInt glyph2,
|
||||
FT_Vector* kerning );
|
||||
|
||||
#endif /* T1AFM_H */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1,19 +1,20 @@
|
||||
/*******************************************************************
|
||||
*
|
||||
* t1driver.c
|
||||
*
|
||||
* High-level Type1 driver interface for FreeType 2.0
|
||||
*
|
||||
* Copyright 1996-1998 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
*
|
||||
* This file is part of the FreeType project, and may only be used,
|
||||
* modified, and distributed under the terms of the FreeType project
|
||||
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
* this file you indicate that you have read the license and
|
||||
* understand and accept it fully.
|
||||
*
|
||||
******************************************************************/
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* t1driver.c */
|
||||
/* */
|
||||
/* Type 1 driver interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <t1driver.h>
|
||||
#include <t1gload.h>
|
||||
@ -23,10 +24,20 @@
|
||||
#include <freetype/internal/ftstream.h>
|
||||
#include <freetype/internal/psnames.h>
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
||||
/* messages during execution. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_t1driver
|
||||
|
||||
|
||||
#ifndef T1_CONFIG_OPTION_NO_AFM
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -58,7 +69,7 @@
|
||||
FTDriver_Interface Get_Interface( FT_Driver driver,
|
||||
const FT_String* interface )
|
||||
{
|
||||
UNUSED(driver);
|
||||
UNUSED( driver );
|
||||
|
||||
if ( strcmp( (const char*)interface, "attach_file" ) == 0 )
|
||||
return (FTDriver_Interface)T1_Read_AFM;
|
||||
@ -108,87 +119,97 @@
|
||||
{
|
||||
T1_AFM* afm;
|
||||
|
||||
|
||||
kerning->x = 0;
|
||||
kerning->y = 0;
|
||||
|
||||
afm = (T1_AFM*)face->afm_data;
|
||||
if (afm)
|
||||
if ( afm )
|
||||
T1_Get_Kerning( afm, left_glyph, right_glyph, kerning );
|
||||
|
||||
return T1_Err_Ok;
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************/
|
||||
/* */
|
||||
/* <Function> Set_Char_Sizes */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A driver method used to reset a size's character sizes */
|
||||
/* (horizontal and vertical) expressed in fractional points. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* size :: handle to target size object */
|
||||
/* char_width :: character width expressed in 26.6 points */
|
||||
/* char_height :: character height expressed in 26.6 points */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success */
|
||||
/* */
|
||||
|
||||
#endif /* !T1_CONFIG_OPTION_NO_AFM */
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* Set_Char_Sizes */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A driver method used to reset a size's character sizes (horizontal */
|
||||
/* and vertical) expressed in fractional points. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* char_width :: The character width expressed in 26.6 */
|
||||
/* fractional points. */
|
||||
/* */
|
||||
/* char_height :: The character height expressed in 26.6 */
|
||||
/* fractional points. */
|
||||
/* */
|
||||
/* horz_resolution :: The horizontal resolution of the output device. */
|
||||
/* */
|
||||
/* vert_resolution :: The vertical resolution of the output device. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Set_Char_Sizes( T1_Size size,
|
||||
FT_F26Dot6 char_width,
|
||||
FT_F26Dot6 char_height,
|
||||
FT_UInt horz_resolution,
|
||||
FT_UInt vert_resolution )
|
||||
FT_Error Set_Char_Sizes( T1_Size size,
|
||||
FT_F26Dot6 char_width,
|
||||
FT_F26Dot6 char_height,
|
||||
FT_UInt horz_resolution,
|
||||
FT_UInt vert_resolution )
|
||||
{
|
||||
UNUSED(char_width);
|
||||
UNUSED(char_height);
|
||||
UNUSED(horz_resolution);
|
||||
UNUSED(vert_resolution);
|
||||
UNUSED( char_width );
|
||||
UNUSED( char_height );
|
||||
UNUSED( horz_resolution );
|
||||
UNUSED( vert_resolution );
|
||||
|
||||
size->valid = FALSE;
|
||||
return T1_Reset_Size( size );
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* */
|
||||
/* <Function> Set_Pixel_Sizes */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A driver method used to reset a size's character sizes */
|
||||
/* (horizontal and vertical) expressed in integer pixels. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* size :: handle to target size object */
|
||||
/* */
|
||||
/* pixel_width :: character width expressed in 26.6 points */
|
||||
/* */
|
||||
/* pixel_height :: character height expressed in 26.6 points */
|
||||
/* */
|
||||
/* char_size :: the corresponding character size in points */
|
||||
/* This value is only sent to the TrueType */
|
||||
/* bytecode interpreter, even though 99% of */
|
||||
/* glyph programs will simply ignore it. A */
|
||||
/* safe value there is the maximum of the */
|
||||
/* pixel width and height (multiplied by */
|
||||
/* 64 to make it a 26.6 fixed float !) */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* Set_Pixel_Sizes */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A driver method used to reset a size's character sizes (horizontal */
|
||||
/* and vertical) expressed in integer pixels. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* pixel_width :: The character width expressed in integer pixels. */
|
||||
/* */
|
||||
/* pixel_height :: The character height expressed in integer pixels. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* size :: A handle to the target size object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
/* */
|
||||
static
|
||||
FT_Error Set_Pixel_Sizes( T1_Size size,
|
||||
FT_Int pixel_width,
|
||||
FT_Int pixel_height )
|
||||
FT_Error Set_Pixel_Sizes( T1_Size size,
|
||||
FT_Int pixel_width,
|
||||
FT_Int pixel_height )
|
||||
{
|
||||
UNUSED(pixel_width);
|
||||
UNUSED(pixel_height);
|
||||
UNUSED( pixel_width );
|
||||
UNUSED( pixel_height );
|
||||
|
||||
size->valid = FALSE;
|
||||
return T1_Reset_Size(size);
|
||||
return T1_Reset_Size( size );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -212,154 +233,82 @@
|
||||
FT_UInt result = 0;
|
||||
PSNames_Interface* psnames;
|
||||
|
||||
|
||||
face = (T1_Face)charmap->face;
|
||||
psnames = (PSNames_Interface*)face->psnames;
|
||||
if (psnames)
|
||||
switch (charmap->encoding)
|
||||
if ( psnames )
|
||||
switch ( charmap->encoding )
|
||||
{
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Unicode encoding support */
|
||||
/* */
|
||||
case ft_encoding_unicode:
|
||||
{
|
||||
/* use the "psnames" module to synthetize the Unicode charmap */
|
||||
result = psnames->lookup_unicode( &face->unicode_map,
|
||||
(FT_ULong)charcode );
|
||||
/*******************************************************************/
|
||||
/* */
|
||||
/* Unicode encoding support */
|
||||
/* */
|
||||
case ft_encoding_unicode:
|
||||
/* use the `PSNames' module to synthetize the Unicode charmap */
|
||||
result = psnames->lookup_unicode( &face->unicode_map,
|
||||
(FT_ULong)charcode );
|
||||
|
||||
/* the function returns 0xFFFF when the Unicode charcode has */
|
||||
/* no corresponding glyph.. */
|
||||
if (result == 0xFFFF)
|
||||
result = 0;
|
||||
goto Exit;
|
||||
}
|
||||
/* the function returns 0xFFFF if the Unicode charcode has */
|
||||
/* no corresponding glyph. */
|
||||
if ( result == 0xFFFF )
|
||||
result = 0;
|
||||
goto Exit;
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Custom Type 1 encoding */
|
||||
/* */
|
||||
case ft_encoding_adobe_custom:
|
||||
/*******************************************************************/
|
||||
/* */
|
||||
/* Custom Type 1 encoding */
|
||||
/* */
|
||||
case ft_encoding_adobe_custom:
|
||||
{
|
||||
T1_Encoding* encoding = &face->type1.encoding;
|
||||
|
||||
|
||||
if ( charcode >= encoding->code_first &&
|
||||
charcode <= encoding->code_last )
|
||||
result = encoding->char_index[charcode];
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/*******************************************************************/
|
||||
/* */
|
||||
/* Adobe Standard & Expert encoding support */
|
||||
/* */
|
||||
default:
|
||||
if ( charcode < 256 )
|
||||
{
|
||||
FT_UInt code;
|
||||
FT_Int n;
|
||||
const char* glyph_name;
|
||||
|
||||
|
||||
code = psnames->adobe_std_encoding[charcode];
|
||||
if ( charmap->encoding == ft_encoding_adobe_expert )
|
||||
code = psnames->adobe_expert_encoding[charcode];
|
||||
|
||||
glyph_name = psnames->adobe_std_strings( code );
|
||||
if ( !glyph_name )
|
||||
break;
|
||||
|
||||
for ( n = 0; n < face->type1.num_glyphs; n++ )
|
||||
{
|
||||
T1_Encoding* encoding = &face->type1.encoding;
|
||||
if (charcode >= encoding->code_first &&
|
||||
charcode <= encoding->code_last)
|
||||
const char* gname = face->type1.glyph_names[n];
|
||||
|
||||
|
||||
if ( gname && gname[0] == glyph_name[0] &&
|
||||
strcmp( gname, glyph_name ) == 0 )
|
||||
{
|
||||
result = encoding->char_index[charcode];
|
||||
result = n;
|
||||
break;
|
||||
}
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/********************************************************************/
|
||||
/* */
|
||||
/* Adobe Standard & Expert encoding support */
|
||||
/* */
|
||||
default:
|
||||
if (charcode < 256)
|
||||
{
|
||||
FT_UInt code;
|
||||
FT_Int n;
|
||||
const char* glyph_name;
|
||||
|
||||
code = psnames->adobe_std_encoding[charcode];
|
||||
if (charmap->encoding == ft_encoding_adobe_expert)
|
||||
code = psnames->adobe_expert_encoding[charcode];
|
||||
|
||||
glyph_name = psnames->adobe_std_strings(code);
|
||||
if (!glyph_name) break;
|
||||
|
||||
for ( n = 0; n < face->type1.num_glyphs; n++ )
|
||||
{
|
||||
const char* gname = face->type1.glyph_names[n];
|
||||
|
||||
if ( gname && gname[0] == glyph_name[0] &&
|
||||
strcmp( gname, glyph_name ) == 0 )
|
||||
{
|
||||
result = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* */
|
||||
/* <Struct> FT_DriverInterface */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure used to hold a font driver's basic interface */
|
||||
/* used by the high-level parts of FreeType (or other apps) */
|
||||
/* */
|
||||
/* Most scalable drivers provide a specialized interface to */
|
||||
/* access format-specific features. It can be retrieved with */
|
||||
/* a call to the "get_format_interface", and should be defined */
|
||||
/* in each font driver header (e.g. ttdriver.h, t1driver.h,..) */
|
||||
/* */
|
||||
/* All fields are function pointers .. */
|
||||
/* */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* */
|
||||
/* new_engine :: */
|
||||
/* used to create and initialise a new driver object */
|
||||
/* */
|
||||
/* done_engine :: */
|
||||
/* used to finalise and destroy a given driver object */
|
||||
/* */
|
||||
/* get_format_interface :: */
|
||||
/* return a typeless pointer to the format-specific */
|
||||
/* driver interface. */
|
||||
/* */
|
||||
/* new_face :: */
|
||||
/* create a new face object from a resource */
|
||||
/* */
|
||||
/* done_face :: */
|
||||
/* discards a face object, as well as all child objects */
|
||||
/* ( sizes, charmaps, glyph slots ) */
|
||||
/* */
|
||||
/* get_face_properties :: */
|
||||
/* return generic face properties */
|
||||
/* */
|
||||
/* get_kerning :: */
|
||||
/* return the kerning vector corresponding to a pair */
|
||||
/* of glyphs, expressed in unscaled font units. */
|
||||
/* */
|
||||
/* new_size :: */
|
||||
/* create and initialise a new scalable size object. */
|
||||
/* */
|
||||
/* new_fixed_size :: */
|
||||
/* create and initialise a new fixed-size object. */
|
||||
/* */
|
||||
/* done_size :: */
|
||||
/* finalize a given face size object. */
|
||||
/* */
|
||||
/* set_size_resolutions :: */
|
||||
/* reset a scalable size object's output resolutions */
|
||||
/* */
|
||||
/* set_size_char_sizes :: */
|
||||
/* reset a scalable size object's character size */
|
||||
/* */
|
||||
/* set_pixel_sizes :: */
|
||||
/* reset a face size object's pixel dimensions. Applies */
|
||||
/* to both scalable and fixed faces. */
|
||||
/* */
|
||||
/* new_glyph_slot :: */
|
||||
/* create and initialise a new glyph slot */
|
||||
/* */
|
||||
/* done_glyph_slot :: */
|
||||
/* discard a given glyph slot */
|
||||
/* */
|
||||
/* load_glyph :: */
|
||||
/* load a given glyph into a given slot */
|
||||
/* */
|
||||
/* get_glyph_metrics :: */
|
||||
/* return a loaded glyph's metrics. */
|
||||
/* */
|
||||
|
||||
const FT_DriverInterface t1_driver_interface =
|
||||
{
|
||||
sizeof( FT_DriverRec ),
|
||||
@ -373,64 +322,66 @@
|
||||
|
||||
0, /* format interface */
|
||||
|
||||
(FTDriver_initDriver) T1_Init_Driver,
|
||||
(FTDriver_doneDriver) T1_Done_Driver,
|
||||
(FTDriver_initDriver) T1_Init_Driver,
|
||||
(FTDriver_doneDriver) T1_Done_Driver,
|
||||
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
(FTDriver_getInterface) 0,
|
||||
(FTDriver_getInterface) 0,
|
||||
#else
|
||||
(FTDriver_getInterface) Get_Interface,
|
||||
(FTDriver_getInterface) Get_Interface,
|
||||
#endif
|
||||
|
||||
(FTDriver_initFace) T1_Init_Face,
|
||||
(FTDriver_doneFace) T1_Done_Face,
|
||||
(FTDriver_initFace) T1_Init_Face,
|
||||
(FTDriver_doneFace) T1_Done_Face,
|
||||
|
||||
#ifdef T1_CONFIG_OPTION_NO_AFM
|
||||
(FTDriver_getKerning) 0,
|
||||
(FTDriver_getKerning) 0,
|
||||
#else
|
||||
(FTDriver_getKerning) Get_Kerning,
|
||||
(FTDriver_getKerning) Get_Kerning,
|
||||
#endif
|
||||
|
||||
(FTDriver_initSize) T1_Init_Size,
|
||||
(FTDriver_doneSize) T1_Done_Size,
|
||||
(FTDriver_setCharSizes) Set_Char_Sizes,
|
||||
(FTDriver_setPixelSizes) Set_Pixel_Sizes,
|
||||
(FTDriver_initSize) T1_Init_Size,
|
||||
(FTDriver_doneSize) T1_Done_Size,
|
||||
(FTDriver_setCharSizes) Set_Char_Sizes,
|
||||
(FTDriver_setPixelSizes)Set_Pixel_Sizes,
|
||||
|
||||
(FTDriver_initGlyphSlot) T1_Init_GlyphSlot,
|
||||
(FTDriver_doneGlyphSlot) T1_Done_GlyphSlot,
|
||||
(FTDriver_loadGlyph) T1_Load_Glyph,
|
||||
(FTDriver_initGlyphSlot)T1_Init_GlyphSlot,
|
||||
(FTDriver_doneGlyphSlot)T1_Done_GlyphSlot,
|
||||
(FTDriver_loadGlyph) T1_Load_Glyph,
|
||||
|
||||
(FTDriver_getCharIndex) Get_Char_Index,
|
||||
(FTDriver_getCharIndex) Get_Char_Index,
|
||||
};
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* */
|
||||
/* <Function> Get_FreeType_Driver_Interface */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This function is used when compiling the TrueType driver */
|
||||
/* as a shared library (.DLL or .so). It will be used by the */
|
||||
/* high-level library of FreeType to retrieve the address of */
|
||||
/* the driver's generic interface. */
|
||||
/* */
|
||||
/* It shouldn't be implemented in a static build, as each */
|
||||
/* driver must have the same function as an exported entry */
|
||||
/* point. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* address of TrueType's driver generic interface. The */
|
||||
/* forma-specific interface can then be retrieved through */
|
||||
/* the method interface->get_format_interface.. */
|
||||
/* */
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
|
||||
|
||||
EXPORT_FUNC(FT_DriverInterface*) getDriverInterface( void )
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* getDriverInterface */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* This function is used when compiling the CID driver as a shared */
|
||||
/* library (`.DLL' or `.so'). It will be used by the high-level */
|
||||
/* library of FreeType to retrieve the address of the driver's */
|
||||
/* generic interface. */
|
||||
/* */
|
||||
/* It shouldn't be implemented in a static build, as each driver must */
|
||||
/* have the same function as an exported entry point. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The address of the CID's driver generic interface. The */
|
||||
/* format-specific interface can then be retrieved through the method */
|
||||
/* interface->get_format_interface. */
|
||||
/* */
|
||||
EXPORT_FUNC( FT_DriverInterface* ) getDriverInterface( void )
|
||||
{
|
||||
return &t1_driver_interface;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1,19 +1,20 @@
|
||||
/*******************************************************************
|
||||
*
|
||||
* t1driver.h
|
||||
*
|
||||
* High-level Type1 driver interface for FreeType 2.0
|
||||
*
|
||||
* Copyright 1996-1998 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
*
|
||||
* This file is part of the FreeType project, and may only be used,
|
||||
* modified, and distributed under the terms of the FreeType project
|
||||
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
* this file you indicate that you have read the license and
|
||||
* understand and accept it fully.
|
||||
*
|
||||
******************************************************************/
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* t1driver.h */
|
||||
/* */
|
||||
/* High-level Type 1 driver interface (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef T1DRIVER_H
|
||||
#define T1DRIVER_H
|
||||
@ -21,7 +22,9 @@
|
||||
#include <t1objs.h>
|
||||
#include <freetype/internal/t1errors.h>
|
||||
|
||||
FT_EXPORT_VAR(const FT_DriverInterface) t1_driver_interface;
|
||||
FT_EXPORT_VAR( const FT_DriverInterface ) t1_driver_interface;
|
||||
|
||||
#endif /* T1DRIVER_H */
|
||||
|
||||
|
||||
/* END */
|
||||
|
1539
src/type1/t1gload.c
1539
src/type1/t1gload.c
File diff suppressed because it is too large
Load Diff
@ -1,36 +1,20 @@
|
||||
/*******************************************************************
|
||||
*
|
||||
* t1gload.h 1.0
|
||||
*
|
||||
* Type1 Glyph Loader.
|
||||
*
|
||||
* Copyright 1996-1998 by
|
||||
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
*
|
||||
* This file is part of the FreeType project, and may only be used
|
||||
* modified and distributed under the terms of the FreeType project
|
||||
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
||||
* this file you indicate that you have read the license and
|
||||
* understand and accept it fully.
|
||||
*
|
||||
*
|
||||
* The Type 1 glyph loader uses three distinct objects to build
|
||||
* scaled and hinted outlines from a charstrings program. These are :
|
||||
*
|
||||
* - a glyph builder, T1_Builder, used to store the built outline
|
||||
*
|
||||
* - a glyph hinter, T1_Hinter, used to record and apply the stem
|
||||
* hints
|
||||
*
|
||||
* - a charstrings interpreter, T1_Decoder, used to parse the
|
||||
* Type 1 charstrings stream, manage a stack and call the builder
|
||||
* and/or hinter depending on the opcodes.
|
||||
*
|
||||
* Ideally, a Type 2 glyph loader would only need to have its own
|
||||
* T2_Decoder object (assuming the hinter is able to manage all
|
||||
* kinds of hints).
|
||||
*
|
||||
******************************************************************/
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* t1gload.h */
|
||||
/* */
|
||||
/* Type 1 Glyph Loader (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef T1GLOAD_H
|
||||
#define T1GLOAD_H
|
||||
@ -42,25 +26,15 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Structure> T1_Builder_Funcs */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* a structure used to store the address of various functions */
|
||||
/* used by a glyph builder to implement the outline's "path */
|
||||
/* construction". */
|
||||
/* */
|
||||
/* */
|
||||
typedef struct T1_Builder_ T1_Builder;
|
||||
|
||||
typedef FT_Error (*T1_Builder_EndChar)( T1_Builder* loader );
|
||||
|
||||
typedef FT_Error (*T1_Builder_Sbw) ( T1_Builder* loader,
|
||||
FT_Pos sbx,
|
||||
FT_Pos sby,
|
||||
FT_Pos wx,
|
||||
FT_Pos wy );
|
||||
typedef FT_Error (*T1_Builder_Sbw)( T1_Builder* loader,
|
||||
FT_Pos sbx,
|
||||
FT_Pos sby,
|
||||
FT_Pos wx,
|
||||
FT_Pos wy );
|
||||
|
||||
typedef FT_Error (*T1_Builder_ClosePath)( T1_Builder* loader );
|
||||
|
||||
@ -80,7 +54,17 @@
|
||||
FT_Pos dx3,
|
||||
FT_Pos dy3 );
|
||||
|
||||
typedef struct T1_Builder_Funcs_
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Structure> */
|
||||
/* T1_Builder_Funcs */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure to store the address of various functions used by a */
|
||||
/* glyph builder to implement the outline's `path construction'. */
|
||||
/* */
|
||||
typedef struct T1_Builder_Funcs_
|
||||
{
|
||||
T1_Builder_EndChar end_char;
|
||||
T1_Builder_Sbw set_bearing_point;
|
||||
@ -92,51 +76,62 @@
|
||||
} T1_Builder_Funcs;
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Structure> T1_Builder */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* a structure used during glyph loading to store its outline. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* system :: current system object */
|
||||
/* face :: current face object */
|
||||
/* size :: current size object */
|
||||
/* glyph :: current glyph slot */
|
||||
/* */
|
||||
/* current :: current glyph outline */
|
||||
/* base :: base glyph outline */
|
||||
/* */
|
||||
/* max_points :: maximum points in builder outline */
|
||||
/* max_contours :: maximum contours in builder outline */
|
||||
/* */
|
||||
/* last :: last point position */
|
||||
/* */
|
||||
/* scale_x :: horizontal scale ( FUnits to sub-pixels ) */
|
||||
/* scale_y :: vertical scale ( FUnits to sub-pixels ) */
|
||||
/* pos_x :: horizontal translation (composite glyphs) */
|
||||
/* pos_y :: vertical translation (composite glyph) */
|
||||
/* */
|
||||
/* left_bearing :: left side bearing point */
|
||||
/* advance :: horizontal advance vector */
|
||||
/* */
|
||||
/* path_begun :: flag, indicates that a new path has begun */
|
||||
/* load_points :: flag, if not set, no points are loaded */
|
||||
/* */
|
||||
/* pass :: pass number for multi-pass hinters */
|
||||
/* */
|
||||
/* funcs :: table of builder functions used to perform */
|
||||
/* the outline's path construction */
|
||||
/* */
|
||||
/* hint_point :: index of next point to hint.. */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
|
||||
struct T1_Builder_
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Structure> */
|
||||
/* T1_Builder */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure used during glyph loading to store its outline. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* memory :: The current memory object. */
|
||||
/* */
|
||||
/* face :: The current face object. */
|
||||
/* */
|
||||
/* size :: The current size object. */
|
||||
/* */
|
||||
/* glyph :: The current glyph slot. */
|
||||
/* */
|
||||
/* current :: The current glyph outline. */
|
||||
/* */
|
||||
/* base :: The base glyph outline. */
|
||||
/* */
|
||||
/* max_points :: The maximum number of points in builder outline. */
|
||||
/* */
|
||||
/* max_contours :: The maximum number of contours in builder outline. */
|
||||
/* */
|
||||
/* last :: The last point position. */
|
||||
/* */
|
||||
/* scale_x :: The horizontal scale (FUnits to sub-pixels). */
|
||||
/* */
|
||||
/* scale_y :: The vertical scale (FUnits to sub-pixels). */
|
||||
/* */
|
||||
/* pos_x :: The horizontal translation (for composite glyphs). */
|
||||
/* */
|
||||
/* pos_y :: The vertical translation (for composite glyphs). */
|
||||
/* */
|
||||
/* left_bearing :: The left side bearing point. */
|
||||
/* */
|
||||
/* advance :: The horizontal advance vector. */
|
||||
/* */
|
||||
/* no_recurse :: */
|
||||
/* */
|
||||
/* bbox :: The glyph's bounding box. */
|
||||
/* */
|
||||
/* path_begun :: A flag which indicates that a new path has begun. */
|
||||
/* */
|
||||
/* load_points :: A flag which indicates, if not set, that no points */
|
||||
/* are loaded. */
|
||||
/* */
|
||||
/* pass :: The pass number for multi-pass hinters. */
|
||||
/* */
|
||||
/* hint_point :: The index of the next point to hint. */
|
||||
/* */
|
||||
/* funcs :: A table of builder functions used to perform the */
|
||||
/* outline's path construction. */
|
||||
/* */
|
||||
struct T1_Builder_
|
||||
{
|
||||
FT_Memory memory;
|
||||
T1_Face face;
|
||||
@ -173,15 +168,6 @@
|
||||
};
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Structure> T1_Hinter_Funcs */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* a structure used to store the address of various functions */
|
||||
/* used by a Type 1 hinter to perform outline hinting. */
|
||||
/* */
|
||||
|
||||
typedef FT_Error (*T1_Hinter_ChangeHints)( T1_Builder* builder );
|
||||
|
||||
typedef FT_Error (*T1_Hinter_DotSection)( T1_Builder* builder );
|
||||
@ -191,7 +177,6 @@
|
||||
FT_Pos width,
|
||||
FT_Bool vertical );
|
||||
|
||||
|
||||
typedef FT_Error (*T1_Hinter_Stem3)( T1_Builder* builder,
|
||||
FT_Pos pos0,
|
||||
FT_Pos width0,
|
||||
@ -201,18 +186,27 @@
|
||||
FT_Pos width2,
|
||||
FT_Bool vertical );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Structure> */
|
||||
/* T1_Hinter_Funcs */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure to store the address of various functions used by a */
|
||||
/* Type 1 hinter to perform outline hinting. */
|
||||
/* */
|
||||
typedef struct T1_Hinter_Func_
|
||||
{
|
||||
T1_Hinter_ChangeHints change_hints;
|
||||
T1_Hinter_DotSection dot_section;
|
||||
T1_Hinter_Stem stem;
|
||||
T1_Hinter_Stem3 stem3;
|
||||
T1_Hinter_ChangeHints change_hints;
|
||||
T1_Hinter_DotSection dot_section;
|
||||
T1_Hinter_Stem stem;
|
||||
T1_Hinter_Stem3 stem3;
|
||||
|
||||
} T1_Hinter_Funcs;
|
||||
|
||||
|
||||
|
||||
typedef enum T1_Operator_
|
||||
typedef enum T1_Operator_
|
||||
{
|
||||
op_none = 0,
|
||||
op_endchar,
|
||||
@ -246,10 +240,8 @@
|
||||
} T1_Operator;
|
||||
|
||||
|
||||
|
||||
|
||||
/* execution context charstring zone */
|
||||
typedef struct T1_Decoder_Zone_
|
||||
typedef struct T1_Decoder_Zone_
|
||||
{
|
||||
FT_Byte* base;
|
||||
FT_Byte* limit;
|
||||
@ -258,166 +250,54 @@
|
||||
} T1_Decoder_Zone;
|
||||
|
||||
|
||||
typedef struct T1_Decoder_
|
||||
typedef struct T1_Decoder_
|
||||
{
|
||||
T1_Builder builder;
|
||||
T1_Hinter_Funcs hinter;
|
||||
T1_Builder builder;
|
||||
T1_Hinter_Funcs hinter;
|
||||
|
||||
FT_Int stack[ T1_MAX_CHARSTRINGS_OPERANDS ];
|
||||
FT_Int* top;
|
||||
FT_Int stack[T1_MAX_CHARSTRINGS_OPERANDS];
|
||||
FT_Int* top;
|
||||
|
||||
T1_Decoder_Zone zones[ T1_MAX_SUBRS_CALLS+1 ];
|
||||
T1_Decoder_Zone* zone;
|
||||
T1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1];
|
||||
T1_Decoder_Zone* zone;
|
||||
|
||||
FT_Int flex_state;
|
||||
FT_Int num_flex_vectors;
|
||||
FT_Vector flex_vectors[7];
|
||||
FT_Int flex_state;
|
||||
FT_Int num_flex_vectors;
|
||||
FT_Vector flex_vectors[7];
|
||||
|
||||
} T1_Decoder;
|
||||
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* <Function>
|
||||
* T1_Init_Builder
|
||||
*
|
||||
* <Description>
|
||||
* Initialise a given glyph builder.
|
||||
*
|
||||
* <Input>
|
||||
* builder :: glyph builder to initialise
|
||||
* face :: current face object
|
||||
* size :: current size object
|
||||
* glyph :: current glyph object
|
||||
* funcs :: glyph builder functions (or "methods").
|
||||
*
|
||||
* <Note>
|
||||
* This function is exported for now because it is used by the
|
||||
* "t1dump" utility. Later, it will be accessed through a
|
||||
* format-specific extension
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Init_Builder( T1_Builder* builder,
|
||||
T1_Face face,
|
||||
T1_Size size,
|
||||
T1_GlyphSlot glyph,
|
||||
const T1_Builder_Funcs* funcs );
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* <Function>
|
||||
* T1_Done_Builder
|
||||
*
|
||||
* <Description>
|
||||
* Finalise a given glyph builder. Its content can still be
|
||||
* used after the call, but the function saves important information
|
||||
* within the corresponding glyph slot.
|
||||
*
|
||||
* <Input>
|
||||
* builder :: glyph builder to initialise
|
||||
*
|
||||
* <Note>
|
||||
* This function is exported for now because it is used by the
|
||||
* "t1dump" utility. Later, it will be accessed through a
|
||||
* format-specific extension
|
||||
*
|
||||
*********************************************************************/
|
||||
void T1_Init_Builder( T1_Builder* builder,
|
||||
T1_Face face,
|
||||
T1_Size size,
|
||||
T1_GlyphSlot glyph,
|
||||
const T1_Builder_Funcs* funcs );
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Done_Builder( T1_Builder* builder );
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* <Function>
|
||||
* T1_Init_Decoder
|
||||
*
|
||||
* <Description>
|
||||
* Initialise a given Type 1 decoder for parsing
|
||||
*
|
||||
* <Input>
|
||||
* decoder :: Type 1 decoder to initialise
|
||||
* funcs :: hinter functions interface
|
||||
*
|
||||
* <Note>
|
||||
* This function is exported for now because it is used by the
|
||||
* "t1dump" utility. Later, it will be accessed through a
|
||||
* format-specific extension
|
||||
*
|
||||
*********************************************************************/
|
||||
|
||||
LOCAL_DEF
|
||||
void T1_Init_Decoder( T1_Decoder* decoder,
|
||||
const T1_Hinter_Funcs* funcs );
|
||||
|
||||
|
||||
|
||||
/* Compute the maximum advance width of a font through quick parsing */
|
||||
LOCAL_DEF
|
||||
FT_Error T1_Compute_Max_Advance( T1_Face face,
|
||||
FT_Int *max_advance );
|
||||
FT_Int* max_advance );
|
||||
|
||||
|
||||
/* This function is exported, because it is used by the T1Dump utility */
|
||||
LOCAL_DEF
|
||||
FT_Error T1_Parse_CharStrings( T1_Decoder* decoder,
|
||||
FT_Byte* charstring_base,
|
||||
FT_Int charstring_len,
|
||||
FT_Int num_subrs,
|
||||
FT_Byte** subrs_base,
|
||||
FT_Int* subrs_len );
|
||||
FT_Error T1_Parse_CharStrings( T1_Decoder* decoder,
|
||||
FT_Byte* charstring_base,
|
||||
FT_Int charstring_len,
|
||||
FT_Int num_subrs,
|
||||
FT_Byte** subrs_base,
|
||||
FT_Int* subrs_len );
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> T1_Add_Points */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Checks that there is enough room in the current load glyph outline */
|
||||
/* to accept "num_points" additional outline points. If not, this */
|
||||
/* function grows the load outline's arrays accordingly.. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* builder :: pointer to glyph builder object */
|
||||
/* num_points :: number of points that will be added later */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* This function does NOT update the points count in the glyph loader */
|
||||
/* This must be done by the caller itself, after this function is */
|
||||
/* invoked.. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error T1_Add_Points( T1_Builder* builder,
|
||||
FT_Int num_points );
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> T1_Add_Contours */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Checks that there is enough room in the current load glyph outline */
|
||||
/* to accept "num_contours" additional contours. If not, this func */
|
||||
/* the load outline's arrays accordingly.. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* builder :: pointer to glyph builder object */
|
||||
/* num_contours :: number of contours that will be added later */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Type1 error code. 0 means success */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* This function does NOT update the contours count in the load glyph */
|
||||
/* This must be done by the caller itself, after this function is */
|
||||
/* invoked.. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
FT_Error T1_Add_Contours( T1_Builder* builder,
|
||||
FT_Int num_contours );
|
||||
@ -434,4 +314,8 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* T1GLOAD_H */
|
||||
|
||||
|
||||
/* END */
|
||||
|
1178
src/type1/t1hinter.c
1178
src/type1/t1hinter.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user