* builds/unix/unix-cc.in: don't filter-out exported functions

anymore, this is used to ensure that all FT_BASE internal
    functions are available for dynamic linking

    * include/freetype/ftcache.h, src/cache/ftcbasic.c,
    src/cache/ftccmap.c: try to revive old functions of the
    cache sub-system. We also try to support FTC_ImageCache_Lookup
    and FTC_ImageCache_SBit with legacy signatures through a gross
    hack (hope it works)
This commit is contained in:
David Turner 2006-02-17 17:23:13 +00:00
parent 1fae66950b
commit 0880ac333a
5 changed files with 253 additions and 18 deletions

View File

@ -1,3 +1,15 @@
2006-02-17 David Turner <david@freetype.org>
* builds/unix/unix-cc.in: don't filter-out exported functions
anymore, this is used to ensure that all FT_BASE internal
functions are available for dynamic linking
* include/freetype/ftcache.h, src/cache/ftcbasic.c,
src/cache/ftccmap.c: try to revive old functions of the
cache sub-system. We also try to support FTC_ImageCache_Lookup
and FTC_ImageCache_SBit with legacy signatures through a gross
hack (hope it works)
2006-02-17 Werner Lemberg <wl@gnu.org>
* devel/ftoption.h: Synchronize with

View File

@ -98,7 +98,6 @@ CCexe := $(CCraw) # used to compile "apinames" only
#
LINK_LIBRARY = $(LIBTOOL) --mode=link $(CCraw) -o $@ $(OBJECTS_LIST) \
-rpath $(libdir) -version-info $(version_info) \
$(LDFLAGS) -export-symbols $(EXPORTS_LIST) \
-no-undefined
$(LDFLAGS) #-export-symbols $(EXPORTS_LIST) -no-undefined
# EOF

View File

@ -580,11 +580,13 @@ FT_BEGIN_HEADER
/* */
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
( (d1)->face_id == (d2)->face_id && \
(d1)->width == (d2)->width && \
(d1)->flags == (d2)->flags )
#define FTC_IMAGE_TYPE_HASH( d ) \
(FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
(FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id ) ^ \
((d)->width << 8) ^ (d)->height ^ \
( (d)->flags << 4 ) )

215
src/cache/ftcbasic.c vendored
View File

