mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 17:47:12 -04:00
Remove all unused TT_CONFIG_OPTION_BDF code
This commit is contained in:
parent
afcc32c6b3
commit
8388eabc92
@ -542,14 +542,6 @@ FT_BEGIN_HEADER
|
||||
#undef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Define TT_CONFIG_OPTION_BDF if you want to include support for */
|
||||
/* an embedded `BDF ' table within SFNT-based bitmap formats. */
|
||||
/* */
|
||||
#undef TT_CONFIG_OPTION_BDF
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* Option TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES controls the maximum */
|
||||
|
@ -70,13 +70,6 @@ FT_BEGIN_HEADER
|
||||
FT_LOCAL( FT_UInt )
|
||||
cf2_getMaxstack( PS_Decoder* decoder );
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
FT_LOCAL( FT_Error )
|
||||
cf2_getNormalizedVector( PS_Decoder* decoder,
|
||||
CF2_UInt *len,
|
||||
FT_Fixed* *vec );
|
||||
#endif
|
||||
|
||||
FT_LOCAL( CF2_Fixed )
|
||||
cf2_getPpemY( PS_Decoder* decoder );
|
||||
FT_LOCAL( CF2_Fixed )
|
||||
|
@ -249,207 +249,6 @@
|
||||
}
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||
|
||||
/* Only ASCII letters and digits are taken for a variation font */
|
||||
/* instance's PostScript name. */
|
||||
/* */
|
||||
/* `ft_isalnum' is a macro, but we need a function here, thus */
|
||||
/* this definition. */
|
||||
static int
|
||||
sfnt_is_alphanumeric( int c )
|
||||
{
|
||||
return ft_isalnum( c );
|
||||
}
|
||||
|
||||
|
||||
/* the implementation of MurmurHash3 is taken and adapted from */
|
||||
/* https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp */
|
||||
|
||||
#define ROTL32( x, r ) ( x << r ) | ( x >> ( 32 - r ) )
|
||||
|
||||
|
||||
static FT_UInt32
|
||||
fmix32( FT_UInt32 h )
|
||||
{
|
||||
h ^= h >> 16;
|
||||
h *= 0x85ebca6b;
|
||||
h ^= h >> 13;
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= h >> 16;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
murmur_hash_3_128( const void* key,
|
||||
const unsigned int len,
|
||||
FT_UInt32 seed,
|
||||
void* out )
|
||||
{
|
||||
const FT_Byte* data = (const FT_Byte*)key;
|
||||
const int nblocks = (int)len / 16;
|
||||
|
||||
FT_UInt32 h1 = seed;
|
||||
FT_UInt32 h2 = seed;
|
||||
FT_UInt32 h3 = seed;
|
||||
FT_UInt32 h4 = seed;
|
||||
|
||||
const FT_UInt32 c1 = 0x239b961b;
|
||||
const FT_UInt32 c2 = 0xab0e9789;
|
||||
const FT_UInt32 c3 = 0x38b34ae5;
|
||||
const FT_UInt32 c4 = 0xa1e38b93;
|
||||
|
||||
const FT_UInt32* blocks = (const FT_UInt32*)( data + nblocks * 16 );
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
for( i = -nblocks; i; i++ )
|
||||
{
|
||||
FT_UInt32 k1 = blocks[i * 4 + 0];
|
||||
FT_UInt32 k2 = blocks[i * 4 + 1];
|
||||
FT_UInt32 k3 = blocks[i * 4 + 2];
|
||||
FT_UInt32 k4 = blocks[i * 4 + 3];
|
||||
|
||||
|
||||
k1 *= c1;
|
||||
k1 = ROTL32( k1, 15 );
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
|
||||
h1 = ROTL32( h1, 19 );
|
||||
h1 += h2;
|
||||
h1 = h1 * 5 + 0x561ccd1b;
|
||||
|
||||
k2 *= c2;
|
||||
k2 = ROTL32( k2, 16 );
|
||||
k2 *= c3;
|
||||
h2 ^= k2;
|
||||
|
||||
h2 = ROTL32( h2, 17 );
|
||||
h2 += h3;
|
||||
h2 = h2 * 5 + 0x0bcaa747;
|
||||
|
||||
k3 *= c3;
|
||||
k3 = ROTL32( k3, 17 );
|
||||
k3 *= c4;
|
||||
h3 ^= k3;
|
||||
|
||||
h3 = ROTL32( h3, 15 );
|
||||
h3 += h4;
|
||||
h3 = h3 * 5 + 0x96cd1c35;
|
||||
|
||||
k4 *= c4;
|
||||
k4 = ROTL32( k4, 18 );
|
||||
k4 *= c1;
|
||||
h4 ^= k4;
|
||||
|
||||
h4 = ROTL32( h4, 13 );
|
||||
h4 += h1;
|
||||
h4 = h4 * 5 + 0x32ac3b17;
|
||||
}
|
||||
|
||||
{
|
||||
const FT_Byte* tail = (const FT_Byte*)( data + nblocks * 16 );
|
||||
|
||||
FT_UInt32 k1 = 0;
|
||||
FT_UInt32 k2 = 0;
|
||||
FT_UInt32 k3 = 0;
|
||||
FT_UInt32 k4 = 0;
|
||||
|
||||
|
||||
switch ( len & 15 )
|
||||
{
|
||||
case 15:
|
||||
k4 ^= (FT_UInt32)tail[14] << 16;
|
||||
case 14:
|
||||
k4 ^= (FT_UInt32)tail[13] << 8;
|
||||
case 13:
|
||||
k4 ^= (FT_UInt32)tail[12];
|
||||
k4 *= c4;
|
||||
k4 = ROTL32( k4, 18 );
|
||||
k4 *= c1;
|
||||
h4 ^= k4;
|
||||
|
||||
case 12:
|
||||
k3 ^= (FT_UInt32)tail[11] << 24;
|
||||
case 11:
|
||||
k3 ^= (FT_UInt32)tail[10] << 16;
|
||||
case 10:
|
||||
k3 ^= (FT_UInt32)tail[9] << 8;
|
||||
case 9:
|
||||
k3 ^= (FT_UInt32)tail[8];
|
||||
k3 *= c3;
|
||||
k3 = ROTL32( k3, 17 );
|
||||
k3 *= c4;
|
||||
h3 ^= k3;
|
||||
|
||||
case 8:
|
||||
k2 ^= (FT_UInt32)tail[7] << 24;
|
||||
case 7:
|
||||
k2 ^= (FT_UInt32)tail[6] << 16;
|
||||
case 6:
|
||||
k2 ^= (FT_UInt32)tail[5] << 8;
|
||||
case 5:
|
||||
k2 ^= (FT_UInt32)tail[4];
|
||||
k2 *= c2;
|
||||
k2 = ROTL32( k2, 16 );
|
||||
k2 *= c3;
|
||||
h2 ^= k2;
|
||||
|
||||
case 4:
|
||||
k1 ^= (FT_UInt32)tail[3] << 24;
|
||||
case 3:
|
||||
k1 ^= (FT_UInt32)tail[2] << 16;
|
||||
case 2:
|
||||
k1 ^= (FT_UInt32)tail[1] << 8;
|
||||
case 1:
|
||||
k1 ^= (FT_UInt32)tail[0];
|
||||
k1 *= c1;
|
||||
k1 = ROTL32( k1, 15 );
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
}
|
||||
}
|
||||
|
||||
h1 ^= len;
|
||||
h2 ^= len;
|
||||
h3 ^= len;
|
||||
h4 ^= len;
|
||||
|
||||
h1 += h2;
|
||||
h1 += h3;
|
||||
h1 += h4;
|
||||
|
||||
h2 += h1;
|
||||
h3 += h1;
|
||||
h4 += h1;
|
||||
|
||||
h1 = fmix32( h1 );
|
||||
h2 = fmix32( h2 );
|
||||
h3 = fmix32( h3 );
|
||||
h4 = fmix32( h4 );
|
||||
|
||||
h1 += h2;
|
||||
h1 += h3;
|
||||
h1 += h4;
|
||||
|
||||
h2 += h1;
|
||||
h3 += h1;
|
||||
h4 += h1;
|
||||
|
||||
((FT_UInt32*)out)[0] = h1;
|
||||
((FT_UInt32*)out)[1] = h2;
|
||||
((FT_UInt32*)out)[2] = h3;
|
||||
((FT_UInt32*)out)[3] = h4;
|
||||
}
|
||||
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
||||
|
||||
|
||||
typedef int (*char_type_func)( int c );
|
||||
|
||||
|
||||
@ -665,69 +464,11 @@
|
||||
)
|
||||
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
|
||||
static FT_Error
|
||||
sfnt_get_charset_id( TT_Face face,
|
||||
const char* *acharset_encoding,
|
||||
const char* *acharset_registry )
|
||||
{
|
||||
BDF_PropertyRec encoding, registry;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
/* XXX: I don't know whether this is correct, since
|
||||
* tt_face_find_bdf_prop only returns something correct if we have
|
||||
* previously selected a size that is listed in the BDF table.
|
||||
* Should we change the BDF table format to include single offsets
|
||||
* for `CHARSET_REGISTRY' and `CHARSET_ENCODING'?
|
||||
*/
|
||||
error = tt_face_find_bdf_prop( face, "CHARSET_REGISTRY", ®istry );
|
||||
if ( !error )
|
||||
{
|
||||
error = tt_face_find_bdf_prop( face, "CHARSET_ENCODING", &encoding );
|
||||
if ( !error )
|
||||
{
|
||||
if ( registry.type == BDF_PROPERTY_TYPE_ATOM &&
|
||||
encoding.type == BDF_PROPERTY_TYPE_ATOM )
|
||||
{
|
||||
*acharset_encoding = encoding.u.atom;
|
||||
*acharset_registry = registry.u.atom;
|
||||
}
|
||||
else
|
||||
error = FT_THROW( Invalid_Argument );
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
FT_DEFINE_SERVICE_BDFRec(
|
||||
sfnt_service_bdf,
|
||||
|
||||
(FT_BDF_GetCharsetIdFunc)sfnt_get_charset_id, /* get_charset_id */
|
||||
(FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop /* get_property */
|
||||
)
|
||||
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_BDF */
|
||||
|
||||
|
||||
/*
|
||||
* SERVICE LIST
|
||||
*/
|
||||
|
||||
#if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF
|
||||
FT_DEFINE_SERVICEDESCREC5(
|
||||
sfnt_services,
|
||||
|
||||
FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table,
|
||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name,
|
||||
FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict,
|
||||
FT_SERVICE_ID_BDF, &sfnt_service_bdf,
|
||||
FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info )
|
||||
#elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
#if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
FT_DEFINE_SERVICEDESCREC4(
|
||||
sfnt_services,
|
||||
|
||||
@ -735,14 +476,6 @@
|
||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name,
|
||||
FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict,
|
||||
FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info )
|
||||
#elif defined TT_CONFIG_OPTION_BDF
|
||||
FT_DEFINE_SERVICEDESCREC4(
|
||||
sfnt_services,
|
||||
|
||||
FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table,
|
||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name,
|
||||
FT_SERVICE_ID_BDF, &sfnt_service_bdf,
|
||||
FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info )
|
||||
#else
|
||||
FT_DEFINE_SERVICEDESCREC3(
|
||||
sfnt_services,
|
||||
|
@ -1714,11 +1714,6 @@
|
||||
sfnt->free_eblc( face );
|
||||
}
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
/* freeing the embedded BDF properties */
|
||||
tt_face_free_bdf_props( face );
|
||||
#endif
|
||||
|
||||
/* freeing the collection table */
|
||||
FT_FREE( face->ttc_header.offsets );
|
||||
face->ttc_header.count = 0;
|
||||
|
@ -843,72 +843,6 @@ FT_BEGIN_HEADER
|
||||
|
||||
} TT_Post_NamesRec, *TT_Post_Names;
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*** ***/
|
||||
/*** ***/
|
||||
/*** EMBEDDED BDF PROPERTIES TABLE SUPPORT ***/
|
||||
/*** ***/
|
||||
/*** ***/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* These types are used to support a `BDF ' table that isn't part of the
|
||||
* official TrueType specification. It is mainly used in SFNT-based
|
||||
* bitmap fonts that were generated from a set of BDF fonts.
|
||||
*
|
||||
* The format of the table is as follows.
|
||||
*
|
||||
* USHORT version `BDF ' table version number, should be 0x0001.
|
||||
* USHORT strikeCount Number of strikes (bitmap sizes) in this table.
|
||||
* ULONG stringTable Offset (from start of BDF table) to string
|
||||
* table.
|
||||
*
|
||||
* This is followed by an array of `strikeCount' descriptors, having the
|
||||
* following format.
|
||||
*
|
||||
* USHORT ppem Vertical pixels per EM for this strike.
|
||||
* USHORT numItems Number of items for this strike (properties and
|
||||
* atoms). Maximum is 255.
|
||||
*
|
||||
* This array in turn is followed by `strikeCount' value sets. Each
|
||||
* `value set' is an array of `numItems' items with the following format.
|
||||
*
|
||||
* ULONG item_name Offset in string table to item name.
|
||||
* USHORT item_type The item type. Possible values are
|
||||
* 0 => string (e.g., COMMENT)
|
||||
* 1 => atom (e.g., FONT or even SIZE)
|
||||
* 2 => int32
|
||||
* 3 => uint32
|
||||
* 0x10 => A flag to indicate a properties. This
|
||||
* is ORed with the above values.
|
||||
* ULONG item_value For strings => Offset into string table without
|
||||
* the corresponding double quotes.
|
||||
* For atoms => Offset into string table.
|
||||
* For integers => Direct value.
|
||||
*
|
||||
* All strings in the string table consist of bytes and are
|
||||
* zero-terminated.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
|
||||
typedef struct TT_BDFRec_
|
||||
{
|
||||
FT_Byte* table;
|
||||
FT_Byte* table_end;
|
||||
FT_Byte* strings;
|
||||
FT_ULong strings_size;
|
||||
FT_UInt num_strikes;
|
||||
FT_Bool loaded;
|
||||
|
||||
} TT_BDFRec, *TT_BDF;
|
||||
|
||||
#endif /* TT_CONFIG_OPTION_BDF */
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
@ -1478,10 +1412,6 @@ FT_BEGIN_HEADER
|
||||
FT_UInt sbit_num_strikes;
|
||||
FT_UInt* sbit_strike_map;
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_BDF
|
||||
TT_BDFRec bdf;
|
||||
#endif /* TT_CONFIG_OPTION_BDF */
|
||||
|
||||
/* since 2.3.0 */
|
||||
FT_ULong horz_metrics_offset;
|
||||
FT_ULong vert_metrics_offset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user