summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-02-12 23:56:45 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-02-12 23:56:45 +0000
commitb90dc59a1171567878be291e46e4b2dcc9f3e72a (patch)
tree1ab66691676db14c137e53f257696690775aacd6 /Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
parent683b449a0eecd29a5ea0927bf48b769c1b2f369b (diff)
freetype2 2.6.3
git-svn-id: svn://tug.org/texlive/trunk@39697 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c')
-rw-r--r--Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c567
1 files changed, 139 insertions, 428 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c b/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
index 7b40f42ff77..4baa9ca918c 100644
--- a/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
+++ b/Build/source/libs/freetype2/freetype-src/src/bdf/bdflib.c
@@ -221,164 +221,6 @@
/*************************************************************************/
/* */
- /* Hash table utilities for the properties. */
- /* */
- /*************************************************************************/
-
- /* XXX: Replace this with FreeType's hash functions */
-
-
-#define INITIAL_HT_SIZE 241
-
- typedef void
- (*hash_free_func)( hashnode node );
-
- static hashnode*
- hash_bucket( const char* key,
- hashtable* ht )
- {
- const char* kp = key;
- unsigned long res = 0;
- hashnode* bp = ht->table, *ndp;
-
-
- /* Mocklisp hash function. */
- while ( *kp )
- res = ( res << 5 ) - res + (unsigned long)*kp++;
-
- ndp = bp + ( res % ht->size );
- while ( *ndp )
- {
- kp = (*ndp)->key;
- if ( kp[0] == key[0] && ft_strcmp( kp, key ) == 0 )
- break;
- ndp--;
- if ( ndp < bp )
- ndp = bp + ( ht->size - 1 );
- }
-
- return ndp;
- }
-
-
- static FT_Error
- hash_rehash( hashtable* ht,
- FT_Memory memory )
- {
- hashnode* obp = ht->table, *bp, *nbp;
- unsigned int i, sz = ht->size;
- FT_Error error = FT_Err_Ok;
-
-
- ht->size <<= 1;
- ht->limit = ht->size / 3;
-
- if ( FT_NEW_ARRAY( ht->table, ht->size ) )
- goto Exit;
-
- for ( i = 0, bp = obp; i < sz; i++, bp++ )
- {
- if ( *bp )
- {
- nbp = hash_bucket( (*bp)->key, ht );
- *nbp = *bp;
- }
- }
- FT_FREE( obp );
-
- Exit:
- return error;
- }
-
-
- static FT_Error
- hash_init( hashtable* ht,
- FT_Memory memory )
- {
- unsigned int sz = INITIAL_HT_SIZE;
- FT_Error error = FT_Err_Ok;
-
-
- ht->size = sz;
- ht->limit = sz / 3;
- ht->used = 0;
-
- if ( FT_NEW_ARRAY( ht->table, sz ) )
- goto Exit;
-
- Exit:
- return error;
- }
-
-
- static void
- hash_free( hashtable* ht,
- FT_Memory memory )
- {
- if ( ht != 0 )
- {
- unsigned int i, sz = ht->size;
- hashnode* bp = ht->table;
-
-
- for ( i = 0; i < sz; i++, bp++ )
- FT_FREE( *bp );
-
- FT_FREE( ht->table );
- }
- }
-
-
- static FT_Error
- hash_insert( char* key,
- size_t data,
- hashtable* ht,
- FT_Memory memory )
- {
- hashnode nn;
- hashnode* bp = hash_bucket( key, ht );
- FT_Error error = FT_Err_Ok;
-
-
- nn = *bp;
- if ( !nn )
- {
- if ( FT_NEW( nn ) )
- goto Exit;
- *bp = nn;
-
- nn->key = key;
- nn->data = data;
-
- if ( ht->used >= ht->limit )
- {
- error = hash_rehash( ht, memory );
- if ( error )
- goto Exit;
- }
- ht->used++;
- }
- else
- nn->data = data;
-
- Exit:
- return error;
- }
-
-
- static hashnode
- hash_lookup( const char* key,
- hashtable* ht )
- {
- hashnode *np = hash_bucket( key, ht );
-
-
- return *np;
- }
-
-
- /*************************************************************************/
- /* */
/* Utility types and functions. */
/* */
/*************************************************************************/
@@ -834,14 +676,6 @@
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- static const unsigned char odigits[32] =
- {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- };
-
static const unsigned char ddigits[32] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03,
@@ -859,81 +693,33 @@
};
- /* Routine to convert an ASCII string into an unsigned long integer. */
+ /* Routine to convert a decimal ASCII string to an unsigned long integer. */
static unsigned long
- _bdf_atoul( char* s,
- char** end,
- unsigned int base )
+ _bdf_atoul( char* s )
{
- unsigned long v;
- const unsigned char* dmap;
+ unsigned long v;
if ( s == 0 || *s == 0 )
return 0;
- /* Make sure the radix is something recognizable. Default to 10. */
- switch ( base )
- {
- case 8:
- dmap = odigits;
- break;
- case 16:
- dmap = hdigits;
- break;
- default:
- base = 10;
- dmap = ddigits;
- break;
- }
-
- /* Check for the special hex prefix. */
- if ( *s == '0' &&
- ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) )
- {
- base = 16;
- dmap = hdigits;
- s += 2;
- }
-
- for ( v = 0; sbitset( dmap, *s ); s++ )
- v = v * base + a2i[(int)*s];
-
- if ( end != 0 )
- *end = s;
+ for ( v = 0; sbitset( ddigits, *s ); s++ )
+ v = v * 10 + a2i[(int)*s];
return v;
}
- /* Routine to convert an ASCII string into a signed long integer. */
+ /* Routine to convert a decimal ASCII string to a signed long integer. */
static long
- _bdf_atol( char* s,
- char** end,
- int base )
+ _bdf_atol( char* s )
{
- long v, neg;
- const unsigned char* dmap;
+ long v, neg;
if ( s == 0 || *s == 0 )
return 0;
- /* Make sure the radix is something recognizable. Default to 10. */
- switch ( base )
- {
- case 8:
- dmap = odigits;
- break;
- case 16:
- dmap = hdigits;
- break;
- default:
- base = 10;
- dmap = ddigits;
- break;
- }
-
/* Check for a minus sign. */
neg = 0;
if ( *s == '-' )
@@ -942,100 +728,40 @@
neg = 1;
}
- /* Check for the special hex prefix. */
- if ( *s == '0' &&
- ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) )
- {
- base = 16;
- dmap = hdigits;
- s += 2;
- }
-
- for ( v = 0; sbitset( dmap, *s ); s++ )
- v = v * base + a2i[(int)*s];
-
- if ( end != 0 )
- *end = s;
+ for ( v = 0; sbitset( ddigits, *s ); s++ )
+ v = v * 10 + a2i[(int)*s];
return ( !neg ) ? v : -v;
}
- /* Routine to convert an ASCII string into an unsigned short integer. */
+ /* Routine to convert a decimal ASCII string to an unsigned short integer. */
static unsigned short
- _bdf_atous( char* s,
- char** end,
- unsigned int base )
+ _bdf_atous( char* s )
{
- unsigned short v;
- const unsigned char* dmap;
+ unsigned short v;
if ( s == 0 || *s == 0 )
return 0;
- /* Make sure the radix is something recognizable. Default to 10. */
- switch ( base )
- {
- case 8:
- dmap = odigits;
- break;
- case 16:
- dmap = hdigits;
- break;
- default:
- base = 10;
- dmap = ddigits;
- break;
- }
-
- /* Check for the special hex prefix. */
- if ( *s == '0' &&
- ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) )
- {
- base = 16;
- dmap = hdigits;
- s += 2;
- }
-
- for ( v = 0; sbitset( dmap, *s ); s++ )
- v = (unsigned short)( v * base + a2i[(int)*s] );
-
- if ( end != 0 )
- *end = s;
+ for ( v = 0; sbitset( ddigits, *s ); s++ )
+ v = (unsigned short)( v * 10 + a2i[(int)*s] );
return v;
}
- /* Routine to convert an ASCII string into a signed short integer. */
+ /* Routine to convert a decimal ASCII string to a signed short integer. */
static short
- _bdf_atos( char* s,
- char** end,
- int base )
+ _bdf_atos( char* s )
{
- short v, neg;
- const unsigned char* dmap;
+ short v, neg;
if ( s == 0 || *s == 0 )
return 0;
- /* Make sure the radix is something recognizable. Default to 10. */
- switch ( base )
- {
- case 8:
- dmap = odigits;
- break;
- case 16:
- dmap = hdigits;
- break;
- default:
- base = 10;
- dmap = ddigits;
- break;
- }
-
/* Check for a minus. */
neg = 0;
if ( *s == '-' )
@@ -1044,20 +770,8 @@
neg = 1;
}
- /* Check for the special hex prefix. */
- if ( *s == '0' &&
- ( *( s + 1 ) == 'x' || *( s + 1 ) == 'X' ) )
- {
- base = 16;
- dmap = hdigits;
- s += 2;
- }
-
- for ( v = 0; sbitset( dmap, *s ); s++ )
- v = (short)( v * base + a2i[(int)*s] );
-
- if ( end != 0 )
- *end = s;
+ for ( v = 0; sbitset( ddigits, *s ); s++ )
+ v = (short)( v * 10 + a2i[(int)*s] );
return (short)( ( !neg ) ? v : -v );
}
@@ -1098,7 +812,7 @@
/* First check whether the property has */
/* already been added or not. If it has, then */
/* simply ignore it. */
- if ( hash_lookup( name, &(font->proptbl) ) )
+ if ( ft_hash_str_lookup( name, &(font->proptbl) ) )
goto Exit;
if ( FT_RENEW_ARRAY( font->user_props,
@@ -1123,7 +837,7 @@
n = _num_bdf_properties + font->nuser_props;
- error = hash_insert( p->name, n, &(font->proptbl), memory );
+ error = ft_hash_str_insert( p->name, n, &(font->proptbl), memory );
if ( error )
goto Exit;
@@ -1134,25 +848,23 @@
}
- FT_LOCAL_DEF( bdf_property_t * )
+ FT_LOCAL_DEF( bdf_property_t* )
bdf_get_property( char* name,
bdf_font_t* font )
{
- hashnode hn;
- size_t propid;
+ size_t* propid;
if ( name == 0 || *name == 0 )
return 0;
- if ( ( hn = hash_lookup( name, &(font->proptbl) ) ) == 0 )
+ if ( ( propid = ft_hash_str_lookup( name, &(font->proptbl) ) ) == NULL )
return 0;
- propid = hn->data;
- if ( propid >= _num_bdf_properties )
- return font->user_props + ( propid - _num_bdf_properties );
+ if ( *propid >= _num_bdf_properties )
+ return font->user_props + ( *propid - _num_bdf_properties );
- return (bdf_property_t*)_bdf_properties + propid;
+ return (bdf_property_t*)_bdf_properties + *propid;
}
@@ -1165,30 +877,30 @@
/* Parse flags. */
-#define _BDF_START 0x0001U
-#define _BDF_FONT_NAME 0x0002U
-#define _BDF_SIZE 0x0004U
-#define _BDF_FONT_BBX 0x0008U
-#define _BDF_PROPS 0x0010U
-#define _BDF_GLYPHS 0x0020U
-#define _BDF_GLYPH 0x0040U
-#define _BDF_ENCODING 0x0080U
-#define _BDF_SWIDTH 0x0100U
-#define _BDF_DWIDTH 0x0200U
-#define _BDF_BBX 0x0400U
-#define _BDF_BITMAP 0x0800U
+#define BDF_START_ 0x0001U
+#define BDF_FONT_NAME_ 0x0002U
+#define BDF_SIZE_ 0x0004U
+#define BDF_FONT_BBX_ 0x0008U
+#define BDF_PROPS_ 0x0010U
+#define BDF_GLYPHS_ 0x0020U
+#define BDF_GLYPH_ 0x0040U
+#define BDF_ENCODING_ 0x0080U
+#define BDF_SWIDTH_ 0x0100U
+#define BDF_DWIDTH_ 0x0200U
+#define BDF_BBX_ 0x0400U
+#define BDF_BITMAP_ 0x0800U
-#define _BDF_SWIDTH_ADJ 0x1000U
+#define BDF_SWIDTH_ADJ_ 0x1000U
-#define _BDF_GLYPH_BITS ( _BDF_GLYPH | \
- _BDF_ENCODING | \
- _BDF_SWIDTH | \
- _BDF_DWIDTH | \
- _BDF_BBX | \
- _BDF_BITMAP )
+#define BDF_GLYPH_BITS_ ( BDF_GLYPH_ | \
+ BDF_ENCODING_ | \
+ BDF_SWIDTH_ | \
+ BDF_DWIDTH_ | \
+ BDF_BBX_ | \
+ BDF_BITMAP_ )
-#define _BDF_GLYPH_WIDTH_CHECK 0x40000000UL
-#define _BDF_GLYPH_HEIGHT_CHECK 0x80000000UL
+#define BDF_GLYPH_WIDTH_CHECK_ 0x40000000UL
+#define BDF_GLYPH_HEIGHT_CHECK_ 0x80000000UL
static FT_Error
@@ -1360,8 +1072,7 @@
char* value,
unsigned long lineno )
{
- size_t propid;
- hashnode hn;
+ size_t* propid;
bdf_property_t *prop, *fp;
FT_Memory memory = font->memory;
FT_Error error = FT_Err_Ok;
@@ -1370,11 +1081,12 @@
/* First, check whether the property already exists in the font. */
- if ( ( hn = hash_lookup( name, (hashtable *)font->internal ) ) != 0 )
+ if ( ( propid = ft_hash_str_lookup( name,
+ (FT_Hash)font->internal ) ) != NULL )
{
/* The property already exists in the font, so simply replace */
/* the value of the property with the current value. */
- fp = font->props + hn->data;
+ fp = font->props + *propid;
switch ( fp->format )
{
@@ -1390,11 +1102,11 @@
break;
case BDF_INTEGER:
- fp->value.l = _bdf_atol( value, 0, 10 );
+ fp->value.l = _bdf_atol( value );
break;
case BDF_CARDINAL:
- fp->value.ul = _bdf_atoul( value, 0, 10 );
+ fp->value.ul = _bdf_atoul( value );
break;
default:
@@ -1406,13 +1118,13 @@
/* See whether this property type exists yet or not. */
/* If not, create it. */
- hn = hash_lookup( name, &(font->proptbl) );
- if ( hn == 0 )
+ propid = ft_hash_str_lookup( name, &(font->proptbl) );
+ if ( propid == NULL )
{
error = bdf_create_property( name, BDF_ATOM, font );
if ( error )
goto Exit;
- hn = hash_lookup( name, &(font->proptbl) );
+ propid = ft_hash_str_lookup( name, &(font->proptbl) );
}
/* Allocate another property if this is overflow. */
@@ -1436,11 +1148,10 @@
font->props_size++;
}
- propid = hn->data;
- if ( propid >= _num_bdf_properties )
- prop = font->user_props + ( propid - _num_bdf_properties );
+ if ( *propid >= _num_bdf_properties )
+ prop = font->user_props + ( *propid - _num_bdf_properties );
else
- prop = (bdf_property_t*)_bdf_properties + propid;
+ prop = (bdf_property_t*)_bdf_properties + *propid;
fp = font->props + font->props_used;
@@ -1460,11 +1171,11 @@
break;
case BDF_INTEGER:
- fp->value.l = _bdf_atol( value, 0, 10 );
+ fp->value.l = _bdf_atol( value );
break;
case BDF_CARDINAL:
- fp->value.ul = _bdf_atoul( value, 0, 10 );
+ fp->value.ul = _bdf_atoul( value );
break;
}
@@ -1473,10 +1184,10 @@
if ( _bdf_strncmp( name, "COMMENT", 7 ) != 0 )
{
/* Add the property to the font property table. */
- error = hash_insert( fp->name,
- font->props_used,
- (hashtable *)font->internal,
- memory );
+ error = ft_hash_str_insert( fp->name,
+ font->props_used,
+ (FT_Hash)font->internal,
+ memory );
if ( error )
goto Exit;
}
@@ -1567,7 +1278,7 @@
}
/* The very first thing expected is the number of glyphs. */
- if ( !( p->flags & _BDF_GLYPHS ) )
+ if ( !( p->flags & BDF_GLYPHS_ ) )
{
if ( _bdf_strncmp( line, "CHARS", 5 ) != 0 )
{
@@ -1579,7 +1290,7 @@
error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error )
goto Exit;
- p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1], 0, 10 );
+ p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1] );
/* We need at least 20 bytes per glyph. */
if ( p->cnt > p->size / 20 )
@@ -1604,7 +1315,7 @@
if ( FT_NEW_ARRAY( font->glyphs, font->glyphs_size ) )
goto Exit;
- p->flags |= _BDF_GLYPHS;
+ p->flags |= BDF_GLYPHS_;
goto Exit;
}
@@ -1612,7 +1323,7 @@
/* Check for the ENDFONT field. */
if ( _bdf_strncmp( line, "ENDFONT", 7 ) == 0 )
{
- if ( p->flags & _BDF_GLYPH_BITS )
+ if ( p->flags & BDF_GLYPH_BITS_ )
{
/* Missing ENDCHAR field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" ));
@@ -1626,7 +1337,7 @@
sizeof ( bdf_glyph_t ),
by_encoding );
- p->flags &= ~_BDF_START;
+ p->flags &= ~BDF_START_;
goto Exit;
}
@@ -1635,14 +1346,14 @@
if ( _bdf_strncmp( line, "ENDCHAR", 7 ) == 0 )
{
p->glyph_enc = 0;
- p->flags &= ~_BDF_GLYPH_BITS;
+ p->flags &= ~BDF_GLYPH_BITS_;
goto Exit;
}
/* Check whether a glyph is being scanned but should be */
/* ignored because it is an unencoded glyph. */
- if ( ( p->flags & _BDF_GLYPH ) &&
+ if ( ( p->flags & BDF_GLYPH_ ) &&
p->glyph_enc == -1 &&
p->opts->keep_unencoded == 0 )
goto Exit;
@@ -1650,7 +1361,7 @@
/* Check for the STARTCHAR field. */
if ( _bdf_strncmp( line, "STARTCHAR", 9 ) == 0 )
{
- if ( p->flags & _BDF_GLYPH_BITS )
+ if ( p->flags & BDF_GLYPH_BITS_ )
{
/* Missing ENDCHAR field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" ));
@@ -1682,7 +1393,7 @@
FT_MEM_COPY( p->glyph_name, s, slen + 1 );
- p->flags |= _BDF_GLYPH;
+ p->flags |= BDF_GLYPH_;
FT_TRACE4(( DBGMSG1, lineno, s ));
@@ -1692,7 +1403,7 @@
/* Check for the ENCODING field. */
if ( _bdf_strncmp( line, "ENCODING", 8 ) == 0 )
{
- if ( !( p->flags & _BDF_GLYPH ) )
+ if ( !( p->flags & BDF_GLYPH_ ) )
{
/* Missing STARTCHAR field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "STARTCHAR" ));
@@ -1704,7 +1415,7 @@
if ( error )
goto Exit;
- p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 );
+ p->glyph_enc = _bdf_atol( p->list.field[1] );
/* Normalize negative encoding values. The specification only */
/* allows -1, but we can be more generous here. */
@@ -1713,7 +1424,7 @@
/* Check for alternative encoding format. */
if ( p->glyph_enc == -1 && p->list.used > 2 )
- p->glyph_enc = _bdf_atol( p->list.field[2], 0, 10 );
+ p->glyph_enc = _bdf_atol( p->list.field[2] );
if ( p->glyph_enc < -1 )
p->glyph_enc = -1;
@@ -1806,9 +1517,9 @@
/* Clear the flags that might be added when width and height are */
/* checked for consistency. */
- p->flags &= ~( _BDF_GLYPH_WIDTH_CHECK | _BDF_GLYPH_HEIGHT_CHECK );
+ p->flags &= ~( BDF_GLYPH_WIDTH_CHECK_ | BDF_GLYPH_HEIGHT_CHECK_ );
- p->flags |= _BDF_ENCODING;
+ p->flags |= BDF_ENCODING_;
goto Exit;
}
@@ -1820,16 +1531,16 @@
glyph = font->glyphs + ( font->glyphs_used - 1 );
/* Check whether a bitmap is being constructed. */
- if ( p->flags & _BDF_BITMAP )
+ if ( p->flags & BDF_BITMAP_ )
{
/* If there are more rows than are specified in the glyph metrics, */
/* ignore the remaining lines. */
if ( p->row >= (unsigned long)glyph->bbx.height )
{
- if ( !( p->flags & _BDF_GLYPH_HEIGHT_CHECK ) )
+ if ( !( p->flags & BDF_GLYPH_HEIGHT_CHECK_ ) )
{
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG13, glyph->encoding ));
- p->flags |= _BDF_GLYPH_HEIGHT_CHECK;
+ p->flags |= BDF_GLYPH_HEIGHT_CHECK_;
font->modified = 1;
}
@@ -1854,10 +1565,10 @@
/* If any line has not enough columns, */
/* indicate they have been padded with zero bits. */
if ( i < nibbles &&
- !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
+ !( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) )
{
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding ));
- p->flags |= _BDF_GLYPH_WIDTH_CHECK;
+ p->flags |= BDF_GLYPH_WIDTH_CHECK_;
font->modified = 1;
}
@@ -1869,10 +1580,10 @@
/* If any line has extra columns, indicate they have been removed. */
if ( i == nibbles &&
sbitset( hdigits, line[nibbles] ) &&
- !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
+ !( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) )
{
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding ));
- p->flags |= _BDF_GLYPH_WIDTH_CHECK;
+ p->flags |= BDF_GLYPH_WIDTH_CHECK_;
font->modified = 1;
}
@@ -1883,15 +1594,15 @@
/* Expect the SWIDTH (scalable width) field next. */
if ( _bdf_strncmp( line, "SWIDTH", 6 ) == 0 )
{
- if ( !( p->flags & _BDF_ENCODING ) )
+ if ( !( p->flags & BDF_ENCODING_ ) )
goto Missing_Encoding;
error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error )
goto Exit;
- glyph->swidth = (unsigned short)_bdf_atoul( p->list.field[1], 0, 10 );
- p->flags |= _BDF_SWIDTH;
+ glyph->swidth = (unsigned short)_bdf_atoul( p->list.field[1] );
+ p->flags |= BDF_SWIDTH_;
goto Exit;
}
@@ -1899,16 +1610,16 @@
/* Expect the DWIDTH (scalable width) field next. */
if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 )
{
- if ( !( p->flags & _BDF_ENCODING ) )
+ if ( !( p->flags & BDF_ENCODING_ ) )
goto Missing_Encoding;
error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error )
goto Exit;
- glyph->dwidth = (unsigned short)_bdf_atoul( p->list.field[1], 0, 10 );
+ glyph->dwidth = (unsigned short)_bdf_atoul( p->list.field[1] );
- if ( !( p->flags & _BDF_SWIDTH ) )
+ if ( !( p->flags & BDF_SWIDTH_ ) )
{
/* Missing SWIDTH field. Emit an auto correction message and set */
/* the scalable width from the device width. */
@@ -1920,24 +1631,24 @@
font->resolution_x ) );
}
- p->flags |= _BDF_DWIDTH;
+ p->flags |= BDF_DWIDTH_;
goto Exit;
}
/* Expect the BBX field next. */
if ( _bdf_strncmp( line, "BBX", 3 ) == 0 )
{
- if ( !( p->flags & _BDF_ENCODING ) )
+ if ( !( p->flags & BDF_ENCODING_ ) )
goto Missing_Encoding;
error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error )
goto Exit;
- glyph->bbx.width = _bdf_atous( p->list.field[1], 0, 10 );
- glyph->bbx.height = _bdf_atous( p->list.field[2], 0, 10 );
- glyph->bbx.x_offset = _bdf_atos( p->list.field[3], 0, 10 );
- glyph->bbx.y_offset = _bdf_atos( p->list.field[4], 0, 10 );
+ glyph->bbx.width = _bdf_atous( p->list.field[1] );
+ glyph->bbx.height = _bdf_atous( p->list.field[2] );
+ glyph->bbx.x_offset = _bdf_atos( p->list.field[3] );
+ glyph->bbx.y_offset = _bdf_atos( p->list.field[4] );
/* Generate the ascent and descent of the character. */
glyph->bbx.ascent = (short)( glyph->bbx.height + glyph->bbx.y_offset );
@@ -1954,7 +1665,7 @@
p->minlb = (short)FT_MIN( glyph->bbx.x_offset, p->minlb );
p->maxlb = (short)FT_MAX( glyph->bbx.x_offset, p->maxlb );
- if ( !( p->flags & _BDF_DWIDTH ) )
+ if ( !( p->flags & BDF_DWIDTH_ ) )
{
/* Missing DWIDTH field. Emit an auto correction message and set */
/* the device width to the glyph width. */
@@ -1983,12 +1694,12 @@
else
_bdf_set_glyph_modified( font->nmod, glyph->encoding );
- p->flags |= _BDF_SWIDTH_ADJ;
+ p->flags |= BDF_SWIDTH_ADJ_;
font->modified = 1;
}
}
- p->flags |= _BDF_BBX;
+ p->flags |= BDF_BBX_;
goto Exit;
}
@@ -1998,7 +1709,7 @@
unsigned long bitmap_size;
- if ( !( p->flags & _BDF_BBX ) )
+ if ( !( p->flags & BDF_BBX_ ) )
{
/* Missing BBX field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "BBX" ));
@@ -2023,7 +1734,7 @@
goto Exit;
p->row = 0;
- p->flags |= _BDF_BITMAP;
+ p->flags |= BDF_BITMAP_;
goto Exit;
}
@@ -2038,7 +1749,7 @@
error = FT_THROW( Missing_Encoding_Field );
Exit:
- if ( error && ( p->flags & _BDF_GLYPH ) )
+ if ( error && ( p->flags & BDF_GLYPH_ ) )
FT_FREE( p->glyph_name );
return error;
@@ -2102,7 +1813,7 @@
p->font->modified = 1;
}
- p->flags &= ~_BDF_PROPS;
+ p->flags &= ~BDF_PROPS_;
*next = _bdf_parse_glyphs;
goto Exit;
@@ -2200,7 +1911,7 @@
goto Exit;
}
- if ( !( p->flags & _BDF_START ) )
+ if ( !( p->flags & BDF_START_ ) )
{
memory = p->memory;
@@ -2212,7 +1923,7 @@
goto Exit;
}
- p->flags = _BDF_START;
+ p->flags = BDF_START_;
font = p->font = 0;
if ( FT_NEW( font ) )
@@ -2227,22 +1938,22 @@
bdf_property_t* prop;
- error = hash_init( &(font->proptbl), memory );
+ error = ft_hash_str_init( &(font->proptbl), memory );
if ( error )
goto Exit;
for ( i = 0, prop = (bdf_property_t*)_bdf_properties;
i < _num_bdf_properties; i++, prop++ )
{
- error = hash_insert( prop->name, i,
- &(font->proptbl), memory );
+ error = ft_hash_str_insert( prop->name, i,
+ &(font->proptbl), memory );
if ( error )
goto Exit;
}
}
- if ( FT_ALLOC( p->font->internal, sizeof ( hashtable ) ) )
+ if ( FT_ALLOC( p->font->internal, sizeof ( FT_HashRec ) ) )
goto Exit;
- error = hash_init( (hashtable *)p->font->internal,memory );
+ error = ft_hash_str_init( (FT_Hash)p->font->internal, memory );
if ( error )
goto Exit;
p->font->spacing = p->opts->font_spacing;
@@ -2254,7 +1965,7 @@
/* Check for the start of the properties. */
if ( _bdf_strncmp( line, "STARTPROPERTIES", 15 ) == 0 )
{
- if ( !( p->flags & _BDF_FONT_BBX ) )
+ if ( !( p->flags & BDF_FONT_BBX_ ) )
{
/* Missing the FONTBOUNDINGBOX field. */
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
@@ -2266,7 +1977,7 @@
if ( error )
goto Exit;
/* at this point, `p->font' can't be NULL */
- p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1], 0, 10 );
+ p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1] );
if ( FT_NEW_ARRAY( p->font->props, p->cnt ) )
{
@@ -2274,7 +1985,7 @@
goto Exit;
}
- p->flags |= _BDF_PROPS;
+ p->flags |= BDF_PROPS_;
*next = _bdf_parse_properties;
goto Exit;
@@ -2283,7 +1994,7 @@
/* Check for the FONTBOUNDINGBOX field. */
if ( _bdf_strncmp( line, "FONTBOUNDINGBOX", 15 ) == 0 )
{
- if ( !( p->flags & _BDF_SIZE ) )
+ if ( !( p->flags & BDF_SIZE_ ) )
{
/* Missing the SIZE field. */
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "SIZE" ));
@@ -2295,18 +2006,18 @@
if ( error )
goto Exit;
- p->font->bbx.width = _bdf_atous( p->list.field[1], 0, 10 );
- p->font->bbx.height = _bdf_atous( p->list.field[2], 0, 10 );
+ p->font->bbx.width = _bdf_atous( p->list.field[1] );
+ p->font->bbx.height = _bdf_atous( p->list.field[2] );
- p->font->bbx.x_offset = _bdf_atos( p->list.field[3], 0, 10 );
- p->font->bbx.y_offset = _bdf_atos( p->list.field[4], 0, 10 );
+ p->font->bbx.x_offset = _bdf_atos( p->list.field[3] );
+ p->font->bbx.y_offset = _bdf_atos( p->list.field[4] );
p->font->bbx.ascent = (short)( p->font->bbx.height +
p->font->bbx.y_offset );
p->font->bbx.descent = (short)( -p->font->bbx.y_offset );
- p->flags |= _BDF_FONT_BBX;
+ p->flags |= BDF_FONT_BBX_;
goto Exit;
}
@@ -2341,7 +2052,7 @@
if ( error )
goto Exit;
- p->flags |= _BDF_FONT_NAME;
+ p->flags |= BDF_FONT_NAME_;
goto Exit;
}
@@ -2349,7 +2060,7 @@
/* Check for the SIZE field. */
if ( _bdf_strncmp( line, "SIZE", 4 ) == 0 )
{
- if ( !( p->flags & _BDF_FONT_NAME ) )
+ if ( !( p->flags & BDF_FONT_NAME_ ) )
{
/* Missing the FONT field. */
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONT" ));
@@ -2361,9 +2072,9 @@
if ( error )
goto Exit;
- p->font->point_size = _bdf_atoul( p->list.field[1], 0, 10 );
- p->font->resolution_x = _bdf_atoul( p->list.field[2], 0, 10 );
- p->font->resolution_y = _bdf_atoul( p->list.field[3], 0, 10 );
+ p->font->point_size = _bdf_atoul( p->list.field[1] );
+ p->font->resolution_x = _bdf_atoul( p->list.field[2] );
+ p->font->resolution_y = _bdf_atoul( p->list.field[3] );
/* Check for the bits per pixel field. */
if ( p->list.used == 5 )
@@ -2371,7 +2082,7 @@
unsigned short bpp;
- bpp = (unsigned short)_bdf_atos( p->list.field[4], 0, 10 );
+ bpp = (unsigned short)_bdf_atos( p->list.field[4] );
/* Only values 1, 2, 4, 8 are allowed for greymap fonts. */
if ( bpp > 4 )
@@ -2389,7 +2100,7 @@
else
p->font->bpp = 1;
- p->flags |= _BDF_SIZE;
+ p->flags |= BDF_SIZE_;
goto Exit;
}
@@ -2400,7 +2111,7 @@
char nbuf[128];
- if ( !( p->flags & _BDF_FONT_BBX ) )
+ if ( !( p->flags & BDF_FONT_BBX_ ) )
{
/* Missing the FONTBOUNDINGBOX field. */
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
@@ -2541,15 +2252,15 @@
p->font->bbx.height = (unsigned short)( p->maxas + p->maxds );
}
- if ( p->flags & _BDF_SWIDTH_ADJ )
+ if ( p->flags & BDF_SWIDTH_ADJ_ )
FT_TRACE2(( "bdf_load_font: " ACMSG8 ));
}
}
- if ( p->flags & _BDF_START )
+ if ( p->flags & BDF_START_ )
{
/* The ENDFONT field was never reached or did not exist. */
- if ( !( p->flags & _BDF_GLYPHS ) )
+ if ( !( p->flags & BDF_GLYPHS_ ) )
{
/* Error happened while parsing header. */
FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno ));
@@ -2628,7 +2339,7 @@
/* Free up the internal hash table of property names. */
if ( font->internal )
{
- hash_free( (hashtable *)font->internal, memory );
+ ft_hash_str_free( (FT_Hash)font->internal, memory );
FT_FREE( font->internal );
}
@@ -2673,7 +2384,7 @@
FT_FREE( font->overflow.glyphs );
/* bdf_cleanup */
- hash_free( &(font->proptbl), memory );
+ ft_hash_str_free( &(font->proptbl), memory );
/* Free up the user defined properties. */
for ( prop = font->user_props, i = 0;
@@ -2694,15 +2405,15 @@
bdf_get_font_property( bdf_font_t* font,
const char* name )
{
- hashnode hn;
+ size_t* propid;
if ( font == 0 || font->props_size == 0 || name == 0 || *name == 0 )
return 0;
- hn = hash_lookup( name, (hashtable *)font->internal );
+ propid = ft_hash_str_lookup( name, (FT_Hash)font->internal );
- return hn ? ( font->props + hn->data ) : 0;
+ return propid ? ( font->props + *propid ) : 0;
}