summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/bdf
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/bdf')
-rw-r--r--src/3rdparty/freetype/src/bdf/Jamfile31
-rw-r--r--src/3rdparty/freetype/src/bdf/README6
-rw-r--r--src/3rdparty/freetype/src/bdf/bdf.c1
-rw-r--r--src/3rdparty/freetype/src/bdf/bdf.h11
-rw-r--r--src/3rdparty/freetype/src/bdf/bdfdrivr.c200
-rw-r--r--src/3rdparty/freetype/src/bdf/bdfdrivr.h3
-rw-r--r--src/3rdparty/freetype/src/bdf/bdferror.h4
-rw-r--r--src/3rdparty/freetype/src/bdf/bdflib.c560
8 files changed, 374 insertions, 442 deletions
diff --git a/src/3rdparty/freetype/src/bdf/Jamfile b/src/3rdparty/freetype/src/bdf/Jamfile
deleted file mode 100644
index a49c7f5d33..0000000000
--- a/src/3rdparty/freetype/src/bdf/Jamfile
+++ /dev/null
@@ -1,31 +0,0 @@
-# FreeType 2 src/bdf Jamfile
-#
-# Copyright (C) 2002-2019 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.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) bdf ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = bdfdrivr
- bdflib
- ;
- }
- else
- {
- _sources = bdf ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/bdf Jamfile
diff --git a/src/3rdparty/freetype/src/bdf/README b/src/3rdparty/freetype/src/bdf/README
index 996ac2d2aa..d7cb8c14ef 100644
--- a/src/3rdparty/freetype/src/bdf/README
+++ b/src/3rdparty/freetype/src/bdf/README
@@ -13,7 +13,7 @@ This code implements a BDF driver for the FreeType library, following the
Adobe Specification V 2.2. The specification of the BDF font format is
available from Adobe's web site:
- https://www.adobe.com/content/dam/acom/en/devnet/font/pdfs/5005.BDF_Spec.pdf
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5005.BDF_Spec.pdf
Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org).
They do not define vertical metrics, because the X Consortium BDF
@@ -23,6 +23,10 @@ specification has removed them.
Encodings
*********
+[This section is out of date, retained for historical reasons. BDF
+ properties can be retrieved with `FT_Get_BDF_Property`, character set ID
+ values with `FT_Get_BDF_Charset_ID`.]
+
The variety of encodings that accompanies bdf fonts appears to encompass the
small set defined in freetype.h. On the other hand, two properties that
specify encoding and registry are usually defined in bdf fonts.
diff --git a/src/3rdparty/freetype/src/bdf/bdf.c b/src/3rdparty/freetype/src/bdf/bdf.c
index e54df6649b..249012e590 100644
--- a/src/3rdparty/freetype/src/bdf/bdf.c
+++ b/src/3rdparty/freetype/src/bdf/bdf.c
@@ -26,7 +26,6 @@ THE SOFTWARE.
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "bdflib.c"
#include "bdfdrivr.c"
diff --git a/src/3rdparty/freetype/src/bdf/bdf.h b/src/3rdparty/freetype/src/bdf/bdf.h
index d9abd2378f..e2cb52c10a 100644
--- a/src/3rdparty/freetype/src/bdf/bdf.h
+++ b/src/3rdparty/freetype/src/bdf/bdf.h
@@ -30,10 +30,9 @@
* Based on bdf.h,v 1.16 2000/03/16 20:08:51 mleisher
*/
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_HASH_H
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/fthash.h>
FT_BEGIN_HEADER
@@ -241,10 +240,6 @@ FT_BEGIN_HEADER
bdf_free_font( bdf_font_t* font );
FT_LOCAL( bdf_property_t * )
- bdf_get_property( char* name,
- bdf_font_t* font );
-
- FT_LOCAL( bdf_property_t * )
bdf_get_font_property( bdf_font_t* font,
const char* name );
diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.c b/src/3rdparty/freetype/src/bdf/bdfdrivr.c
index 60eb93305e..e02a160930 100644
--- a/src/3rdparty/freetype/src/bdf/bdfdrivr.c
+++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.c
@@ -24,16 +24,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_BDF_H
-#include FT_TRUETYPE_IDS_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/ftbdf.h>
+#include <freetype/ttnameid.h>
-#include FT_SERVICE_BDF_H
-#include FT_SERVICE_FONT_FORMAT_H
+#include <freetype/internal/services/svbdf.h>
+#include <freetype/internal/services/svfntfmt.h>
#include "bdf.h"
#include "bdfdrivr.h"
@@ -93,24 +92,18 @@ THE SOFTWARE.
{
BDF_CMap cmap = (BDF_CMap)bdfcmap;
BDF_encoding_el* encodings = cmap->encodings;
- FT_ULong min, max, mid; /* num_encodings */
FT_UShort result = 0; /* encodings->glyph */
+ FT_ULong min = 0;
+ FT_ULong max = cmap->num_encodings;
+ FT_ULong mid = ( min + max ) >> 1;
- min = 0;
- max = cmap->num_encodings;
- mid = ( min + max ) >> 1;
while ( min < max )
{
- FT_ULong code;
+ FT_ULong code = encodings[mid].enc;
- if ( mid >= max || mid < min )
- mid = ( min + max ) >> 1;
-
- code = encodings[mid].enc;
-
if ( charcode == code )
{
/* increase glyph index by 1 -- */
@@ -124,8 +117,10 @@ THE SOFTWARE.
else
min = mid + 1;
- /* prediction in a continuous block */
+ /* reasonable prediction in a continuous block */
mid += charcode - code;
+ if ( mid >= max || mid < min )
+ mid = ( min + max ) >> 1;
}
return result;
@@ -138,24 +133,18 @@ THE SOFTWARE.
{
BDF_CMap cmap = (BDF_CMap)bdfcmap;
BDF_encoding_el* encodings = cmap->encodings;
- FT_ULong min, max, mid; /* num_encodings */
FT_UShort result = 0; /* encodings->glyph */
FT_ULong charcode = *acharcode + 1;
+ FT_ULong min = 0;
+ FT_ULong max = cmap->num_encodings;
+ FT_ULong mid = ( min + max ) >> 1;
- min = 0;
- max = cmap->num_encodings;
- mid = ( min + max ) >> 1;
while ( min < max )
{
- FT_ULong code; /* same as BDF_encoding_el.enc */
-
-
- if ( mid >= max || mid < min )
- mid = ( min + max ) >> 1;
+ FT_ULong code = encodings[mid].enc;
- code = encodings[mid].enc;
if ( charcode == code )
{
@@ -172,6 +161,8 @@ THE SOFTWARE.
/* prediction in a continuous block */
mid += charcode - code;
+ if ( mid >= max || mid < min )
+ mid = ( min + max ) >> 1;
}
charcode = 0;
@@ -184,7 +175,8 @@ THE SOFTWARE.
Exit:
if ( charcode > 0xFFFFFFFFUL )
{
- FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%x > 32bit API" ));
+ FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%lx > 32bit API",
+ charcode ));
*acharcode = 0;
/* XXX: result should be changed to indicate an overflow error */
}
@@ -276,7 +268,7 @@ THE SOFTWARE.
char* s;
- if ( FT_ALLOC( face->style_name, len ) )
+ if ( FT_QALLOC( face->style_name, len ) )
return error;
s = face->style_name;
@@ -319,9 +311,9 @@ THE SOFTWARE.
FT_CALLBACK_DEF( void )
- BDF_Face_Done( FT_Face bdfface ) /* BDF_Face */
+ BDF_Face_Done( FT_Face face ) /* BDF_Face */
{
- BDF_Face face = (BDF_Face)bdfface;
+ BDF_Face bdfface = (BDF_Face)face;
FT_Memory memory;
@@ -330,31 +322,31 @@ THE SOFTWARE.
memory = FT_FACE_MEMORY( face );
- bdf_free_font( face->bdffont );
+ bdf_free_font( bdfface->bdffont );
- FT_FREE( face->en_table );
+ FT_FREE( bdfface->en_table );
- FT_FREE( face->charset_encoding );
- FT_FREE( face->charset_registry );
- FT_FREE( bdfface->family_name );
- FT_FREE( bdfface->style_name );
+ FT_FREE( bdfface->charset_encoding );
+ FT_FREE( bdfface->charset_registry );
+ FT_FREE( face->family_name );
+ FT_FREE( face->style_name );
- FT_FREE( bdfface->available_sizes );
+ FT_FREE( face->available_sizes );
- FT_FREE( face->bdffont );
+ FT_FREE( bdfface->bdffont );
}
FT_CALLBACK_DEF( FT_Error )
BDF_Face_Init( FT_Stream stream,
- FT_Face bdfface, /* BDF_Face */
+ FT_Face face, /* BDF_Face */
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
- FT_Error error = FT_Err_Ok;
- BDF_Face face = (BDF_Face)bdfface;
- FT_Memory memory = FT_FACE_MEMORY( face );
+ FT_Error error = FT_Err_Ok;
+ BDF_Face bdfface = (BDF_Face)face;
+ FT_Memory memory = FT_FACE_MEMORY( face );
bdf_font_t* font = NULL;
bdf_options_t options;
@@ -383,7 +375,7 @@ THE SOFTWARE.
goto Exit;
/* we have a bdf font: let's construct the face object */
- face->bdffont = font;
+ bdfface->bdffont = font;
/* BDF cannot have multiple faces in a single font file.
* XXX: non-zero face_index is already invalid argument, but
@@ -394,7 +386,7 @@ THE SOFTWARE.
if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 )
{
FT_ERROR(( "BDF_Face_Init: invalid face index\n" ));
- BDF_Face_Done( bdfface );
+ BDF_Face_Done( face );
return FT_THROW( Invalid_Argument );
}
@@ -402,25 +394,25 @@ THE SOFTWARE.
bdf_property_t* prop = NULL;
- FT_TRACE4(( " number of glyphs: allocated %d (used %d)\n",
+ FT_TRACE4(( " number of glyphs: allocated %ld (used %ld)\n",
font->glyphs_size,
font->glyphs_used ));
- FT_TRACE4(( " number of unencoded glyphs: allocated %d (used %d)\n",
+ FT_TRACE4(( " number of unencoded glyphs: allocated %ld (used %ld)\n",
font->unencoded_size,
font->unencoded_used ));
- bdfface->num_faces = 1;
- bdfface->face_index = 0;
+ face->num_faces = 1;
+ face->face_index = 0;
- bdfface->face_flags |= FT_FACE_FLAG_FIXED_SIZES |
- FT_FACE_FLAG_HORIZONTAL;
+ face->face_flags |= FT_FACE_FLAG_FIXED_SIZES |
+ FT_FACE_FLAG_HORIZONTAL;
prop = bdf_get_font_property( font, "SPACING" );
if ( prop && prop->format == BDF_ATOM &&
prop->value.atom &&
( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' ||
*(prop->value.atom) == 'C' || *(prop->value.atom) == 'c' ) )
- bdfface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
+ face->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */
/* FZ XXX: I need a font to implement this */
@@ -428,42 +420,41 @@ THE SOFTWARE.
prop = bdf_get_font_property( font, "FAMILY_NAME" );
if ( prop && prop->value.atom )
{
- if ( FT_STRDUP( bdfface->family_name, prop->value.atom ) )
+ if ( FT_STRDUP( face->family_name, prop->value.atom ) )
goto Exit;
}
else
- bdfface->family_name = NULL;
+ face->family_name = NULL;
- if ( FT_SET_ERROR( bdf_interpret_style( face ) ) )
+ if ( FT_SET_ERROR( bdf_interpret_style( bdfface ) ) )
goto Exit;
/* the number of glyphs (with one slot for the undefined glyph */
/* at position 0 and all unencoded glyphs) */
- bdfface->num_glyphs = (FT_Long)( font->glyphs_size + 1 );
+ face->num_glyphs = (FT_Long)( font->glyphs_size + 1 );
- bdfface->num_fixed_sizes = 1;
- if ( FT_NEW_ARRAY( bdfface->available_sizes, 1 ) )
+ face->num_fixed_sizes = 1;
+ if ( FT_NEW( face->available_sizes ) )
goto Exit;
{
- FT_Bitmap_Size* bsize = bdfface->available_sizes;
- FT_Short resolution_x = 0, resolution_y = 0;
+ FT_Bitmap_Size* bsize = face->available_sizes;
+ FT_Short resolution_x = 0;
+ FT_Short resolution_y = 0;
long value;
- FT_ZERO( bsize );
-
/* sanity checks */
if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
{
font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %ld\n",
font->font_ascent ));
}
if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF )
{
font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %ld\n",
font->font_descent ));
}
@@ -489,7 +480,7 @@ THE SOFTWARE.
else
{
/* this is a heuristical value */
- bsize->width = (FT_Short)FT_MulDiv( bsize->height, 2, 3 );
+ bsize->width = ( bsize->height * 2 + 1 ) / 3;
}
prop = bdf_get_font_property( font, "POINT_SIZE" );
@@ -504,7 +495,7 @@ THE SOFTWARE.
prop->value.l < -0x504C2L )
{
bsize->size = 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n",
bsize->size ));
}
else
@@ -517,7 +508,7 @@ THE SOFTWARE.
if ( font->point_size > 0x7FFF )
{
bsize->size = 0x7FFF;
- FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n",
bsize->size ));
}
else
@@ -539,7 +530,7 @@ THE SOFTWARE.
if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF )
{
bsize->y_ppem = 0x7FFF << 6;
- FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n",
+ FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %ld\n",
bsize->y_ppem ));
}
else
@@ -608,23 +599,23 @@ THE SOFTWARE.
unsigned long n;
- if ( FT_NEW_ARRAY( face->en_table, font->glyphs_size ) )
+ if ( FT_QNEW_ARRAY( bdfface->en_table, font->glyphs_size ) )
goto Exit;
- face->default_glyph = 0;
+ bdfface->default_glyph = 0;
for ( n = 0; n < font->glyphs_size; n++ )
{
- (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_UShort)n;
+ (bdfface->en_table[n]).enc = cur[n].encoding;
+ FT_TRACE4(( " idx %ld, val 0x%lX\n", n, cur[n].encoding ));
+ (bdfface->en_table[n]).glyph = (FT_UShort)n;
if ( cur[n].encoding == font->default_char )
{
if ( n < FT_UINT_MAX )
- face->default_glyph = (FT_UInt)n;
+ bdfface->default_glyph = (FT_UInt)n;
else
FT_TRACE1(( "BDF_Face_Init:"
- " idx %d is too large for this system\n", n ));
+ " idx %ld is too large for this system\n", n ));
}
}
}
@@ -649,27 +640,27 @@ THE SOFTWARE.
const char* s;
- if ( FT_STRDUP( face->charset_encoding,
+ if ( FT_STRDUP( bdfface->charset_encoding,
charset_encoding->value.atom ) ||
- FT_STRDUP( face->charset_registry,
+ FT_STRDUP( bdfface->charset_registry,
charset_registry->value.atom ) )
goto Exit;
/* Uh, oh, compare first letters manually to avoid dependency */
/* on locales. */
- s = face->charset_registry;
+ s = bdfface->charset_registry;
if ( ( s[0] == 'i' || s[0] == 'I' ) &&
( s[1] == 's' || s[1] == 'S' ) &&
( s[2] == 'o' || s[2] == 'O' ) )
{
s += 3;
- if ( !ft_strcmp( s, "10646" ) ||
- ( !ft_strcmp( s, "8859" ) &&
- !ft_strcmp( face->charset_encoding, "1" ) ) )
+ if ( !ft_strcmp( s, "10646" ) ||
+ ( !ft_strcmp( s, "8859" ) &&
+ !ft_strcmp( bdfface->charset_encoding, "1" ) ) )
unicode_charmap = 1;
/* another name for ASCII */
- else if ( !ft_strcmp( s, "646.1991" ) &&
- !ft_strcmp( face->charset_encoding, "IRV" ) )
+ else if ( !ft_strcmp( s, "646.1991" ) &&
+ !ft_strcmp( bdfface->charset_encoding, "IRV" ) )
unicode_charmap = 1;
}
@@ -677,7 +668,7 @@ THE SOFTWARE.
FT_CharMapRec charmap;
- charmap.face = FT_FACE( face );
+ charmap.face = face;
charmap.encoding = FT_ENCODING_NONE;
/* initial platform/encoding should indicate unset status? */
charmap.platform_id = TT_PLATFORM_APPLE_UNICODE;
@@ -703,7 +694,7 @@ THE SOFTWARE.
FT_CharMapRec charmap;
- charmap.face = FT_FACE( face );
+ charmap.face = face;
charmap.encoding = FT_ENCODING_ADOBE_STANDARD;
charmap.platform_id = TT_PLATFORM_ADOBE;
charmap.encoding_id = TT_ADOBE_ID_STANDARD;
@@ -711,8 +702,8 @@ THE SOFTWARE.
error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );
/* Select default charmap */
- if ( bdfface->num_charmaps )
- bdfface->charmap = bdfface->charmaps[0];
+ if ( face->num_charmaps )
+ face->charmap = face->charmaps[0];
}
}
}
@@ -721,7 +712,7 @@ THE SOFTWARE.
return error;
Fail:
- BDF_Face_Done( bdfface );
+ BDF_Face_Done( face );
return FT_THROW( Unknown_File_Format );
}
@@ -825,7 +816,7 @@ THE SOFTWARE.
bitmap->rows = glyph.bbx.height;
bitmap->width = glyph.bbx.width;
if ( glyph.bpr > FT_INT_MAX )
- FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n",
+ FT_TRACE1(( "BDF_Glyph_Load: too large pitch %ld is truncated\n",
glyph.bpr ));
bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */
@@ -878,17 +869,18 @@ THE SOFTWARE.
*
*/
- static FT_Error
- bdf_get_bdf_property( BDF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ bdf_get_bdf_property( FT_Face face, /* BDF_Face */
const char* prop_name,
BDF_PropertyRec *aproperty )
{
+ BDF_Face bdfface = (BDF_Face)face;
bdf_property_t* prop;
- FT_ASSERT( face && face->bdffont );
+ FT_ASSERT( bdfface && bdfface->bdffont );
- prop = bdf_get_font_property( face->bdffont, prop_name );
+ prop = bdf_get_font_property( bdfface->bdffont, prop_name );
if ( prop )
{
switch ( prop->format )
@@ -902,7 +894,8 @@ THE SOFTWARE.
if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
{
FT_TRACE1(( "bdf_get_bdf_property:"
- " too large integer 0x%x is truncated\n" ));
+ " too large integer 0x%lx is truncated\n",
+ prop->value.l ));
}
aproperty->type = BDF_PROPERTY_TYPE_INTEGER;
aproperty->u.integer = (FT_Int32)prop->value.l;
@@ -912,7 +905,8 @@ THE SOFTWARE.
if ( prop->value.ul > 0xFFFFFFFFUL )
{
FT_TRACE1(( "bdf_get_bdf_property:"
- " too large cardinal 0x%x is truncated\n" ));
+ " too large cardinal 0x%lx is truncated\n",
+ prop->value.ul ));
}
aproperty->type = BDF_PROPERTY_TYPE_CARDINAL;
aproperty->u.cardinal = (FT_UInt32)prop->value.ul;
@@ -929,13 +923,16 @@ THE SOFTWARE.
}
- static FT_Error
- bdf_get_charset_id( BDF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ bdf_get_charset_id( FT_Face face, /* BDF_Face */
const char* *acharset_encoding,
const char* *acharset_registry )
{
- *acharset_encoding = face->charset_encoding;
- *acharset_registry = face->charset_registry;
+ BDF_Face bdfface = (BDF_Face)face;
+
+
+ *acharset_encoding = bdfface->charset_encoding;
+ *acharset_registry = bdfface->charset_registry;
return 0;
}
@@ -972,7 +969,6 @@ THE SOFTWARE.
}
-
FT_CALLBACK_TABLE_DEF
const FT_Driver_ClassRec bdf_driver_class =
{
diff --git a/src/3rdparty/freetype/src/bdf/bdfdrivr.h b/src/3rdparty/freetype/src/bdf/bdfdrivr.h
index b37b84ea31..54aaa3353c 100644
--- a/src/3rdparty/freetype/src/bdf/bdfdrivr.h
+++ b/src/3rdparty/freetype/src/bdf/bdfdrivr.h
@@ -28,8 +28,7 @@ THE SOFTWARE.
#ifndef BDFDRIVR_H_
#define BDFDRIVR_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
#include "bdf.h"
diff --git a/src/3rdparty/freetype/src/bdf/bdferror.h b/src/3rdparty/freetype/src/bdf/bdferror.h
index dbe41c02ab..c1b5444871 100644
--- a/src/3rdparty/freetype/src/bdf/bdferror.h
+++ b/src/3rdparty/freetype/src/bdf/bdferror.h
@@ -29,7 +29,7 @@
#ifndef BDFERROR_H_
#define BDFERROR_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -37,7 +37,7 @@
#define FT_ERR_PREFIX BDF_Err_
#define FT_ERR_BASE FT_Mod_Err_BDF
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* BDFERROR_H_ */
diff --git a/src/3rdparty/freetype/src/bdf/bdflib.c b/src/3rdparty/freetype/src/bdf/bdflib.c
index 63813f7edc..0fa7e0a8c5 100644
--- a/src/3rdparty/freetype/src/bdf/bdflib.c
+++ b/src/3rdparty/freetype/src/bdf/bdflib.c
@@ -31,12 +31,11 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftobjs.h>
#include "bdf.h"
#include "bdferror.h"
@@ -52,6 +51,9 @@
#define FT_COMPONENT bdflib
+#define BUFSIZE 128
+
+
/**************************************************************************
*
* Default BDF font options.
@@ -59,7 +61,7 @@
*/
- static const bdf_options_t _bdf_opts =
+ static const bdf_options_t bdf_opts_ =
{
1, /* Correct metrics. */
1, /* Preserve unencoded glyphs. */
@@ -77,7 +79,7 @@
/* List of most properties that might appear in a font. Doesn't include */
/* the RAW_* and AXIS_* properties in X11R6 polymorphic fonts. */
- static const bdf_property_t _bdf_properties[] =
+ static const bdf_property_t bdf_properties_[] =
{
{ "ADD_STYLE_NAME", BDF_ATOM, 1, { 0 } },
{ "AVERAGE_WIDTH", BDF_INTEGER, 1, { 0 } },
@@ -165,13 +167,13 @@
};
static const unsigned long
- _num_bdf_properties = sizeof ( _bdf_properties ) /
- sizeof ( _bdf_properties[0] );
+ num_bdf_properties_ = sizeof ( bdf_properties_ ) /
+ sizeof ( bdf_properties_[0] );
/* An auxiliary macro to parse properties, to be used in conditionals. */
/* It behaves like `strncmp' but also tests the following character */
- /* whether it is a whitespace or NULL. */
+ /* whether it is a whitespace or null. */
/* `property' is a constant string of length `n' to compare with. */
#define _bdf_strncmp( name, property, n ) \
( ft_strncmp( name, property, n ) || \
@@ -186,12 +188,12 @@
"Added `FONT_ASCENT %hd'.\n"
#define ACMSG2 "FONT_DESCENT property missing. " \
"Added `FONT_DESCENT %hd'.\n"
-#define ACMSG3 "Font width != actual width. Old: %hd New: %hd.\n"
+#define ACMSG3 "Font width != actual width. Old: %d New: %d.\n"
#define ACMSG4 "Font left bearing != actual left bearing. " \
"Old: %hd New: %hd.\n"
#define ACMSG5 "Font ascent != actual ascent. Old: %hd New: %hd.\n"
-#define ACMSG6 "Font descent != actual descent. Old: %hd New: %hd.\n"
-#define ACMSG7 "Font height != actual height. Old: %hd New: %hd.\n"
+#define ACMSG6 "Font descent != actual descent. Old: %d New: %d.\n"
+#define ACMSG7 "Font height != actual height. Old: %d New: %d.\n"
#define ACMSG8 "Glyph scalable width (SWIDTH) adjustments made.\n"
#define ACMSG9 "SWIDTH field missing at line %ld. Set automatically.\n"
#define ACMSG10 "DWIDTH field missing at line %ld. Set to glyph width.\n"
@@ -228,7 +230,7 @@
/* Function type for parsing lines of a BDF font. */
typedef FT_Error
- (*_bdf_line_func_t)( char* line,
+ (*bdf_line_func_t_)( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
@@ -237,19 +239,19 @@
/* List structure for splitting lines into fields. */
- typedef struct _bdf_list_t_
+ typedef struct bdf_list_t__
{
char** field;
unsigned long size;
unsigned long used;
FT_Memory memory;
- } _bdf_list_t;
+ } bdf_list_t_;
/* Structure used while loading BDF fonts. */
- typedef struct _bdf_parse_t_
+ typedef struct bdf_parse_t__
{
unsigned long flags;
unsigned long cnt;
@@ -269,12 +271,12 @@
bdf_font_t* font;
bdf_options_t* opts;
- _bdf_list_t list;
+ bdf_list_t_ list;
FT_Memory memory;
unsigned long size; /* the stream size */
- } _bdf_parse_t;
+ } bdf_parse_t_;
#define setsbit( m, cc ) \
@@ -284,7 +286,7 @@
static void
- _bdf_list_init( _bdf_list_t* list,
+ bdf_list_init_( bdf_list_t_* list,
FT_Memory memory )
{
FT_ZERO( list );
@@ -293,7 +295,7 @@
static void
- _bdf_list_done( _bdf_list_t* list )
+ bdf_list_done_( bdf_list_t_* list )
{
FT_Memory memory = list->memory;
@@ -307,15 +309,15 @@
static FT_Error
- _bdf_list_ensure( _bdf_list_t* list,
- unsigned long num_items ) /* same as _bdf_list_t.used */
+ bdf_list_ensure_( bdf_list_t_* list,
+ unsigned long num_items ) /* same as bdf_list_t_.used */
{
FT_Error error = FT_Err_Ok;
if ( num_items > list->size )
{
- unsigned long oldsize = list->size; /* same as _bdf_list_t.size */
+ unsigned long oldsize = list->size; /* same as bdf_list_t_.size */
unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5;
unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) );
FT_Memory memory = list->memory;
@@ -329,7 +331,7 @@
else if ( newsize < oldsize || newsize > bigsize )
newsize = bigsize;
- if ( FT_RENEW_ARRAY( list->field, oldsize, newsize ) )
+ if ( FT_QRENEW_ARRAY( list->field, oldsize, newsize ) )
goto Exit;
list->size = newsize;
@@ -341,13 +343,13 @@
static void
- _bdf_list_shift( _bdf_list_t* list,
+ bdf_list_shift_( bdf_list_t_* list,
unsigned long n )
{
unsigned long i, u;
- if ( list == 0 || list->used == 0 || n == 0 )
+ if ( list == NULL || list->used == 0 || n == 0 )
return;
if ( n >= list->used )
@@ -368,7 +370,7 @@
static char *
- _bdf_list_join( _bdf_list_t* list,
+ bdf_list_join_( bdf_list_t_* list,
int c,
unsigned long *alen )
{
@@ -378,8 +380,8 @@
*alen = 0;
- if ( list == 0 || list->used == 0 )
- return 0;
+ if ( list == NULL || list->used == 0 )
+ return NULL;
dp = list->field[0];
for ( i = j = 0; i < list->used; i++ )
@@ -406,7 +408,7 @@
/* don't have to check the number of fields in most cases. */
static FT_Error
- _bdf_list_split( _bdf_list_t* list,
+ bdf_list_split_( bdf_list_t_* list,
const char* separators,
char* line,
unsigned long linelen )
@@ -437,7 +439,7 @@
/* In the original code, if the `separators' parameter is NULL or */
/* empty, the list is split into individual bytes. We don't need */
/* this, so an error is signaled. */
- if ( separators == 0 || *separators == 0 )
+ if ( separators == NULL || *separators == 0 )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
@@ -468,7 +470,7 @@
/* Resize the list if necessary. */
if ( list->used == list->size )
{
- error = _bdf_list_ensure( list, list->used + 1 );
+ error = bdf_list_ensure_( list, list->used + 1 );
if ( error )
goto Exit;
}
@@ -497,7 +499,7 @@
/* Finally, NULL-terminate the list. */
if ( list->used + final_empty >= list->size )
{
- error = _bdf_list_ensure( list, list->used + final_empty + 1 );
+ error = bdf_list_ensure_( list, list->used + final_empty + 1 );
if ( error )
goto Exit;
}
@@ -505,7 +507,7 @@
if ( final_empty )
list->field[list->used++] = (char*)empty;
- list->field[list->used] = 0;
+ list->field[list->used] = NULL;
Exit:
return error;
@@ -516,12 +518,12 @@
static FT_Error
- _bdf_readstream( FT_Stream stream,
- _bdf_line_func_t callback,
+ bdf_readstream_( FT_Stream stream,
+ bdf_line_func_t_ callback,
void* client_data,
unsigned long *lno )
{
- _bdf_line_func_t cb;
+ bdf_line_func_t_ cb;
unsigned long lineno, buf_size;
int refill, hold, to_skip;
ptrdiff_t bytes, start, end, cursor, avail;
@@ -530,7 +532,7 @@
FT_Error error = FT_Err_Ok;
- if ( callback == 0 )
+ if ( callback == NULL )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
@@ -539,7 +541,7 @@
/* initial size and allocation of the input buffer */
buf_size = 1024;
- if ( FT_NEW_ARRAY( buf, buf_size ) )
+ if ( FT_QALLOC( buf, buf_size ) )
goto Exit;
cb = callback;
@@ -582,8 +584,14 @@
/* or even resizing it */
if ( end >= avail )
{
- if ( bytes == 0 ) /* last line in file doesn't end in \r or \n */
- break; /* ignore it then exit */
+ if ( bytes == 0 )
+ {
+ /* last line in file doesn't end in \r or \n; */
+ /* ignore it then exit */
+ if ( lineno == 1 )
+ error = FT_THROW( Missing_Startfont_Field );
+ break;
+ }
if ( start == 0 )
{
@@ -594,16 +602,21 @@
if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */
{
- FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno ));
- error = FT_THROW( Invalid_Argument );
+ if ( lineno == 1 )
+ error = FT_THROW( Missing_Startfont_Field );
+ else
+ {
+ FT_ERROR(( "bdf_readstream_: " ERRMSG6, lineno ));
+ error = FT_THROW( Invalid_Argument );
+ }
goto Exit;
}
new_size = buf_size * 2;
- if ( FT_RENEW_ARRAY( buf, buf_size, new_size ) )
+ if ( FT_QREALLOC( buf, buf_size, new_size ) )
goto Exit;
- cursor = (ptrdiff_t)buf_size;
+ cursor = avail;
buf_size = new_size;
}
else
@@ -613,7 +626,6 @@
FT_MEM_MOVE( buf, buf + start, bytes );
cursor = bytes;
- avail -= bytes;
start = 0;
}
refill = 1;
@@ -693,12 +705,12 @@
/* Routine to convert a decimal ASCII string to an unsigned long integer. */
static unsigned long
- _bdf_atoul( const char* s )
+ bdf_atoul_( const char* s )
{
unsigned long v;
- if ( s == 0 || *s == 0 )
+ if ( s == NULL || *s == 0 )
return 0;
for ( v = 0; sbitset( ddigits, *s ); s++ )
@@ -718,12 +730,12 @@
/* Routine to convert a decimal ASCII string to a signed long integer. */
static long
- _bdf_atol( const char* s )
+ bdf_atol_( const char* s )
{
long v, neg;
- if ( s == 0 || *s == 0 )
+ if ( s == NULL || *s == 0 )
return 0;
/* Check for a minus sign. */
@@ -751,12 +763,12 @@
/* Routine to convert a decimal ASCII string to an unsigned short integer. */
static unsigned short
- _bdf_atous( const char* s )
+ bdf_atous_( const char* s )
{
unsigned short v;
- if ( s == 0 || *s == 0 )
+ if ( s == NULL || *s == 0 )
return 0;
for ( v = 0; sbitset( ddigits, *s ); s++ )
@@ -776,12 +788,12 @@
/* Routine to convert a decimal ASCII string to a signed short integer. */
static short
- _bdf_atos( const char* s )
+ bdf_atos_( const char* s )
{
short v, neg;
- if ( s == 0 || *s == 0 )
+ if ( s == NULL || *s == 0 )
return 0;
/* Check for a minus. */
@@ -808,7 +820,7 @@
/* Routine to compare two glyphs by encoding so they can be sorted. */
- static int
+ FT_COMPARE_DEF( int )
by_encoding( const void* a,
const void* b )
{
@@ -845,27 +857,27 @@
if ( ft_hash_str_lookup( name, &(font->proptbl) ) )
goto Exit;
- if ( FT_RENEW_ARRAY( font->user_props,
- font->nuser_props,
- font->nuser_props + 1 ) )
+ if ( FT_QRENEW_ARRAY( font->user_props,
+ font->nuser_props,
+ font->nuser_props + 1 ) )
goto Exit;
p = font->user_props + font->nuser_props;
- FT_ZERO( p );
n = ft_strlen( name ) + 1;
- if ( n > FT_ULONG_MAX )
+ if ( n > FT_LONG_MAX )
return FT_THROW( Invalid_Argument );
- if ( FT_NEW_ARRAY( p->name, n ) )
+ if ( FT_QALLOC( p->name, n ) )
goto Exit;
FT_MEM_COPY( (char *)p->name, name, n );
- p->format = format;
- p->builtin = 0;
+ p->format = format;
+ p->builtin = 0;
+ p->value.atom = NULL; /* nothing is ever stored here */
- n = _num_bdf_properties + font->nuser_props;
+ n = num_bdf_properties_ + font->nuser_props;
error = ft_hash_str_insert( p->name, n, &(font->proptbl), memory );
if ( error )
@@ -878,23 +890,23 @@
}
- FT_LOCAL_DEF( bdf_property_t* )
- bdf_get_property( char* name,
+ static bdf_property_t*
+ bdf_get_property( const char* name,
bdf_font_t* font )
{
size_t* propid;
- if ( name == 0 || *name == 0 )
- return 0;
+ if ( name == NULL || *name == 0 )
+ return NULL;
if ( ( propid = ft_hash_str_lookup( name, &(font->proptbl) ) ) == NULL )
- return 0;
+ return NULL;
- 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;
}
@@ -934,8 +946,8 @@
static FT_Error
- _bdf_add_comment( bdf_font_t* font,
- char* comment,
+ bdf_add_comment_( bdf_font_t* font,
+ const char* comment,
unsigned long len )
{
char* cp;
@@ -943,15 +955,15 @@
FT_Error error = FT_Err_Ok;
- if ( FT_RENEW_ARRAY( font->comments,
- font->comments_len,
- font->comments_len + len + 1 ) )
+ if ( FT_QRENEW_ARRAY( font->comments,
+ font->comments_len,
+ font->comments_len + len + 1 ) )
goto Exit;
cp = font->comments + font->comments_len;
FT_MEM_COPY( cp, comment, len );
- cp[len] = '\n';
+ cp[len] = '\0';
font->comments_len += len + 1;
@@ -963,20 +975,20 @@
/* Set the spacing from the font name if it exists, or set it to the */
/* default specified in the options. */
static FT_Error
- _bdf_set_default_spacing( bdf_font_t* font,
+ bdf_set_default_spacing_( bdf_font_t* font,
bdf_options_t* opts,
unsigned long lineno )
{
size_t len;
char name[256];
- _bdf_list_t list;
+ bdf_list_t_ list;
FT_Memory memory;
FT_Error error = FT_Err_Ok;
FT_UNUSED( lineno ); /* only used in debug mode */
- if ( font == 0 || font->name == 0 || font->name[0] == 0 )
+ if ( font == NULL || font->name == NULL || font->name[0] == 0 )
{
error = FT_THROW( Invalid_Argument );
goto Exit;
@@ -984,7 +996,7 @@
memory = font->memory;
- _bdf_list_init( &list, memory );
+ bdf_list_init_( &list, memory );
font->spacing = opts->font_spacing;
@@ -992,14 +1004,14 @@
/* Limit ourselves to 256 characters in the font name. */
if ( len >= 256 )
{
- FT_ERROR(( "_bdf_set_default_spacing: " ERRMSG7, lineno ));
+ FT_ERROR(( "bdf_set_default_spacing_: " ERRMSG7, lineno ));
error = FT_THROW( Invalid_Argument );
goto Exit;
}
FT_MEM_COPY( name, font->name, len );
- error = _bdf_list_split( &list, "-", name, (unsigned long)len );
+ error = bdf_list_split_( &list, "-", name, (unsigned long)len );
if ( error )
goto Fail;
@@ -1023,7 +1035,7 @@
}
Fail:
- _bdf_list_done( &list );
+ bdf_list_done_( &list );
Exit:
return error;
@@ -1033,7 +1045,7 @@
/* Determine whether the property is an atom or not. If it is, then */
/* clean it up so the double quotes are removed if they exist. */
static int
- _bdf_is_atom( char* line,
+ bdf_is_atom_( char* line,
unsigned long linelen,
char** name,
char** value,
@@ -1044,27 +1056,24 @@
bdf_property_t* p;
- *name = sp = ep = line;
+ sp = ep = line;
while ( *ep && *ep != ' ' && *ep != '\t' )
ep++;
- hold = -1;
- if ( *ep )
- {
- hold = *ep;
- *ep = 0;
- }
+ hold = *ep;
+ *ep = '\0';
p = bdf_get_property( sp, font );
- /* Restore the character that was saved before any return can happen. */
- if ( hold != -1 )
- *ep = (char)hold;
-
/* If the property exists and is not an atom, just return here. */
if ( p && p->format != BDF_ATOM )
+ {
+ *ep = (char)hold; /* Undo NUL-termination. */
return 0;
+ }
+
+ *name = sp;
/* The property is an atom. Trim all leading and trailing whitespace */
/* and double quotes for the atom value. */
@@ -1072,32 +1081,33 @@
ep = line + linelen;
/* Trim the leading whitespace if it exists. */
- if ( *sp )
- *sp++ = 0;
- while ( *sp &&
- ( *sp == ' ' || *sp == '\t' ) )
- sp++;
+ if ( sp < ep )
+ do
+ sp++;
+ while ( *sp == ' ' || *sp == '\t' );
/* Trim the leading double quote if it exists. */
if ( *sp == '"' )
sp++;
+
*value = sp;
/* Trim the trailing whitespace if it exists. */
- while ( ep > sp &&
- ( *( ep - 1 ) == ' ' || *( ep - 1 ) == '\t' ) )
- *--ep = 0;
+ if ( sp < ep )
+ do
+ *ep-- = '\0';
+ while ( *ep == ' ' || *ep == '\t' );
/* Trim the trailing double quote if it exists. */
- if ( ep > sp && *( ep - 1 ) == '"' )
- *--ep = 0;
+ if ( *ep == '"' )
+ *ep = '\0';
return 1;
}
static FT_Error
- _bdf_add_property( bdf_font_t* font,
+ bdf_add_property_( bdf_font_t* font,
const char* name,
char* value,
unsigned long lineno )
@@ -1132,11 +1142,11 @@
break;
case BDF_INTEGER:
- fp->value.l = _bdf_atol( value );
+ fp->value.l = bdf_atol_( value );
break;
case BDF_CARDINAL:
- fp->value.ul = _bdf_atoul( value );
+ fp->value.ul = bdf_atoul_( value );
break;
default:
@@ -1160,28 +1170,18 @@
/* Allocate another property if this is overflowing. */
if ( font->props_used == font->props_size )
{
- if ( font->props_size == 0 )
- {
- if ( FT_NEW_ARRAY( font->props, 1 ) )
- goto Exit;
- }
- else
- {
- if ( FT_RENEW_ARRAY( font->props,
- font->props_size,
- font->props_size + 1 ) )
- goto Exit;
- }
+ if ( FT_QRENEW_ARRAY( font->props,
+ font->props_size,
+ font->props_size + 1 ) )
+ goto Exit;
- fp = font->props + font->props_size;
- FT_ZERO( fp );
font->props_size++;
}
- 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;
@@ -1192,8 +1192,8 @@
switch ( prop->format )
{
case BDF_ATOM:
- fp->value.atom = 0;
- if ( value != 0 && value[0] )
+ fp->value.atom = NULL;
+ if ( value && value[0] )
{
if ( FT_STRDUP( fp->value.atom, value ) )
goto Exit;
@@ -1201,11 +1201,11 @@
break;
case BDF_INTEGER:
- fp->value.l = _bdf_atol( value );
+ fp->value.l = bdf_atol_( value );
break;
case BDF_CARDINAL:
- fp->value.ul = _bdf_atoul( value );
+ fp->value.ul = bdf_atoul_( value );
break;
}
@@ -1239,7 +1239,7 @@
{
if ( !fp->value.atom )
{
- FT_ERROR(( "_bdf_add_property: " ERRMSG8, lineno, "SPACING" ));
+ FT_ERROR(( "bdf_add_property_: " ERRMSG8, lineno, "SPACING" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -1264,7 +1264,7 @@
static FT_Error
- _bdf_parse_end( char* line,
+ bdf_parse_end_( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
@@ -1284,7 +1284,7 @@
/* Actually parse the glyph info and bitmaps. */
static FT_Error
- _bdf_parse_glyphs( char* line,
+ bdf_parse_glyphs_( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
@@ -1295,8 +1295,8 @@
unsigned char* bp;
unsigned long i, slen, nibbles;
- _bdf_line_func_t* next;
- _bdf_parse_t* p;
+ bdf_line_func_t_* next;
+ bdf_parse_t_* p;
bdf_glyph_t* glyph;
bdf_font_t* font;
@@ -1306,8 +1306,8 @@
FT_UNUSED( lineno ); /* only used in debug mode */
- next = (_bdf_line_func_t *)call_data;
- p = (_bdf_parse_t *) client_data;
+ next = (bdf_line_func_t_ *)call_data;
+ p = (bdf_parse_t_ *) client_data;
font = p->font;
memory = font->memory;
@@ -1315,15 +1315,18 @@
/* Check for a comment. */
if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
{
- linelen -= 7;
-
- s = line + 7;
- if ( *s != 0 )
+ if ( p->opts->keep_comments )
{
- s++;
- linelen--;
+ linelen -= 7;
+
+ s = line + 7;
+ if ( *s != 0 )
+ {
+ s++;
+ linelen--;
+ }
+ error = bdf_add_comment_( p->font, s, linelen );
}
- error = _bdf_add_comment( p->font, s, linelen );
goto Exit;
}
@@ -1332,21 +1335,21 @@
{
if ( _bdf_strncmp( line, "CHARS", 5 ) != 0 )
{
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "CHARS" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "CHARS" ));
error = FT_THROW( Missing_Chars_Field );
goto Exit;
}
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1] );
+ 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 )
{
p->cnt = font->glyphs_size = p->size / 20;
- FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG17, p->cnt ));
+ FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG17, p->cnt ));
}
/* Make sure the number of glyphs is non-zero. */
@@ -1357,7 +1360,7 @@
/* number of code points available in Unicode). */
if ( p->cnt >= 0x110000UL )
{
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "CHARS" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "CHARS" ));
error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -1376,7 +1379,7 @@
if ( p->flags & BDF_GLYPH_BITS_ )
{
/* Missing ENDCHAR field. */
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENDCHAR" ));
error = FT_THROW( Corrupted_Font_Glyphs );
goto Exit;
}
@@ -1388,7 +1391,7 @@
by_encoding );
p->flags &= ~BDF_START_;
- *next = _bdf_parse_end;
+ *next = bdf_parse_end_;
goto Exit;
}
@@ -1415,7 +1418,7 @@
if ( p->flags & BDF_GLYPH_BITS_ )
{
/* Missing ENDCHAR field. */
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENDCHAR" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENDCHAR" ));
error = FT_THROW( Missing_Startchar_Field );
goto Exit;
}
@@ -1424,22 +1427,22 @@
/* encoding can be checked for an unencoded character. */
FT_FREE( p->glyph_name );
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- _bdf_list_shift( &p->list, 1 );
+ bdf_list_shift_( &p->list, 1 );
- s = _bdf_list_join( &p->list, ' ', &slen );
+ s = bdf_list_join_( &p->list, ' ', &slen );
if ( !s )
{
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG8, lineno, "STARTCHAR" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG8, lineno, "STARTCHAR" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
- if ( FT_NEW_ARRAY( p->glyph_name, slen + 1 ) )
+ if ( FT_QALLOC( p->glyph_name, slen + 1 ) )
goto Exit;
FT_MEM_COPY( p->glyph_name, s, slen + 1 );
@@ -1457,16 +1460,16 @@
if ( !( p->flags & BDF_GLYPH_ ) )
{
/* Missing STARTCHAR field. */
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "STARTCHAR" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "STARTCHAR" ));
error = FT_THROW( Missing_Startchar_Field );
goto Exit;
}
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- p->glyph_enc = _bdf_atol( p->list.field[1] );
+ 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. */
@@ -1475,7 +1478,7 @@
/* Check for alternative encoding format. */
if ( p->glyph_enc == -1 && p->list.used > 2 )
- p->glyph_enc = _bdf_atol( p->list.field[2] );
+ p->glyph_enc = bdf_atol_( p->list.field[2] );
if ( p->glyph_enc < -1 || p->glyph_enc >= 0x110000L )
p->glyph_enc = -1;
@@ -1507,7 +1510,7 @@
{
/* Unencoded glyph. Check whether it should */
/* be added or not. */
- if ( p->opts->keep_unencoded != 0 )
+ if ( p->opts->keep_unencoded )
{
/* Allocate the next unencoded glyph. */
if ( font->unencoded_used == font->unencoded_size )
@@ -1533,8 +1536,6 @@
/* kept. */
FT_FREE( p->glyph_name );
}
-
- p->glyph_name = NULL;
}
/* Clear the flags that might be added when width and height are */
@@ -1564,7 +1565,7 @@
{
if ( !( p->flags & BDF_GLYPH_HEIGHT_CHECK_ ) )
{
- FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG13, glyph->encoding ));
+ FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG13, glyph->encoding ));
p->flags |= BDF_GLYPH_HEIGHT_CHECK_;
}
@@ -1591,7 +1592,7 @@
if ( i < nibbles &&
!( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) )
{
- FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding ));
+ FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG16, glyph->encoding ));
p->flags |= BDF_GLYPH_WIDTH_CHECK_;
}
@@ -1605,7 +1606,7 @@
sbitset( hdigits, line[nibbles] ) &&
!( p->flags & BDF_GLYPH_WIDTH_CHECK_ ) )
{
- FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding ));
+ FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG14, glyph->encoding ));
p->flags |= BDF_GLYPH_WIDTH_CHECK_;
}
@@ -1616,30 +1617,30 @@
/* Expect the SWIDTH (scalable width) field next. */
if ( _bdf_strncmp( line, "SWIDTH", 6 ) == 0 )
{
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- glyph->swidth = (unsigned short)_bdf_atoul( p->list.field[1] );
+ glyph->swidth = bdf_atous_( p->list.field[1] );
p->flags |= BDF_SWIDTH_;
goto Exit;
}
- /* Expect the DWIDTH (scalable width) field next. */
+ /* Expect the DWIDTH (device width) field next. */
if ( _bdf_strncmp( line, "DWIDTH", 6 ) == 0 )
{
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- glyph->dwidth = (unsigned short)_bdf_atoul( p->list.field[1] );
+ glyph->dwidth = bdf_atous_( p->list.field[1] );
if ( !( p->flags & BDF_SWIDTH_ ) )
{
/* Missing SWIDTH field. Emit an auto correction message and set */
/* the scalable width from the device width. */
- FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG9, lineno ));
+ FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG9, lineno ));
glyph->swidth = (unsigned short)FT_MulDiv(
glyph->dwidth, 72000L,
@@ -1654,14 +1655,14 @@
/* Expect the BBX field next. */
if ( _bdf_strncmp( line, "BBX", 3 ) == 0 )
{
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- 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] );
+ 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 );
@@ -1682,13 +1683,13 @@
{
/* Missing DWIDTH field. Emit an auto correction message and set */
/* the device width to the glyph width. */
- FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG10, lineno ));
+ FT_TRACE2(( "bdf_parse_glyphs_: " ACMSG10, lineno ));
glyph->dwidth = glyph->bbx.width;
}
/* If the BDF_CORRECT_METRICS flag is set, then adjust the SWIDTH */
/* value if necessary. */
- if ( p->opts->correct_metrics != 0 )
+ if ( p->opts->correct_metrics )
{
/* Determine the point size of the glyph. */
unsigned short sw = (unsigned short)FT_MulDiv(
@@ -1718,7 +1719,7 @@
if ( !( p->flags & BDF_BBX_ ) )
{
/* Missing BBX field. */
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "BBX" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "BBX" ));
error = FT_THROW( Missing_Bbx_Field );
goto Exit;
}
@@ -1729,14 +1730,14 @@
bitmap_size = glyph->bpr * glyph->bbx.height;
if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU )
{
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG4, lineno ));
error = FT_THROW( Bbx_Too_Big );
goto Exit;
}
else
glyph->bytes = (unsigned short)bitmap_size;
- if ( FT_NEW_ARRAY( glyph->bitmap, glyph->bytes ) )
+ if ( FT_ALLOC( glyph->bitmap, glyph->bytes ) )
goto Exit;
p->row = 0;
@@ -1745,13 +1746,13 @@
goto Exit;
}
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG9, lineno ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG9, lineno ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
Missing_Encoding:
/* Missing ENCODING field. */
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG1, lineno, "ENCODING" ));
error = FT_THROW( Missing_Encoding_Field );
Exit:
@@ -1764,25 +1765,25 @@
/* Load the font properties. */
static FT_Error
- _bdf_parse_properties( char* line,
+ bdf_parse_properties_( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
void* client_data )
{
unsigned long vlen;
- _bdf_line_func_t* next;
- _bdf_parse_t* p;
+ bdf_line_func_t_* next;
+ bdf_parse_t_* p;
char* name;
char* value;
- char nbuf[128];
+ char nbuf[BUFSIZE];
FT_Error error = FT_Err_Ok;
FT_UNUSED( lineno );
- next = (_bdf_line_func_t *)call_data;
- p = (_bdf_parse_t *) client_data;
+ next = (bdf_line_func_t_ *)call_data;
+ p = (bdf_parse_t_ *) client_data;
/* Check for the end of the properties. */
if ( _bdf_strncmp( line, "ENDPROPERTIES", 13 ) == 0 )
@@ -1796,29 +1797,29 @@
if ( bdf_get_font_property( p->font, "FONT_ASCENT" ) == 0 )
{
p->font->font_ascent = p->font->bbx.ascent;
- ft_sprintf( nbuf, "%hd", p->font->bbx.ascent );
- error = _bdf_add_property( p->font, "FONT_ASCENT",
+ ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.ascent );
+ error = bdf_add_property_( p->font, "FONT_ASCENT",
nbuf, lineno );
if ( error )
goto Exit;
- FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent ));
+ FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent ));
}
if ( bdf_get_font_property( p->font, "FONT_DESCENT" ) == 0 )
{
p->font->font_descent = p->font->bbx.descent;
- ft_sprintf( nbuf, "%hd", p->font->bbx.descent );
- error = _bdf_add_property( p->font, "FONT_DESCENT",
+ ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.descent );
+ error = bdf_add_property_( p->font, "FONT_DESCENT",
nbuf, lineno );
if ( error )
goto Exit;
- FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent ));
+ FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent ));
}
p->flags &= ~BDF_PROPS_;
- *next = _bdf_parse_glyphs;
+ *next = bdf_parse_glyphs_;
goto Exit;
}
@@ -1835,27 +1836,27 @@
value += 7;
if ( *value )
*value++ = 0;
- error = _bdf_add_property( p->font, name, value, lineno );
+ error = bdf_add_property_( p->font, name, value, lineno );
if ( error )
goto Exit;
}
- else if ( _bdf_is_atom( line, linelen, &name, &value, p->font ) )
+ else if ( bdf_is_atom_( line, linelen, &name, &value, p->font ) )
{
- error = _bdf_add_property( p->font, name, value, lineno );
+ error = bdf_add_property_( p->font, name, value, lineno );
if ( error )
goto Exit;
}
else
{
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
name = p->list.field[0];
- _bdf_list_shift( &p->list, 1 );
- value = _bdf_list_join( &p->list, ' ', &vlen );
+ bdf_list_shift_( &p->list, 1 );
+ value = bdf_list_join_( &p->list, ' ', &vlen );
- error = _bdf_add_property( p->font, name, value, lineno );
+ error = bdf_add_property_( p->font, name, value, lineno );
if ( error )
goto Exit;
}
@@ -1867,15 +1868,15 @@
/* Load the font header. */
static FT_Error
- _bdf_parse_start( char* line,
+ bdf_parse_start_( char* line,
unsigned long linelen,
unsigned long lineno,
void* call_data,
void* client_data )
{
unsigned long slen;
- _bdf_line_func_t* next;
- _bdf_parse_t* p;
+ bdf_line_func_t_* next;
+ bdf_parse_t_* p;
bdf_font_t* font;
char *s;
@@ -1885,8 +1886,8 @@
FT_UNUSED( lineno ); /* only used in debug mode */
- next = (_bdf_line_func_t *)call_data;
- p = (_bdf_parse_t *) client_data;
+ next = (bdf_line_func_t_ *)call_data;
+ p = (bdf_parse_t_ *) client_data;
if ( p->font )
memory = p->font->memory;
@@ -1895,7 +1896,7 @@
/* comments before the STARTFONT line for some reason. */
if ( _bdf_strncmp( line, "COMMENT", 7 ) == 0 )
{
- if ( p->opts->keep_comments != 0 && p->font != 0 )
+ if ( p->opts->keep_comments && p->font )
{
linelen -= 7;
@@ -1905,13 +1906,8 @@
s++;
linelen--;
}
-
- error = _bdf_add_comment( p->font, s, linelen );
- if ( error )
- goto Exit;
- /* here font is not defined! */
+ error = bdf_add_comment_( p->font, s, linelen );
}
-
goto Exit;
}
@@ -1928,14 +1924,13 @@
}
p->flags = BDF_START_;
- font = p->font = 0;
+ font = p->font = NULL;
if ( FT_NEW( font ) )
goto Exit;
p->font = font;
font->memory = p->memory;
- p->memory = 0;
{ /* setup */
size_t i;
@@ -1945,8 +1940,8 @@
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++ )
+ for ( i = 0, prop = (bdf_property_t*)bdf_properties_;
+ i < num_bdf_properties_; i++, prop++ )
{
error = ft_hash_str_insert( prop->name, i,
&(font->proptbl), memory );
@@ -1955,7 +1950,7 @@
}
}
- if ( FT_ALLOC( p->font->internal, sizeof ( FT_HashRec ) ) )
+ if ( FT_QALLOC( p->font->internal, sizeof ( FT_HashRec ) ) )
goto Exit;
error = ft_hash_str_init( (FT_Hash)p->font->internal, memory );
if ( error )
@@ -1972,23 +1967,23 @@
if ( !( p->flags & BDF_FONT_BBX_ ) )
{
/* Missing the FONTBOUNDINGBOX field. */
- FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
error = FT_THROW( Missing_Fontboundingbox_Field );
goto Exit;
}
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
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] );
+ p->cnt = p->font->props_size = bdf_atoul_( p->list.field[1] );
/* We need at least 4 bytes per property. */
if ( p->cnt > p->size / 4 )
{
p->font->props_size = 0;
- FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "STARTPROPERTIES" ));
+ FT_ERROR(( "bdf_parse_glyphs_: " ERRMSG5, lineno, "STARTPROPERTIES" ));
error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -2000,7 +1995,7 @@
}
p->flags |= BDF_PROPS_;
- *next = _bdf_parse_properties;
+ *next = bdf_parse_properties_;
goto Exit;
}
@@ -2011,20 +2006,20 @@
if ( !( p->flags & BDF_SIZE_ ) )
{
/* Missing the SIZE field. */
- FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "SIZE" ));
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "SIZE" ));
error = FT_THROW( Missing_Size_Field );
goto Exit;
}
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- p->font->bbx.width = _bdf_atous( p->list.field[1] );
- p->font->bbx.height = _bdf_atous( p->list.field[2] );
+ 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] );
- p->font->bbx.y_offset = _bdf_atos( p->list.field[4] );
+ 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 );
@@ -2039,16 +2034,16 @@
/* The next thing to check for is the FONT field. */
if ( _bdf_strncmp( line, "FONT", 4 ) == 0 )
{
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- _bdf_list_shift( &p->list, 1 );
+ bdf_list_shift_( &p->list, 1 );
- s = _bdf_list_join( &p->list, ' ', &slen );
+ s = bdf_list_join_( &p->list, ' ', &slen );
if ( !s )
{
- FT_ERROR(( "_bdf_parse_start: " ERRMSG8, lineno, "FONT" ));
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG8, lineno, "FONT" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -2056,13 +2051,13 @@
/* Allowing multiple `FONT' lines (which is invalid) doesn't hurt... */
FT_FREE( p->font->name );
- if ( FT_NEW_ARRAY( p->font->name, slen + 1 ) )
+ if ( FT_QALLOC( p->font->name, slen + 1 ) )
goto Exit;
FT_MEM_COPY( p->font->name, s, slen + 1 );
/* If the font name is an XLFD name, set the spacing to the one in */
/* the font name. If there is no spacing fall back on the default. */
- error = _bdf_set_default_spacing( p->font, p->opts, lineno );
+ error = bdf_set_default_spacing_( p->font, p->opts, lineno );
if ( error )
goto Exit;
@@ -2077,18 +2072,18 @@
if ( !( p->flags & BDF_FONT_NAME_ ) )
{
/* Missing the FONT field. */
- FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONT" ));
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONT" ));
error = FT_THROW( Missing_Font_Field );
goto Exit;
}
- error = _bdf_list_split( &p->list, " +", line, linelen );
+ error = bdf_list_split_( &p->list, " +", line, linelen );
if ( error )
goto Exit;
- 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] );
+ 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 )
@@ -2096,7 +2091,7 @@
unsigned short bpp;
- bpp = (unsigned short)_bdf_atos( p->list.field[4] );
+ bpp = bdf_atous_( p->list.field[4] );
/* Only values 1, 2, 4, 8 are allowed for greymap fonts. */
if ( bpp > 4 )
@@ -2109,7 +2104,7 @@
p->font->bpp = 1;
if ( p->font->bpp != bpp )
- FT_TRACE2(( "_bdf_parse_start: " ACMSG11, p->font->bpp ));
+ FT_TRACE2(( "bdf_parse_start_: " ACMSG11, p->font->bpp ));
}
else
p->font->bpp = 1;
@@ -2122,13 +2117,13 @@
/* Check for the CHARS field -- font properties are optional */
if ( _bdf_strncmp( line, "CHARS", 5 ) == 0 )
{
- char nbuf[128];
+ char nbuf[BUFSIZE];
if ( !( p->flags & BDF_FONT_BBX_ ) )
{
/* Missing the FONTBOUNDINGBOX field. */
- FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
error = FT_THROW( Missing_Fontboundingbox_Field );
goto Exit;
}
@@ -2136,29 +2131,29 @@
/* Add the two standard X11 properties which are required */
/* for compiling fonts. */
p->font->font_ascent = p->font->bbx.ascent;
- ft_sprintf( nbuf, "%hd", p->font->bbx.ascent );
- error = _bdf_add_property( p->font, "FONT_ASCENT",
+ ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.ascent );
+ error = bdf_add_property_( p->font, "FONT_ASCENT",
nbuf, lineno );
if ( error )
goto Exit;
- FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent ));
+ FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent ));
p->font->font_descent = p->font->bbx.descent;
- ft_sprintf( nbuf, "%hd", p->font->bbx.descent );
- error = _bdf_add_property( p->font, "FONT_DESCENT",
+ ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.descent );
+ error = bdf_add_property_( p->font, "FONT_DESCENT",
nbuf, lineno );
if ( error )
goto Exit;
- FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent ));
+ FT_TRACE2(( "bdf_parse_properties_: " ACMSG2, p->font->bbx.descent ));
- *next = _bdf_parse_glyphs;
+ *next = bdf_parse_glyphs_;
/* A special return value. */
error = -1;
goto Exit;
}
- FT_ERROR(( "_bdf_parse_start: " ERRMSG9, lineno ));
+ FT_ERROR(( "bdf_parse_start_: " ERRMSG9, lineno ));
error = FT_THROW( Invalid_File_Format );
Exit:
@@ -2175,34 +2170,32 @@
FT_LOCAL_DEF( FT_Error )
bdf_load_font( FT_Stream stream,
- FT_Memory extmemory,
+ FT_Memory memory,
bdf_options_t* opts,
bdf_font_t* *font )
{
unsigned long lineno = 0; /* make compiler happy */
- _bdf_parse_t *p = NULL;
+ bdf_parse_t_ *p = NULL;
- FT_Memory memory = extmemory; /* needed for FT_NEW */
- FT_Error error = FT_Err_Ok;
+ FT_Error error = FT_Err_Ok;
if ( FT_NEW( p ) )
goto Exit;
- memory = NULL;
- p->opts = (bdf_options_t*)( ( opts != 0 ) ? opts : &_bdf_opts );
+ p->opts = (bdf_options_t*)( opts ? opts : &bdf_opts_ );
p->minlb = 32767;
p->size = stream->size;
- p->memory = extmemory; /* only during font creation */
+ p->memory = memory; /* only during font creation */
- _bdf_list_init( &p->list, extmemory );
+ bdf_list_init_( &p->list, memory );
- error = _bdf_readstream( stream, _bdf_parse_start,
+ error = bdf_readstream_( stream, bdf_parse_start_,
(void *)p, &lineno );
if ( error )
goto Fail;
- if ( p->font != 0 )
+ if ( p->font )
{
/* If the font is not proportional, set the font's monowidth */
/* field to the width of the font bounding box. */
@@ -2283,22 +2276,7 @@
}
}
- if ( p->font != 0 )
- {
- /* Make sure the comments are NULL terminated if they exist. */
- memory = p->font->memory;
-
- if ( p->font->comments_len > 0 )
- {
- if ( FT_RENEW_ARRAY( p->font->comments,
- p->font->comments_len,
- p->font->comments_len + 1 ) )
- goto Fail;
-
- p->font->comments[p->font->comments_len] = 0;
- }
- }
- else if ( !error )
+ if ( !p->font && !error )
error = FT_THROW( Invalid_File_Format );
*font = p->font;
@@ -2306,9 +2284,7 @@
Exit:
if ( p )
{
- _bdf_list_done( &p->list );
-
- memory = extmemory;
+ bdf_list_done_( &p->list );
FT_FREE( p->glyph_name );
FT_FREE( p );
@@ -2319,8 +2295,6 @@
Fail:
bdf_free_font( p->font );
- memory = extmemory;
-
FT_FREE( p->font );
goto Exit;
@@ -2336,7 +2310,7 @@
FT_Memory memory;
- if ( font == 0 )
+ if ( font == NULL )
return;
memory = font->memory;
@@ -2386,11 +2360,7 @@
/* Free up the user defined properties. */
for ( prop = font->user_props, i = 0;
i < font->nuser_props; i++, prop++ )
- {
FT_FREE( prop->name );
- if ( prop->format == BDF_ATOM )
- FT_FREE( prop->value.atom );
- }
FT_FREE( font->user_props );
@@ -2405,7 +2375,7 @@
size_t* propid;
- if ( font == 0 || font->props_size == 0 || name == 0 || *name == 0 )
+ if ( font == NULL || font->props_size == 0 || name == NULL || *name == 0 )
return 0;
propid = ft_hash_str_lookup( name, (FT_Hash)font->internal );