* src/bdf/bdfdrivr.h (BDF_FaceRec): New element `default_glyph'.

* src/bdf/bdflib.c (_bdf_add_property, _bdf_parse_start),
src/bdf/bdf.h (bdf_font_t): s/default_glyph/default_char/.

* src/bdf/bdfdrivr.c (BDF_Face_Init): Fix number of glyphs.
Set `default_glyph'.
(BDF_Glyph_Load): Use `default_glyph' for undefined glyph.

* docs/CHANGES: Updated.
This commit is contained in:
Werner Lemberg 2004-06-22 12:28:17 +00:00
parent 83efe779e3
commit 8ef4183690
6 changed files with 42 additions and 10 deletions

View File

@ -7,6 +7,17 @@
* src/pcf/pcfdrivr.c (FT_COMPOMENT): Move up.
(PCF_Face_Init): Simplify code.
* src/bdf/bdfdrivr.h (BDF_FaceRec): New element `default_glyph'.
* src/bdf/bdflib.c (_bdf_add_property, _bdf_parse_start),
src/bdf/bdf.h (bdf_font_t): s/default_glyph/default_char/.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Fix number of glyphs.
Set `default_glyph'.
(BDF_Glyph_Load): Use `default_glyph' for undefined glyph.
* docs/CHANGES: Updated.
2004-06-21 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Updated.

View File

@ -9,7 +9,7 @@ LATEST CHANGES BETWEEN 2.1.9 and 2.1.8
cmap caches.)
- `FT_Outline_Get_BBox' sometimes returned incorrect values for
conic outlines (e.g. for TrueType fonts).
conic outlines (e.g., for TrueType fonts).
- Handling of `bhed' table has been fixed.
@ -17,6 +17,11 @@ LATEST CHANGES BETWEEN 2.1.9 and 2.1.8
returned artifacts due to incorrect rounding. This bug has been
introduced after version 2.1.4.
- The BDF driver dropped the last glyph in the font.
- The BDF driver now uses the DEFAULT_CHAR property (if available)
to select a glyph shape for the undefined glyph.
II. IMPORTANT CHANGES

View File

@ -1,6 +1,6 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
* Copyright 2001, 2002, 2003 Francesco Zappa Nardelli
* Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -202,7 +202,7 @@ FT_BEGIN_HEADER
unsigned short monowidth; /* Logical width for monowidth font. */
long default_glyph; /* Encoding of the default glyph. */
long default_char; /* Encoding of the default glyph. */
long font_ascent; /* Font ascent. */
long font_descent; /* Font descent. */

View File

@ -109,6 +109,8 @@ THE SOFTWARE.
if ( charcode == code )
{
/* increase glyph index by 1 -- */
/* we reserve slot 0 for the undefined glyph */
result = encodings[mid].glyph + 1;
break;
}
@ -147,6 +149,8 @@ THE SOFTWARE.
if ( charcode == code )
{
/* increase glyph index by 1 -- */
/* we reserve slot 0 for the undefined glyph */
result = encodings[mid].glyph + 1;
goto Exit;
}
@ -397,7 +401,9 @@ THE SOFTWARE.
if ( ( error = bdf_interpret_style( face ) ) != 0 )
goto Exit;
bdfface->num_glyphs = font->glyphs_size; /* unencoded included */
/* the number of glyphs (with one slot for the undefined glyph */
/* at position 0 and all unencoded glyphs) */
bdfface->num_glyphs = font->glyphs_size + 1;
bdfface->num_fixed_sizes = 1;
if ( FT_NEW_ARRAY( bdfface->available_sizes, 1 ) )
@ -457,11 +463,15 @@ THE SOFTWARE.
if ( FT_NEW_ARRAY( face->en_table, font->glyphs_size ) )
goto Exit;
face->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_Short)n;
if ( cur[n].encoding == font->default_char )
face->default_glyph = n;
}
}
@ -556,7 +566,7 @@ THE SOFTWARE.
bdfface->charmap = bdfface->charmaps[0];
}
}
}
}
Exit:
return error;
@ -636,7 +646,10 @@ THE SOFTWARE.
goto Exit;
}
if ( glyph_index > 0 )
/* index 0 is the undefined glyph */
if ( glyph_index == 0 )
glyph_index = face->default_glyph;
else
glyph_index--;
/* slot, bitmap => freetype, glyph => bdflib */
@ -813,6 +826,7 @@ THE SOFTWARE.
return BDF_Err_Invalid_Argument;
}
static FT_Error
bdf_get_charset_id( BDF_Face face,
const char* *acharset_encoding,

View File

@ -2,7 +2,7 @@
FreeType font driver for bdf fonts
Copyright (C) 2001, 2002, 2003 by
Copyright (C) 2001, 2002, 2003, 2004 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -59,6 +59,8 @@ FT_BEGIN_HEADER
FT_CharMap charmap_handle;
FT_CharMapRec charmap; /* a single charmap per face */
FT_UInt default_glyph;
} BDF_FaceRec, *BDF_Face;

View File

@ -1404,7 +1404,7 @@
/* present, and the SPACING property should override the default */
/* spacing. */
if ( ft_memcmp( name, "DEFAULT_CHAR", 12 ) == 0 )
font->default_glyph = fp->value.int32;
font->default_char = fp->value.int32;
else if ( ft_memcmp( name, "FONT_ASCENT", 11 ) == 0 )
font->font_ascent = fp->value.int32;
else if ( ft_memcmp( name, "FONT_DESCENT", 12 ) == 0 )
@ -2048,8 +2048,8 @@
error = hash_init( (hashtable *)p->font->internal,memory );
if ( error )
goto Exit;
p->font->spacing = p->opts->font_spacing;
p->font->default_glyph = -1;
p->font->spacing = p->opts->font_spacing;
p->font->default_char = -1;
goto Exit;
}