diff --git a/src/freetype/cffdrivr.c b/src/freetype/cffdrivr.c index 81f7ee7b5..db84e24ce 100644 --- a/src/freetype/cffdrivr.c +++ b/src/freetype/cffdrivr.c @@ -36,11 +36,6 @@ #include "cffparse.h" #include "cffobjs.h" -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H -#endif - #include "cfferrs.h" #include FT_SERVICE_FONT_FORMAT_H @@ -893,20 +888,6 @@ FT_SERVICE_ID_PROPERTIES, &cff_service_properties, FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load ) -#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC9( - cff_services, - - FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF, - FT_SERVICE_ID_MULTI_MASTERS, &cff_service_multi_masters, - FT_SERVICE_ID_METRICS_VARIATIONS, &cff_service_metrics_variations, - FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name, - FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info, - FT_SERVICE_ID_CID, &cff_service_cid_info, - FT_SERVICE_ID_PROPERTIES, &cff_service_properties, - FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load - ) #else FT_DEFINE_SERVICEDESCREC7( cff_services, diff --git a/src/freetype/cffload.h b/src/freetype/cffload.h index 58143782a..39330cb75 100644 --- a/src/freetype/cffload.h +++ b/src/freetype/cffload.h @@ -104,18 +104,6 @@ FT_BEGIN_HEADER CFF_Parser parser, FT_UInt numBlends ); -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_LOCAL( FT_Error ) - cff_get_var_blend( CFF_Face face, - FT_UInt *num_coords, - FT_Fixed* *coords, - FT_Fixed* *normalizedcoords, - FT_MM_Var* *mm_var ); - - FT_LOCAL( void ) - cff_done_blend( CFF_Face face ); -#endif - FT_END_HEADER diff --git a/src/freetype/cffobjs.c b/src/freetype/cffobjs.c index ef97289a6..8fdeb90b5 100644 --- a/src/freetype/cffobjs.c +++ b/src/freetype/cffobjs.c @@ -27,12 +27,6 @@ #include FT_INTERNAL_SFNT_H #include FT_DRIVER_H -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H -#include FT_SERVICE_METRICS_VARIATIONS_H -#endif - #include FT_INTERNAL_CFF_OBJECTS_TYPES_H #include "cffobjs.h" #include "cffload.h" @@ -1065,11 +1059,6 @@ FT_FREE( face->extra.data ); } } - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - cff_done_blend( face ); - face->blend = NULL; -#endif } diff --git a/src/freetype/psft.c b/src/freetype/psft.c index 1f750174a..cd74adafe 100644 --- a/src/freetype/psft.c +++ b/src/freetype/psft.c @@ -44,11 +44,6 @@ #include "psobjs.h" #include "cffdecode.h" -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#include FT_SERVICE_MULTIPLE_MASTERS_H -#endif - #include FT_SERVICE_CFF_TABLE_LOAD_H @@ -473,32 +468,6 @@ } -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* Get normalized design vector for current render request; */ - /* return pointer and length. */ - /* */ - /* Note: Uses FT_Fixed not CF2_Fixed for the vector. */ - FT_LOCAL_DEF( FT_Error ) - cf2_getNormalizedVector( PS_Decoder* decoder, - CF2_UInt *len, - FT_Fixed* *vec ) - { - TT_Face face; - FT_Service_MultiMasters mm; - - - FT_ASSERT( decoder && decoder->builder.face ); - FT_ASSERT( vec && len ); - FT_ASSERT( !decoder->builder.is_t1 ); - - face = (TT_Face)decoder->builder.face; - mm = (FT_Service_MultiMasters)face->mm; - - return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL ); - } -#endif - - /* get `y_ppem' from `CFF_Size' */ FT_LOCAL_DEF( CF2_Fixed ) cf2_getPpemY( PS_Decoder* decoder ) diff --git a/src/freetype/sfdriver.c b/src/freetype/sfdriver.c index bf39b24ef..aa7d78212 100644 --- a/src/freetype/sfdriver.c +++ b/src/freetype/sfdriver.c @@ -612,406 +612,6 @@ } -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - - /* - The maximum length of an axis value descriptor. - - We need 65536 different values for the decimal fraction; this fits - nicely into five decimal places. Consequently, it consists of - - . the minus sign if the number is negative, - . up to five characters for the digits before the decimal point, - . the decimal point if there is a fractional part, and - . up to five characters for the digits after the decimal point. - - We also need one byte for the leading `_' character and up to four - bytes for the axis tag. - */ -#define MAX_VALUE_DESCRIPTOR_LEN ( 1 + 5 + 1 + 5 + 1 + 4 ) - - - /* the maximum length of PostScript font names */ -#define MAX_PS_NAME_LEN 127 - - - /* - * Find the shortest decimal representation of a 16.16 fixed point - * number. The function fills `buf' with the result, returning a pointer - * to the position after the representation's last byte. - */ - - static char* - fixed2float( FT_Int fixed, - char* buf ) - { - char* p; - char* q; - char tmp[5]; - - FT_Int int_part; - FT_Int frac_part; - - FT_Int i; - - - p = buf; - - if ( fixed == 0 ) - { - *p++ = '0'; - return p; - } - - if ( fixed < 0 ) - { - *p++ = '-'; - fixed = -fixed; - } - - int_part = ( fixed >> 16 ) & 0xFFFF; - frac_part = fixed & 0xFFFF; - - /* get digits of integer part (in reverse order) */ - q = tmp; - while ( int_part > 0 ) - { - *q++ = '0' + int_part % 10; - int_part /= 10; - } - - /* copy digits in correct order to buffer */ - while ( q > tmp ) - *p++ = *--q; - - if ( !frac_part ) - return p; - - /* save position of point */ - q = p; - *p++ = '.'; - - /* apply rounding */ - frac_part = frac_part * 10 + 5; - - /* get digits of fractional part */ - for ( i = 0; i < 5; i++ ) - { - *p++ = '0' + (char)( frac_part / 0x10000L ); - - frac_part %= 0x10000L; - if ( !frac_part ) - break; - - frac_part *= 10; - } - - /* - If the remainder stored in `frac_part' (after the last FOR loop) is - smaller than 34480*10, the resulting decimal value minus 0.00001 is - an equivalent representation of `fixed'. - - The above FOR loop always finds the larger of the two values; I - verified this by iterating over all possible fixed point numbers. - - If the remainder is 17232*10, both values are equally good, and we - take the next even number (following IEEE 754's `round to nearest, - ties to even' rounding rule). - - If the remainder is smaller than 17232*10, the lower of the two - numbers is nearer to the exact result (values 17232 and 34480 were - also found by testing all possible fixed point values). - - We use this to find a shorter decimal representation. If not ending - with digit zero, we take the representation with less error. - */ - p--; - if ( p - q == 5 ) /* five digits? */ - { - /* take the representation that has zero as the last digit */ - if ( frac_part < 34480 * 10 && - *p == '1' ) - *p = '0'; - - /* otherwise use the one with less error */ - else if ( frac_part == 17232 * 10 && - *p & 1 ) - *p -= 1; - - else if ( frac_part < 17232 * 10 && - *p != '0' ) - *p -= 1; - } - - /* remove trailing zeros */ - while ( *p == '0' ) - *p-- = '\0'; - - return p + 1; - } - - - static const char hexdigits[16] = - { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' - }; - - - static const char* - sfnt_get_var_ps_name( TT_Face face ) - { - FT_Error error; - FT_Memory memory = face->root.memory; - - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - - FT_UInt num_coords; - FT_Fixed* coords; - FT_MM_Var* mm_var; - - FT_Int found, win, apple; - FT_UInt i, j; - - char* result = NULL; - char* p; - - - if ( !face->var_postscript_prefix ) - { - FT_UInt len; - - - /* check whether we have a Variations PostScript Name Prefix */ - found = sfnt_get_name_id( face, - TT_NAME_ID_VARIATIONS_PREFIX, - &win, - &apple ); - if ( !found ) - { - /* otherwise use the typographic family name */ - found = sfnt_get_name_id( face, - TT_NAME_ID_TYPOGRAPHIC_FAMILY, - &win, - &apple ); - } - - if ( !found ) - { - /* as a last resort we try the family name; note that this is */ - /* not in the Adobe TechNote, but GX fonts (which predate the */ - /* TechNote) benefit from this behaviour */ - found = sfnt_get_name_id( face, - TT_NAME_ID_FONT_FAMILY, - &win, - &apple ); - } - - if ( !found ) - { - FT_TRACE0(( "sfnt_get_var_ps_name:" - " Can't construct PS name prefix for font instances\n" )); - return NULL; - } - - /* prefer Windows entries over Apple */ - if ( win != -1 ) - result = get_win_string( face->root.memory, - face->name_table.stream, - face->name_table.names + win, - sfnt_is_alphanumeric, - 0 ); - else - result = get_apple_string( face->root.memory, - face->name_table.stream, - face->name_table.names + apple, - sfnt_is_alphanumeric, - 0 ); - - len = ft_strlen( result ); - - /* sanitize if necessary; we reserve space for 36 bytes (a 128bit */ - /* checksum as a hex number, preceded by `-' and followed by three */ - /* ASCII dots, to be used if the constructed PS name would be too */ - /* long); this is also sufficient for a single instance */ - if ( len > MAX_PS_NAME_LEN - ( 1 + 32 + 3 ) ) - { - len = MAX_PS_NAME_LEN - ( 1 + 32 + 3 ); - result[len] = '\0'; - - FT_TRACE0(( "sfnt_get_var_ps_name:" - " Shortening variation PS name prefix\n" - " " - " to %d characters\n", len )); - } - - face->var_postscript_prefix = result; - face->var_postscript_prefix_len = len; - } - - mm->get_var_blend( FT_FACE( face ), - &num_coords, - &coords, - NULL, - &mm_var ); - - if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) && - !FT_IS_VARIATION( FT_FACE( face ) ) ) - { - SFNT_Service sfnt = (SFNT_Service)face->sfnt; - - FT_Long instance = ( ( face->root.face_index & 0x7FFF0000L ) >> 16 ) - 1; - FT_UInt psid = mm_var->namedstyle[instance].psid; - - char* ps_name = NULL; - - - /* try first to load the name string with index `postScriptNameID' */ - if ( psid == 6 || - ( psid > 255 && psid < 32768 ) ) - (void)sfnt->get_name( face, (FT_UShort)psid, &ps_name ); - - if ( ps_name ) - { - result = ps_name; - p = result + ft_strlen( result ) + 1; - - goto check_length; - } - else - { - /* otherwise construct a name using `subfamilyNameID' */ - FT_UInt strid = mm_var->namedstyle[instance].strid; - - char* subfamily_name; - char* s; - - - (void)sfnt->get_name( face, (FT_UShort)strid, &subfamily_name ); - - if ( !subfamily_name ) - { - FT_TRACE1(( "sfnt_get_var_ps_name:" - " can't construct named instance PS name;\n" - " " - " trying to construct normal instance PS name\n" )); - goto construct_instance_name; - } - - /* after the prefix we have character `-' followed by the */ - /* subfamily name (using only characters a-z, A-Z, and 0-9) */ - if ( FT_ALLOC( result, face->var_postscript_prefix_len + - 1 + ft_strlen( subfamily_name ) + 1 ) ) - return NULL; - - ft_strcpy( result, face->var_postscript_prefix ); - - p = result + face->var_postscript_prefix_len; - *p++ = '-'; - - s = subfamily_name; - while ( *s ) - { - if ( ft_isalnum( *s ) ) - *p++ = *s; - s++; - } - *p++ = '\0'; - - FT_FREE( subfamily_name ); - } - } - else - { - FT_Var_Axis* axis; - - - construct_instance_name: - axis = mm_var->axis; - - if ( FT_ALLOC( result, - face->var_postscript_prefix_len + - num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) ) - return NULL; - - p = result; - - ft_strcpy( p, face->var_postscript_prefix ); - p += face->var_postscript_prefix_len; - - for ( i = 0; i < num_coords; i++, coords++, axis++ ) - { - char t; - - - /* omit axis value descriptor if it is identical */ - /* to the default axis value */ - if ( *coords == axis->def ) - continue; - - *p++ = '_'; - p = fixed2float( *coords, p ); - - t = (char)( axis->tag >> 24 ); - if ( t != ' ' && ft_isalnum( t ) ) - *p++ = t; - t = (char)( axis->tag >> 16 ); - if ( t != ' ' && ft_isalnum( t ) ) - *p++ = t; - t = (char)( axis->tag >> 8 ); - if ( t != ' ' && ft_isalnum( t ) ) - *p++ = t; - t = (char)axis->tag; - if ( t != ' ' && ft_isalnum( t ) ) - *p++ = t; - } - } - - check_length: - if ( p - result > MAX_PS_NAME_LEN ) - { - /* the PS name is too long; replace the part after the prefix with */ - /* a checksum; we use MurmurHash 3 with a hash length of 128 bit */ - - FT_UInt32 seed = 123456789; - - FT_UInt32 hash[4]; - FT_UInt32* h; - - - murmur_hash_3_128( result, p - result, seed, hash ); - - p = result + face->var_postscript_prefix_len; - *p++ = '-'; - - /* we convert the hash value to hex digits from back to front */ - p += 32 + 3; - h = hash + 3; - - *p-- = '\0'; - *p-- = '.'; - *p-- = '.'; - *p-- = '.'; - - for ( i = 0; i < 4; i++, h-- ) - { - FT_UInt32 v = *h; - - - for ( j = 0; j < 8; j++ ) - { - *p-- = hexdigits[v & 0xF]; - v >>= 4; - } - } - } - - return result; - } - -#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ - - static const char* sfnt_get_ps_name( TT_Face face ) { @@ -1022,16 +622,6 @@ if ( face->postscript_name ) return face->postscript_name; -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( face->blend && - ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || - FT_IS_VARIATION( FT_FACE( face ) ) ) ) - { - face->postscript_name = sfnt_get_var_ps_name( face ); - return face->postscript_name; - } -#endif - /* scan the name table to see whether we have a Postscript name here, */ /* either in Macintosh or Windows platform encodings */ found = sfnt_get_name_id( face, TT_NAME_ID_PS_NAME, &win, &apple ); diff --git a/src/freetype/ttmtx.c b/src/freetype/ttmtx.c index 9454d9540..7eaeba8a9 100644 --- a/src/freetype/ttmtx.c +++ b/src/freetype/ttmtx.c @@ -21,10 +21,6 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_SERVICE_METRICS_VARIATIONS_H -#endif - #include "ttmtx.h" #include "sferrors.h" @@ -227,11 +223,6 @@ FT_ULong table_pos, table_size, table_end; FT_UShort k; -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Service_MetricsVariations var = - (FT_Service_MetricsVariations)face->var; -#endif - if ( vertical ) { @@ -292,34 +283,6 @@ *abearing = 0; *aadvance = 0; } - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( var ) - { - FT_Face f = FT_FACE( face ); - FT_Int a = (FT_Int)*aadvance; - FT_Int b = (FT_Int)*abearing; - - - if ( vertical ) - { - if ( var->vadvance_adjust ) - var->vadvance_adjust( f, gindex, &a ); - if ( var->tsb_adjust ) - var->tsb_adjust( f, gindex, &b ); - } - else - { - if ( var->hadvance_adjust ) - var->hadvance_adjust( f, gindex, &a ); - if ( var->lsb_adjust ) - var->lsb_adjust( f, gindex, &b ); - } - - *aadvance = (FT_UShort)a; - *abearing = (FT_Short)b; - } -#endif } diff --git a/src/freetype/ttobjs.c b/src/freetype/ttobjs.c index 1a14ba9b0..8ff0883a2 100644 --- a/src/freetype/ttobjs.c +++ b/src/freetype/ttobjs.c @@ -30,10 +30,6 @@ #ifdef TT_USE_BYTECODE_INTERPRETER #include "ttinterp.h" -#endif - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include "ttgxvar.h" #endif /*************************************************************************/ @@ -772,11 +768,6 @@ FT_FRAME_RELEASE( face->cvt_program ); face->font_program_size = 0; face->cvt_program_size = 0; - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - tt_done_blend( face ); - face->blend = NULL; -#endif } diff --git a/src/freetype/ttpload.c b/src/freetype/ttpload.c index 340a8c4bc..94f026b59 100644 --- a/src/freetype/ttpload.c +++ b/src/freetype/ttpload.c @@ -24,10 +24,6 @@ #include "ttpload.h" -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include "ttgxvar.h" -#endif - #include "tterrors.h" @@ -359,11 +355,6 @@ FT_FRAME_EXIT(); FT_TRACE2(( "loaded\n" )); -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( face->doblend ) - error = tt_face_vary_cvt( face, stream ); -#endif - Exit: return error; diff --git a/src/freetype/tttypes.h b/src/freetype/tttypes.h index 522a6f6ac..5233776fc 100644 --- a/src/freetype/tttypes.h +++ b/src/freetype/tttypes.h @@ -25,10 +25,6 @@ #include FT_TRUETYPE_TABLES_H #include FT_INTERNAL_OBJECTS_H -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT -#include FT_MULTIPLE_MASTERS_H -#endif - FT_BEGIN_HEADER @@ -847,24 +843,6 @@ FT_BEGIN_HEADER } TT_Post_NamesRec, *TT_Post_Names; - - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /*** ***/ - /*** ***/ - /*** GX VARIATION TABLE SUPPORT ***/ - /*** ***/ - /*** ***/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - typedef struct GX_BlendRec_ *GX_Blend; -#endif - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1417,16 +1395,6 @@ FT_BEGIN_HEADER /* handle glyph names <-> unicode & Mac values */ void* psnames; -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - /* a typeless pointer to the FT_Service_MultiMasters table used to */ - /* handle variation fonts */ - void* mm; - - /* a typeless pointer to the FT_Service_MetricsVariationsRec table */ - /* used to handle the HVAR, VVAR, and MVAR OpenType tables */ - void* var; -#endif - /* a typeless pointer to the PostScript Aux service */ void* psaux; @@ -1490,17 +1458,6 @@ FT_BEGIN_HEADER FT_Bool is_cff2; /* since 2.7.1 */ -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Bool doblend; - GX_Blend blend; - - FT_UInt32 variation_support; /* since 2.7.1 */ - - const char* var_postscript_prefix; /* since 2.7.2 */ - FT_UInt var_postscript_prefix_len; /* since 2.7.2 */ - -#endif - /* since version 2.2 */ FT_ULong horz_metrics_size;