* src/cache/ftccmap.c: trying to hack binary compatibility for gnustep-back (GNUstep backend module) which still crashes under Sarge.
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
diff --git a/ChangeLog b/ChangeLog
index 195994e..3cb79f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@
glyphs.
Fix a problem with large encodings.
+ * src/cache/ftccmap.c: trying to hack binary compatibility for
+ gnustep-back (GNUstep backend module) which still crashes under
+ Sarge.
+
2006-02-23 Chia-I Wu <b90201047@ntu.edu.tw>
* include/freetype/ftoutln.h (enum FT_Orientation): New value
@@ -44,7 +48,7 @@
The FT_Get_Module_Flags API was removed consequently.
- * include/freetype/ftmodapi.h (FT_Module_Get_Flags): Removed.
+ * include/freetype/ftmodapi.h (FT_Module_Get_Flags): Removed.
Replaced with...
(FT_Get_TrueType_Engine_Type): This.
(FT_TrueTypeEngineType): New enumeration.
diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c
index 0f7306f..71944b8 100644
--- a/src/cache/ftccmap.c
+++ b/src/cache/ftccmap.c
@@ -31,6 +31,42 @@
#define FT_COMPONENT trace_cache
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+
+ typedef enum FTC_OldCMapType_
+ {
+ FTC_OLD_CMAP_BY_INDEX = 0,
+ FTC_OLD_CMAP_BY_ENCODING = 1,
+ FTC_OLD_CMAP_BY_ID = 2
+
+ } FTC_OldCMapType;
+
+
+ typedef struct FTC_OldCMapIdRec_
+ {
+ FT_UInt platform;
+ FT_UInt encoding;
+
+ } FTC_OldCMapIdRec, *FTC_OldCMapId;
+
+
+ typedef struct FTC_OldCMapDescRec_
+ {
+ FTC_FaceID face_id;
+ FTC_OldCMapType type;
+
+ union
+ {
+ FT_UInt index;
+ FT_Encoding encoding;
+ FTC_OldCMapIdRec id;
+
+ } u;
+
+ } FTC_OldCMapDescRec, *FTC_OldCMapDesc;
+
+#endif /* FT_CONFIG_OLD_INTERNALS */
+
/*************************************************************************/
/* */
/* Each FTC_CMapNode contains a simple array to map a range of character */
@@ -261,9 +297,36 @@
return 0;
}
- query.face_id = face_id;
- query.cmap_index = (FT_UInt)cmap_index;
- query.char_code = char_code;
+#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
+ /* detect a call from a rogue client that thinks it is linking
+ * to FreeType 2.1.7. This is possible because the third parameter
+ * is then a character code, and we've never seen any font with
+ * more than a few charmaps, so if the index is very large...
+ */
+ if ( cmap_index >= 4 )
+ {
+ FTC_OldCMapDesc desc = (FTC_OldCMapDesc) face_id;
+
+ query.face_id = desc->face_id;
+
+ switch ( desc->type )
+ {
+ case FTC_OLD_CMAP_BY_INDEX:
+ query.cmap_index = desc->u.index;
+ query.char_code = (FT_UInt32)cmap_index;
+ break;
+
+ default:
+ return FT_Err_Unimplemented_Feature;
+ }
+ }
+ else
+#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
+ {
+ query.face_id = face_id;
+ query.cmap_index = (FT_UInt)cmap_index;
+ query.char_code = char_code;
+ }
hash = FTC_CMAP_HASH( face_id, cmap_index, char_code );