From 4937a3ebd2c77ece7796b312eb3814ce1b18b03b Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 19 Dec 2001 21:09:16 +0000 Subject: [PATCH] * src/truetype/ttgload.c (TT_Load_Glyph), src/base/ftobjs.c (FT_Load_Glyph): "fixed" the bug that prevented embedded bitmaps from begin loaded when the auto-hinter is used.. This actually is a hack but will be enough until the internal re-design scheduled for FreeType 2.1 --- ChangeLog | 7 +++++++ include/freetype/freetype.h | 3 +++ src/base/ftobjs.c | 17 +++++++++++++++++ src/truetype/ttgload.c | 4 ++++ 4 files changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index 840ace839..ff9a287f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2001-12-19 David Turner + * src/truetype/ttgload.c (TT_Load_Glyph), src/base/ftobjs.c + (FT_Load_Glyph): "fixed" the bug that prevented embedded bitmaps from + begin loaded when the auto-hinter is used.. This actually is a hack + but will be enough until the internal re-design scheduled for + FreeType 2.1 + + * include/freetype/cache/ftcache.h: added comments to indicate that some of the exported functions should only be used by applications that need to implement custom cache types diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 81b29e281..2f47ba27f 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2068,6 +2068,9 @@ FT_BEGIN_HEADER /* */ #define FT_LOAD_LINEAR_DESIGN 8192 + /* temporary hack !! */ +#define FT_LOAD_SBITS_ONLY 16384 + /*************************************************************************/ /* */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 1a10f2a81..6189db99f 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -883,6 +883,22 @@ FT_AutoHinter_Interface* hinting; + /* try to load embedded bitmaps first when available */ + + /* XXX: this is really a temporary hack that should disappear */ + /* promptly with FreeType 2.1 !! */ + /* */ + if ( FT_HAS_FIXED_SIZES( face ) ) + { + error = driver->clazz->load_glyph( slot, face->size, + glyph_index, + load_flags | FT_LOAD_SBITS_ONLY ); + + if ( !error && slot->format == ft_glyph_format_bitmap ) + goto Load_Ok; + } + + /* load auto-hinted outline */ hinting = (FT_AutoHinter_Interface*)hinter->clazz->module_interface; error = hinting->load_glyph( (FT_AutoHinter)hinter, @@ -897,6 +913,7 @@ if ( error ) goto Exit; + Load_Ok: /* compute the advance */ if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 33caaed25..6495dcf43 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1411,6 +1411,10 @@ #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + /* return immediately if we only wanted the embedded bitmaps */ + if ( load_flags & FT_LOAD_SBITS_ONLY ) + return FT_Err_Invalid_Argument; + /* seek to the beginning of the glyph table. For Type 42 fonts */ /* the table might be accessed from a Postscript stream or something */ /* else... */