@ -26,6 +26,37 @@
#include "ftccback.h"
#include "ftcerror.h"
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
/* these correspond to the FTC_Font and FTC_ImageDesc types
* that were defined in FT 2.1.7
*/
typedef struct
{
FTC_FaceID face_id;
FT_UShort pix_width;
FT_UShort pix_height;
} FTC_OldFontRec, *FTC_OldFont;
typedef struct
{
FTC_OldFontRec font;
FT_UInt32 flags;
} FTC_OldImageDescRec, *FTC_OldImageDesc;
/* notice that FTC_OldImageDescRec and FTC_ImageTypeRec are nearly
* identical, bit-wise. The only difference is that the 'width' and
* 'height' fields are expressed as 16-bit integers in the old structure,
* and as normal 'int' in the new one
*
* we're going to perform a weird hack to detect which structure is being
* passed to the image and sbit caches. If the new structure's 'width'
* is larger than 0x10000, we assume that we're really receiving a
* FTC_OldImageDesc.
*/
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
/*
* Basic Families
@ -282,12 +313,28 @@
if ( anode )
*anode = NULL;
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
/* this one is a major hack used to detect wether we're passed a
* regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one
*/
if ( type->width >= 0x10000 )
{
FTC_OldImageDesc desc = (FTC_OldImageDesc)type;
query.attrs.scaler.face_id = desc->font.face_id;
query.attrs.scaler.width = desc->font.pix_width;
query.attrs.scaler.height = desc->font.pix_height;
query.attrs.load_flags = desc->flags;
}
#endif
{
query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width;
query.attrs.scaler.height = type->height;
query.attrs.scaler.pixel = 1;
query.attrs.load_flags = type->flags;
}
query.attrs.scaler.pixel = 1;
query.attrs.scaler.x_res = 0; /* make compilers happy */
query.attrs.scaler.y_res = 0;
@ -323,6 +370,121 @@
}
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
FT_EXPORT_DEF( FT_Error )
FTC_Image_Cache_New( FTC_Manager manager,
FTC_ImageCache *acache )
{
return FTC_ImageCache_New( manager, (FTC_ImageCache*)acache );
}
/* yet another backwards-legacy structure... yukkk */
typedef struct
{
FTC_FontRec font;
FT_UInt image_type;
} FTC_OldImage_Desc;
#define FTC_OLD_IMAGE_FORMAT( x ) ( (x) & 7 )
#define ftc_old_image_format_bitmap 0x0000
#define ftc_old_image_format_outline 0x0001
#define ftc_old_image_format_mask 0x000F
#define ftc_old_image_flag_monochrome 0x0010
#define ftc_old_image_flag_unhinted 0x0020
#define ftc_old_image_flag_autohinted 0x0040
#define ftc_old_image_flag_unscaled 0x0080
#define ftc_old_image_flag_no_sbits 0x0100
/* monochrome bitmap */
#define ftc_old_image_mono ftc_old_image_format_bitmap | \
ftc_old_image_flag_monochrome
/* anti-aliased bitmap */
#define ftc_old_image_grays ftc_old_image_format_bitmap
/* scaled outline */
#define ftc_old_image_outline ftc_old_image_format_outline
static void
ftc_image_type_from_old_desc( FTC_ImageType typ,
FTC_OldImage_Desc* desc )
{
typ->face_id = desc->font.face_id;
typ->width = desc->font.pix_width;
typ->height = desc->font.pix_height;
/* convert image type flags to load flags */
{
FT_UInt load_flags = FT_LOAD_DEFAULT;
FT_UInt type = desc->image_type;
/* determine load flags, depending on the font description's */
/* image type */
if ( FTC_OLD_IMAGE_FORMAT( type ) == ftc_old_image_format_bitmap )
{
if ( type & ftc_old_image_flag_monochrome )
load_flags |= FT_LOAD_MONOCHROME;
/* disable embedded bitmaps loading if necessary */
if ( type & ftc_old_image_flag_no_sbits )
load_flags |= FT_LOAD_NO_BITMAP;
}
else
{
/* we want an outline, don't load embedded bitmaps */
load_flags |= FT_LOAD_NO_BITMAP;
if ( type & ftc_old_image_flag_unscaled )
load_flags |= FT_LOAD_NO_SCALE;
}
/* always render glyphs to bitmaps */
load_flags |= FT_LOAD_RENDER;
if ( type & ftc_old_image_flag_unhinted )
load_flags |= FT_LOAD_NO_HINTING;
if ( type & ftc_old_image_flag_autohinted )
load_flags |= FT_LOAD_FORCE_AUTOHINT;
typ->flags = load_flags;
}
}
FT_EXPORT_DEF( FT_Error )
FTC_Image_Cache_Lookup( FTC_ImageCache icache,
FTC_OldImage_Desc* desc,
FT_UInt gindex,
FT_Glyph *aglyph )
{
FTC_ImageTypeRec type0;
if ( !desc )
return FTC_Err_Invalid_Argument;
ftc_image_type_from_old_desc( &type0, desc );
return FTC_ImageCache_Lookup( (FTC_ImageCache)icache,
&type0,
gindex,
aglyph,
NULL );
}
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
/*
*
* basic small bitmap cache
@ -398,12 +560,28 @@
*ansbit = NULL;
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
/* this one is a major hack used to detect wether we're passed a
* regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one
*/
if ( type->width >= 0x10000 )
{
FTC_OldImageDesc desc = (FTC_OldImageDesc)type;
query.attrs.scaler.face_id = desc->font.face_id;
query.attrs.scaler.width = desc->font.pix_width;
query.attrs.scaler.height = desc->font.pix_height;
query.attrs.load_flags = desc->flags;
}
#endif
{
query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width;
query.attrs.scaler.height = type->height;
query.attrs.scaler.pixel = 1;
query.attrs.load_flags = type->flags;
}
query.attrs.scaler.pixel = 1;
query.attrs.scaler.x_res = 0; /* make compilers happy */
query.attrs.scaler.y_res = 0;
@ -441,5 +619,38 @@
return error;
}
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
FT_EXPORT_DEF( FT_Error )
FTC_SBit_Cache_New( FTC_Manager manager,
FTC_SBitCache *acache )
{
return FTC_SBitCache_New( manager, (FTC_SBitCache*)acache );
}
FT_EXPORT_DEF( FT_Error )
FTC_SBit_Cache_Lookup( FTC_SBitCache cache,
FTC_OldImage_Desc* desc,
FT_UInt gindex,
FTC_SBit *ansbit )
{
FTC_ImageTypeRec type0;
if ( !desc )
return FT_Err_Invalid_Argument;
ftc_image_type_from_old_desc( &type0, desc );
return FTC_SBitCache_Lookup( (FTC_SBitCache)cache,
&type0,
gindex,
ansbit,
NULL );
}
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
/* END */

11
src/cache/ftccmap.c vendored
View File

@ -224,6 +224,17 @@
}
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
/* unfortunately, it is not possible to support binary backwards
* compatibility in the cmap cache. the FTC_CMapCache_Lookup signature
* changes were too deep, and there is no clever hackish way to detect
* what kind of structure we're being passed.
*
* fortunately, it seems that no production code is using this function
* on Unix distributions.
*/
#endif
/* documentation is in ftcache.h */
FT_EXPORT_DEF( FT_UInt )