* 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)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
diff --git a/ChangeLog b/ChangeLog
index 74e8fd1..559fef5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/builds/unix/unix-cc.in b/builds/unix/unix-cc.in
index 76eebd7..42c8afd 100644
--- a/builds/unix/unix-cc.in
+++ b/builds/unix/unix-cc.in
@@ -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
diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h
index f0910df..d549532 100644
--- a/include/freetype/ftcache.h
+++ b/include/freetype/ftcache.h
@@ -579,13 +579,15 @@ FT_BEGIN_HEADER
/* */
-#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
- ( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
- (d1)->flags == (d2)->flags )
-
-#define FTC_IMAGE_TYPE_HASH( d ) \
- (FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
- ( (d)->flags << 4 ) )
+#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 ) ^ \
+ ((d)->width << 8) ^ (d)->height ^ \
+ ( (d)->flags << 4 ) )
/*************************************************************************/
diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index 689cdc6..6190a30 100644
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -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;
- 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;
+#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.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;
- 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;
+#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.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 */
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index c14378d..2a8d21c 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -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 )