From 7cd606a68db54cfcc4e447398b970e7d3be85f30 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 22 May 2002 05:41:06 +0000 Subject: [PATCH] * include/freetype/config/ftheader.h (FT_BEZIER_H): Removed. (FT_BDF_H): New macro for accessing `ftbdf.h'. * src/type42/t42drivr.c (hexval): Fix typo. --- ChangeLog | 14 +++++++++++--- include/freetype/config/ftheader.h | 20 ++++++++++---------- include/freetype/ftbdf.h | 29 ++++++++++++++++++++++++++--- src/base/ftbdf.c | 27 +++++++++++++++++++++++++-- src/bdf/bdfdrivr.c | 30 +++++++++++++++--------------- src/bdf/bdflib.c | 26 +++++++++++++------------- src/type42/t42drivr.c | 2 +- 7 files changed, 101 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5558a7b5a..4735fcfe0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-05-22 Werner Lemberg + + * include/freetype/config/ftheader.h (FT_BEZIER_H): Removed. + (FT_BDF_H): New macro for accessing `ftbdf.h'. + + * src/type42/t42drivr.c (hexval): Fix typo. + 2002-05-21 Martin Muskens * src/psaux/psobjs.c (T1Radix): New function. @@ -8,12 +15,13 @@ 2002-05-21 David Turner - * src/bdf/bdflic.c: Removed compiler warning, and changed all tables + * src/bdf/bdflib.c: Removed compiler warning, and changed all tables to the "static const" storage specifier (instead of simply `static'). - * src/type42/t32drivr.c, src/bdf/bdfdrivr.c: Removing compiler - warnings. + * src/type42/t42drivr.c (hexval): Use more efficient code. + Removing compiler warnings. + * src/bdf/bdfdrivr.c: Removing compiler warnings. * include/freetype/internal/ftbdf.h, src/base/ftbdf.c, src/base/descrip.mms, src/base/Jamfile, src/base/rules.mk diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index d4936e8d9..0a6788cf2 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -352,38 +352,38 @@ /*************************************************************************/ /* */ /* @macro: */ - /* FT_GLYPH_H */ + /* FT_BDF_H */ /* */ /* @description: */ /* A macro used in #include statements to name the file containing */ - /* the API of the optional glyph management component. */ + /* the definitions of an API to access BDF-specific strings from a */ + /* face. */ /* */ -#define FT_GLYPH_H +#define FT_BDF_H /*************************************************************************/ /* */ /* @macro: */ - /* FT_BBOX_H */ + /* FT_GLYPH_H */ /* */ /* @description: */ /* A macro used in #include statements to name the file containing */ - /* the API of the optional exact bounding box computation routines. */ + /* the API of the optional glyph management component. */ /* */ -#define FT_BBOX_H +#define FT_GLYPH_H /*************************************************************************/ /* */ /* @macro: */ - /* FT_BEZIER_H */ + /* FT_BBOX_H */ /* */ /* @description: */ /* A macro used in #include statements to name the file containing */ - /* a small useful API to handle bezier arcs. Note that you _must_ */ - /* include FT_FREETYPE_H or FT_IMAGE_H before this header. */ + /* the API of the optional exact bounding box computation routines. */ /* */ -#define FT_BEZIER_H +#define FT_BBOX_H /*************************************************************************/ diff --git a/include/freetype/ftbdf.h b/include/freetype/ftbdf.h index 8dfb9fc24..2e25c2d50 100644 --- a/include/freetype/ftbdf.h +++ b/include/freetype/ftbdf.h @@ -1,11 +1,31 @@ -#ifndef __FT_BDF_H__ -#define __FT_BDF_H__ +/***************************************************************************/ +/* */ +/* ftbdf.h */ +/* */ +/* FreeType API for accessing BDF-specific strings (specification). */ +/* */ +/* Copyright 2002 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 __FTBDF_H__ +#define __FTBDF_H__ #include #include FT_FREETYPE_H + FT_BEGIN_HEADER + FT_EXPORT( FT_Error ) FT_Get_BDF_Charset_ID( FT_Face face, const char* *acharset_encoding, @@ -13,4 +33,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* __FT_BDF_H__ */ +#endif /* __FTBDF_H__ */ + + +/* END */ diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c index 558970c35..04579554b 100644 --- a/src/base/ftbdf.c +++ b/src/base/ftbdf.c @@ -1,3 +1,21 @@ +/***************************************************************************/ +/* */ +/* ftbdf.c */ +/* */ +/* FreeType API for accessing BDF-specific strings (body). */ +/* */ +/* Copyright 2002 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 #include FT_INTERNAL_BDF_TYPES_H #include FT_INTERNAL_OBJECTS_H @@ -19,11 +37,13 @@ { FT_Module driver = (FT_Module) face->driver; - if ( driver->clazz && driver->clazz->module_name && + + if ( driver->clazz && driver->clazz->module_name && ft_strcmp( driver->clazz->module_name, "bdf" ) == 0 ) { - BDF_Public_Face bdf_face = (BDF_Public_Face) face; + BDF_Public_Face bdf_face = (BDF_Public_Face)face; + encoding = (const char*) bdf_face->charset_encoding; registry = (const char*) bdf_face->charset_registry; error = 0; @@ -38,3 +58,6 @@ return error; } + + +/* END */ diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index 3c8985038..ae3ba5b79 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -194,18 +194,18 @@ THE SOFTWARE. xres->value.int32, yres->value.int32 )); root->available_sizes->width = - (FT_Short)( prop->value.int32 * 75 / xres->value.int32 ); + (FT_Short)( prop->value.int32 * 75 / xres->value.int32 ); root->available_sizes->height = - (FT_Short)( prop->value.int32 * 75 / yres->value.int32 ); + (FT_Short)( prop->value.int32 * 75 / yres->value.int32 ); } } else { /* some fonts have broken SIZE declaration (jiskan24.bdf) */ FT_ERROR(( "BDF_Face_Init: reading size\n" )); - root->available_sizes->width = (FT_Short) font->point_size ; - root->available_sizes->height = (FT_Short) font->point_size ; + root->available_sizes->width = (FT_Short)font->point_size ; + root->available_sizes->height = (FT_Short)font->point_size ; } /* encoding table */ @@ -221,7 +221,7 @@ THE SOFTWARE. { (face->en_table[n]).enc = cur[n].encoding; FT_TRACE4(( "idx %d, val 0x%lX\n", n, cur[n].encoding )); - (face->en_table[n]).glyph = (FT_Short) n; + (face->en_table[n]).glyph = (FT_Short)n; } } @@ -367,10 +367,10 @@ THE SOFTWARE. /* get the full bytes */ for ( j = 0; j < ( bitmap->width >> 2 ); j++ ) { - bitmap->buffer[count++] = (FT_Byte)(( *pp & 0xC0 ) >> 6); - bitmap->buffer[count++] = (FT_Byte)(( *pp & 0x30 ) >> 4); - bitmap->buffer[count++] = (FT_Byte)(( *pp & 0x0C ) >> 2); - bitmap->buffer[count++] = (FT_Byte)( *pp & 0x03 ); + bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xC0 ) >> 6 ); + bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x30 ) >> 4 ); + bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x0C ) >> 2 ); + bitmap->buffer[count++] = (FT_Byte)( *pp & 0x03 ); pp++; } @@ -379,13 +379,13 @@ THE SOFTWARE. switch ( bitmap->width & 3 ) { case 3: - bitmap->buffer[count++] = (FT_Byte)(( *pp & 0xC0 ) >> 6); + bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xC0 ) >> 6 ); /* fall through */ case 2: - bitmap->buffer[count++] = (FT_Byte)(( *pp & 0x30 ) >> 4); + bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x30 ) >> 4 ); /* fall through */ case 1: - bitmap->buffer[count++] = (FT_Byte)(( *pp & 0x0C ) >> 2); + bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x0C ) >> 2 ); /* fall through */ case 0: break; @@ -408,8 +408,8 @@ THE SOFTWARE. /* get the full bytes */ for ( j = 0; j < ( bitmap->width >> 1 ); j++ ) { - bitmap->buffer[count++] = (FT_Byte)(( *pp & 0xF0 ) >> 4); - bitmap->buffer[count++] = (FT_Byte)( *pp & 0x0F ); + bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xF0 ) >> 4 ); + bitmap->buffer[count++] = (FT_Byte)( *pp & 0x0F ); pp++; } @@ -418,7 +418,7 @@ THE SOFTWARE. switch ( bitmap->width & 1 ) { case 1: - bitmap->buffer[count++] = (FT_Byte)(( *pp & 0xF0 ) >> 4); + bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xF0 ) >> 4 ); /* fall through */ case 0: break; diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index 0429f7de1..d45a9ee64 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -928,12 +928,12 @@ } for ( v = 0; isdigok( dmap, *s ); s++ ) - v = (short)(v * base + a2i[(int)*s]); + v = (short)( v * base + a2i[(int)*s] ); if ( end != 0 ) *end = s; - return (short)(( !neg ) ? v : -v ); + return (short)( ( !neg ) ? v : -v ); } @@ -1030,7 +1030,7 @@ 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; } @@ -1217,7 +1217,7 @@ /* Restore the character that was saved before any return can happen. */ if ( hold != -1 ) - *ep = (char) hold; + *ep = (char)hold; /* If the property exists and is not an atom, just return here. */ if ( p && p->format != BDF_ATOM ) @@ -1684,7 +1684,7 @@ for ( i = 0, *bp = 0; i < nibbles; i++ ) { c = line[i]; - *bp = (FT_Byte)(( *bp << 4 ) + a2i[c]); + *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); if ( i + 1 < nibbles && ( i & 1 ) ) *++bp = 0; } @@ -1764,8 +1764,8 @@ glyph->bbx.y_offset = _bdf_atos( p->list.field[4], 0, 10 ); /* Generate the ascent and descent of the character. */ - glyph->bbx.ascent = (short)(glyph->bbx.height + glyph->bbx.y_offset); - glyph->bbx.descent = (short)(-glyph->bbx.y_offset); + glyph->bbx.ascent = (short)( glyph->bbx.height + glyph->bbx.y_offset ); + glyph->bbx.descent = (short)( -glyph->bbx.y_offset ); /* Determine the overall font bounding box as the characters are */ /* loaded so corrections can be done later if indicated. */ @@ -1829,7 +1829,7 @@ /* Allocate enough space for the bitmap. */ glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3; - glyph->bytes = (unsigned short)(glyph->bpr * glyph->bbx.height); + glyph->bytes = (unsigned short)( glyph->bpr * glyph->bbx.height ); if ( FT_NEW_ARRAY( glyph->bitmap, glyph->bytes ) ) goto Exit; @@ -2032,7 +2032,7 @@ error = hash_init( &(font->proptbl), memory ); if ( error ) goto Exit; - for ( i = 0, prop = (bdf_property_t*) _bdf_properties; + for ( i = 0, prop = (bdf_property_t*)_bdf_properties; i < _num_bdf_properties; i++, prop++ ) { error = hash_insert( prop->name, (void *)i, @@ -2200,7 +2200,7 @@ FT_MEM_SET( &p, 0, sizeof ( _bdf_parse_t ) ); - p.opts = (bdf_options_t*)(( opts != 0 ) ? opts : &_bdf_opts); + p.opts = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts ); p.minlb = 32767; p.memory = extmemory; /* only during font creation */ @@ -2236,7 +2236,7 @@ { FT_TRACE2(( "bdf_load_font: " ACMSG3, p.font->bbx.width, p.maxrb - p.minlb )); - p.font->bbx.width = (unsigned short)(p.maxrb - p.minlb); + p.font->bbx.width = (unsigned short)( p.maxrb - p.minlb ); p.font->modified = 1; } @@ -2261,7 +2261,7 @@ FT_TRACE2(( "bdf_load_font: " ACMSG6, p.font->bbx.descent, p.maxds )); p.font->bbx.descent = p.maxds; - p.font->bbx.y_offset = (short)(-p.maxds); + p.font->bbx.y_offset = (short)( -p.maxds ); p.font->modified = 1; } @@ -2269,7 +2269,7 @@ { FT_TRACE2(( "bdf_load_font: " ACMSG7, p.font->bbx.height, p.maxas + p.maxds )); - p.font->bbx.height = (unsigned short)(p.maxas + p.maxds); + p.font->bbx.height = (unsigned short)( p.maxas + p.maxds ); } if ( p.flags & _BDF_SWIDTH_ADJ ) diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c index 5e647923b..e92696d01 100644 --- a/src/type42/t42drivr.c +++ b/src/type42/t42drivr.c @@ -591,7 +591,7 @@ goto Exit; } - d = (FT_UInt)( v - 'A' ); + d = (FT_UInt)( v - 'a' ); if ( d < 6 ) { d += 10;