Formatting, copyright years, minor doc fixes.

This commit is contained in:
Werner Lemberg 2006-02-19 16:12:18 +00:00
parent 0880ac333a
commit f145e312df
5 changed files with 98 additions and 69 deletions

View File

@ -1,14 +1,18 @@
2006-02-17 David Turner <david@freetype.org> 2006-02-17 David Turner <david@freetype.org>
* builds/unix/unix-cc.in: don't filter-out exported functions * builds/unix/unix-cc.in (LINK_LIBRARY): Don't filter out exported
anymore, this is used to ensure that all FT_BASE internal functions anymore. This ensures that all FT_BASE internal functions
functions are available for dynamic linking are available for dynamic linking.
* include/freetype/ftcache.h, src/cache/ftcbasic.c, * include/freetype/ftcache.h (FTC_IMAGE_TYPE_COMPARE,
src/cache/ftccmap.c: try to revive old functions of the FTC_IMAGE_TYPE_HASH), src/cache/ftcbasic.c (FTC_OldFontRec,
cache sub-system. We also try to support FTC_ImageCache_Lookup FTC_OldImageDescRec, FTC_ImageCache_Lookup, FTC_Image_Cache_New,
and FTC_ImageCache_SBit with legacy signatures through a gross FTC_OldImage_Desc, FTC_OLD_IMAGE_FORMAT, ftc_old_image_xxx,
hack (hope it works) ftc_image_type_from_old_desc, FTC_Image_Cache_Lookup,
FTC_SBitCache_Lookup, FTC_SBit_Cache_New, FTC_SBit_Cache_Lookup)
[FT_CONFIG_OPTION_OLD_INTERNALS]: Try to revive old functions of the
cache sub-system. We try to recognize old legacy signatures with a
gross hack (hope it works).
2006-02-17 Werner Lemberg <wl@gnu.org> 2006-02-17 Werner Lemberg <wl@gnu.org>

View File

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

View File

@ -180,10 +180,10 @@ FT_BEGIN_HEADER
(f1)->pix_width == (f2)->pix_width && \ (f1)->pix_width == (f2)->pix_width && \
(f1)->pix_height == (f2)->pix_height ) (f1)->pix_height == (f2)->pix_height )
#define FT_POINTER_TO_ULONG( p ) ((FT_ULong)(FT_Pointer)(p)) #define FT_POINTER_TO_ULONG( p ) ( (FT_ULong)(FT_Pointer)(p) )
#define FTC_FACE_ID_HASH( i ) \ #define FTC_FACE_ID_HASH( i ) \
((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^ \ ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^ \
( FT_POINTER_TO_ULONG( i ) << 7 ) ) ) ( FT_POINTER_TO_ULONG( i ) << 7 ) ) )
#define FTC_FONT_HASH( f ) \ #define FTC_FONT_HASH( f ) \
@ -575,19 +575,21 @@ FT_BEGIN_HEADER
} FTC_ImageTypeRec; } FTC_ImageTypeRec;
typedef struct FTC_ImageTypeRec_* FTC_ImageType; typedef struct FTC_ImageTypeRec_* FTC_ImageType;
/* */
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \ /* */
( (d1)->face_id == (d2)->face_id && \
(d1)->width == (d2)->width && \
(d1)->flags == (d2)->flags )
#define FTC_IMAGE_TYPE_HASH( d ) \
(FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id ) ^ \ #define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
((d)->width << 8) ^ (d)->height ^ \ ( (d1)->face_id == (d2)->face_id && \
( (d)->flags << 4 ) ) (d1)->width == (d2)->width && \
(d1)->flags == (d2)->flags )
#define FTC_IMAGE_TYPE_HASH( d ) \
(FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id ) ^ \
( (d)->width << 8 ) ^ (d)->height ^ \
( (d)->flags << 4 ) )
/*************************************************************************/ /*************************************************************************/

