diff options
author | Werner Lemberg <wl@gnu.org> | 2003-06-22 15:33:53 +0000 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2003-06-22 15:33:53 +0000 |
commit | 779afe4b91f579e6db0d59f23076a7c6d8c26a14 (patch) | |
tree | 7c79623f32cd3569176608ab2def6ff62ab7890e /src/winfonts/winfnt.c | |
parent | deb5510a547e94ce6d46766f447c22e696941c40 (diff) | |
download | freetype2-779afe4b91f579e6db0d59f23076a7c6d8c26a14.tar.gz |
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
computation of glyph_index.
(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
only, then try to find a better hit by comparing pixel_width also.
Without this fix it isn't possible to access all strikes.
Also compute metrics.max_advance to be in sync with other bitmap
drivers.
* src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
(FT_Set_Pixel_Size): Assign value to `metrics' after validation of
arguments.
Synchronize computation of height and width for bitmap strikes. The
`width' field in the FT_Bitmap_Size structure is now only useful to
enumerate different strikes. The `max_advance' field of the
FT_Size_Metrics structure should be used to get the (maximum) width
of a strike.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
argument to function.
* src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
`uniXXXX' and `uXXXX[X[X]]'.
* src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
* src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
s/FT_Err_/FTC_Err_/.
* src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
* src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
* src/psaux/t1cmap.c: Include psauxerr.h.
s/FT_Err_/PSaux_Err_/.
* src/pshinter/pshnterr.h: New file.
* src/pshinter/rules.mk: Updated.
* src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
s/FT_Err_/PSH_Err_/.
* src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
s/FT_Err_/PFR_Err_/.
* src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
* src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
* src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
FT_ERR_PREFIX and FT_ERR_BASE.
s/FT_Err_/Gzip_Err_/.
Diffstat (limited to 'src/winfonts/winfnt.c')
-rw-r--r-- | src/winfonts/winfnt.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 5b754dd5d..70d097282 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -402,7 +402,6 @@ static FT_CMap_Class fnt_cmap_class = &fnt_cmap_class_rec; - static void FNT_Face_Done( FNT_Face face ) { @@ -495,6 +494,7 @@ { FT_CharMapRec charmap; + charmap.encoding = FT_ENCODING_UNICODE; charmap.platform_id = 3; charmap.encoding_id = 1; @@ -547,25 +547,41 @@ FNT_Face face = (FNT_Face)FT_SIZE_FACE( size ); FNT_Font cur = face->fonts; FNT_Font limit = cur + face->num_fonts; + FNT_Font hit; size->font = 0; + hit = 0; + for ( ; cur < limit; cur++ ) { - /* we only compare the character height, as fonts used some strange */ - /* values */ if ( cur->header.pixel_height == size->root.metrics.y_ppem ) { - size->font = cur; + hit = cur; + break; + } + } - size->root.metrics.ascender = cur->header.ascent * 64; - size->root.metrics.descender = ( cur->header.pixel_height - - cur->header.ascent ) * 64; - size->root.metrics.height = cur->header.pixel_height * 64; + /* try to find a better hit */ + for ( ; cur < limit; cur++ ) + { + if ( cur->header.pixel_height == size->root.metrics.y_ppem && + cur->header.pixel_width == size->root.metrics.x_ppem ) + { + hit = cur; break; } } + if ( hit ) { + size->font = hit; + size->root.metrics.ascender = hit->header.ascent * 64; + size->root.metrics.descender = ( hit->header.pixel_height - + hit->header.ascent ) * 64; + size->root.metrics.height = hit->header.pixel_height * 64; + size->root.metrics.max_advance = hit->header.max_width * 64; + } + return ( size->font ? FNT_Err_Ok : FNT_Err_Invalid_Pixel_Size ); } @@ -597,7 +613,8 @@ if ( glyph_index > 0 ) glyph_index--; else - glyph_index = font->header.default_char - font->header.first_char; + glyph_index = font->header.default_char; + glyph_index -= font->header.first_char; new_format = FT_BOOL( font->header.version == 0x300 ); len = new_format ? 6 : 4; |