91
src/cache/ftcbasic.c vendored
View File

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType basic cache interface (body). */ /* The FreeType basic cache interface (body). */
/* */ /* */
/* Copyright 2003, 2004, 2005 by */ /* Copyright 2003, 2004, 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -26,38 +26,45 @@
#include "ftccback.h" #include "ftccback.h"
#include "ftcerror.h" #include "ftcerror.h"
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
/* these correspond to the FTC_Font and FTC_ImageDesc types /*
* that were defined in FT 2.1.7 * These structures correspond to the FTC_Font and FTC_ImageDesc types
*/ * that were defined in version 2.1.7.
typedef struct */
typedef struct FTC_OldFontRec_
{ {
FTC_FaceID face_id; FTC_FaceID face_id;
FT_UShort pix_width; FT_UShort pix_width;
FT_UShort pix_height; FT_UShort pix_height;
} FTC_OldFontRec, *FTC_OldFont; } FTC_OldFontRec, *FTC_OldFont;
typedef struct
typedef struct FTC_OldImageDescRec_
{ {
FTC_OldFontRec font; FTC_OldFontRec font;
FT_UInt32 flags; FT_UInt32 flags;
} FTC_OldImageDescRec, *FTC_OldImageDesc; } 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, * Notice that FTC_OldImageDescRec and FTC_ImageTypeRec are nearly
* and as normal 'int' in the new one * identical, bit-wise. The only difference is that the `width' and
* * `height' fields are expressed as 16-bit integers in the old structure,
* we're going to perform a weird hack to detect which structure is being * and as normal `int' in the new one.
* 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 * We are going to perform a weird hack to detect which structure is
* FTC_OldImageDesc. * being passed to the image and sbit caches. If the new structure's
*/ * `width' is larger than 0x10000, we assume that we are really receiving
* an FTC_OldImageDesc.
*/
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
/* /*
* Basic Families * Basic Families
* *
@ -314,19 +321,24 @@
*anode = NULL; *anode = NULL;
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #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 /*
*/ * This one is a major hack used to detect whether we are passed a
* regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
*/
if ( type->width >= 0x10000 ) if ( type->width >= 0x10000 )
{ {
FTC_OldImageDesc desc = (FTC_OldImageDesc)type; FTC_OldImageDesc desc = (FTC_OldImageDesc)type;
query.attrs.scaler.face_id = desc->font.face_id; query.attrs.scaler.face_id = desc->font.face_id;
query.attrs.scaler.width = desc->font.pix_width; query.attrs.scaler.width = desc->font.pix_width;
query.attrs.scaler.height = desc->font.pix_height; query.attrs.scaler.height = desc->font.pix_height;
query.attrs.load_flags = desc->flags; query.attrs.load_flags = desc->flags;
} }
#endif
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
{ {
query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width; query.attrs.scaler.width = type->width;
@ -334,9 +346,9 @@
query.attrs.load_flags = type->flags; query.attrs.load_flags = type->flags;
} }
query.attrs.scaler.pixel = 1; query.attrs.scaler.pixel = 1;
query.attrs.scaler.x_res = 0; /* make compilers happy */ query.attrs.scaler.x_res = 0; /* make compilers happy */
query.attrs.scaler.y_res = 0; query.attrs.scaler.y_res = 0;
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex; hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
@ -380,14 +392,15 @@
} }
/* yet another backwards-legacy structure... yukkk */ /* yet another backwards-legacy structure */
typedef struct typedef struct FTC_OldImage_Desc_
{ {
FTC_FontRec font; FTC_FontRec font;
FT_UInt image_type; FT_UInt image_type;
} FTC_OldImage_Desc; } FTC_OldImage_Desc;
#define FTC_OLD_IMAGE_FORMAT( x ) ( (x) & 7 ) #define FTC_OLD_IMAGE_FORMAT( x ) ( (x) & 7 )
@ -403,7 +416,7 @@
#define ftc_old_image_flag_no_sbits 0x0100 #define ftc_old_image_flag_no_sbits 0x0100
/* monochrome bitmap */ /* monochrome bitmap */
#define ftc_old_image_mono ftc_old_image_format_bitmap | \ #define ftc_old_image_mono ftc_old_image_format_bitmap | \
ftc_old_image_flag_monochrome ftc_old_image_flag_monochrome
/* anti-aliased bitmap */ /* anti-aliased bitmap */
@ -461,6 +474,7 @@
} }
} }
FT_EXPORT_DEF( FT_Error ) FT_EXPORT_DEF( FT_Error )
FTC_Image_Cache_Lookup( FTC_ImageCache icache, FTC_Image_Cache_Lookup( FTC_ImageCache icache,
FTC_OldImage_Desc* desc, FTC_OldImage_Desc* desc,
@ -561,19 +575,23 @@
*ansbit = NULL; *ansbit = NULL;
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #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 /* This one is a major hack used to detect whether we are passed a
*/ * regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
*/
if ( type->width >= 0x10000 ) if ( type->width >= 0x10000 )
{ {
FTC_OldImageDesc desc = (FTC_OldImageDesc)type; FTC_OldImageDesc desc = (FTC_OldImageDesc)type;
query.attrs.scaler.face_id = desc->font.face_id; query.attrs.scaler.face_id = desc->font.face_id;
query.attrs.scaler.width = desc->font.pix_width; query.attrs.scaler.width = desc->font.pix_width;
query.attrs.scaler.height = desc->font.pix_height; query.attrs.scaler.height = desc->font.pix_height;
query.attrs.load_flags = desc->flags; query.attrs.load_flags = desc->flags;
} }
#endif
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
{ {
query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width; query.attrs.scaler.width = type->width;
@ -581,9 +599,9 @@
query.attrs.load_flags = type->flags; query.attrs.load_flags = type->flags;
} }
query.attrs.scaler.pixel = 1; query.attrs.scaler.pixel = 1;
query.attrs.scaler.x_res = 0; /* make compilers happy */ query.attrs.scaler.x_res = 0; /* make compilers happy */
query.attrs.scaler.y_res = 0; query.attrs.scaler.y_res = 0;
/* beware, the hash must be the same for all glyph ranges! */ /* beware, the hash must be the same for all glyph ranges! */
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
@ -619,6 +637,7 @@
return error; return error;
} }
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
FT_EXPORT_DEF( FT_Error ) FT_EXPORT_DEF( FT_Error )

23
src/cache/ftccmap.c vendored
View File

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType CharMap cache (body) */ /* FreeType CharMap cache (body) */
/* */ /* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -225,16 +225,20 @@
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #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 * Unfortunately, it is not possible to support binary backwards
* what kind of structure we're being passed. * compatibility in the cmap cache. The FTC_CMapCache_Lookup signature
* * changes were too deep, and there is no clever hackish way to detect
* fortunately, it seems that no production code is using this function * what kind of structure we are being passed.
* on Unix distributions. *
*/ * On the other hand it seems that no production code is using this
* function on Unix distributions.
*/
#endif #endif
/* documentation is in ftcache.h */ /* documentation is in ftcache.h */
FT_EXPORT_DEF( FT_UInt ) FT_EXPORT_DEF( FT_UInt )
@ -311,5 +315,4 @@
} }
/* END */ /* END */