Remove ABI-breaking field in public PS_InfoFontRec definition. Instead, we define a new internal PS_FontExtraRec structure to hold the additionnal field, then place it in various internal positions of the corresponding FT_Face derived objects.
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
diff --git a/ChangeLog b/ChangeLog
index c4efb2e..b14357b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2009-03-03 David Turner <david@freetype.org>
+
+ Remove ABI-breaking field in public PS_InfoFontRec definition.
+ Instead, we define a new internal PS_FontExtraRec structure to
+ hold the additionnal field, then place it in various internal
+ positions of the corresponding FT_Face derived objects.
+
+ * include/freetype/t1tables.h (PS_FontInfoRec): Remove the
+ `fs_type' field from the public structure.
+
+ * include/freetype/internal/psaux.h (T1_FieldLocation),
+ include/freetype/internal/t1types.h (T1_FontRec, CID_FaceRec),
+ src/type1/t1load.c, src/type1/t1tokens.h,
+ src/cid/cidload.c, src/cid/cidtoken.h,
+ src/type42/t42parse.c: modify the various font parsers to store
+ the `fs_type' field in a different places, instead of the public
+ PS_FontInfoRec.
+
+ * include/freetype/internal/services/svpsinfo.h (PsInfo service),
+ src/base/ftfstype.c (FT_Get_FSType_Flags), src/cff/cffdrivr.c,
+ src/cid/cidriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:
+ Modify the PsInfo service to add a GetExtra function, use it in
+ FT_Get_FSType_Flags() and modify the drivers accordingly.
+
2009-03-02 Alexey Kryukov <anagnost@yandex.ru>
Fix handling of EBDT formats 8 and 9.
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index 832d63d..7fb4c99 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -197,6 +197,7 @@ FT_BEGIN_HEADER
{
T1_FIELD_LOCATION_CID_INFO,
T1_FIELD_LOCATION_FONT_DICT,
+ T1_FIELD_LOCATION_FONT_EXTRA,
T1_FIELD_LOCATION_FONT_INFO,
T1_FIELD_LOCATION_PRIVATE,
T1_FIELD_LOCATION_BBOX,
diff --git a/include/freetype/internal/services/svpsinfo.h b/include/freetype/internal/services/svpsinfo.h
index 63f5db9..8217769 100644
--- a/include/freetype/internal/services/svpsinfo.h
+++ b/include/freetype/internal/services/svpsinfo.h
@@ -33,6 +33,10 @@ FT_BEGIN_HEADER
(*PS_GetFontInfoFunc)( FT_Face face,
PS_FontInfoRec* afont_info );
+ typedef FT_Error
+ (*PS_GetFontExtraFunc)( FT_Face face,
+ PS_FontExtraRec* afont_extra );
+
typedef FT_Int
(*PS_HasGlyphNamesFunc)( FT_Face face );
@@ -44,6 +48,7 @@ FT_BEGIN_HEADER
FT_DEFINE_SERVICE( PsInfo )
{
PS_GetFontInfoFunc ps_get_font_info;
+ PS_GetFontExtraFunc ps_get_font_extra;
PS_HasGlyphNamesFunc ps_has_glyph_names;
PS_GetFontPrivateFunc ps_get_font_private;
};
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index 4b05fa3..fdf766d 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -87,9 +87,21 @@ FT_BEGIN_HEADER
} T1_EncodingType;
+ /* used to hold extra data of PS_FontInfoRec that
+ * cannot be stored in the publicly defined structure.
+ *
+ * Note these can't be blended with multiple-masters.
+ */
+ typedef struct PS_FontExtraRec_
+ {
+ FT_UShort fs_type;
+
+ } PS_FontExtraRec;
+
typedef struct T1_FontRec_
{
PS_FontInfoRec font_info; /* font info dictionary */
+ PS_FontExtraRec font_extra; /* font info extra fields */
PS_PrivateRec private_dict; /* private dictionary */
FT_String* font_name; /* top-level dictionary */
@@ -231,6 +243,7 @@ FT_BEGIN_HEADER
void* psnames;
void* psaux;
CID_FaceInfoRec cid;
+ PS_FontExtraRec font_extra;
#if 0
void* afm_data;
#endif
diff --git a/include/freetype/t1tables.h b/include/freetype/t1tables.h
index 12832e7..5e2a393 100644
--- a/include/freetype/t1tables.h
+++ b/include/freetype/t1tables.h
@@ -78,10 +78,6 @@ FT_BEGIN_HEADER
FT_Short underline_position;
FT_UShort underline_thickness;
- /* since 2.3.8 */
-
- FT_UShort fs_type;
-
} PS_FontInfoRec;
diff --git a/src/base/ftfstype.c b/src/base/ftfstype.c
index 0d4e533..7060ac9 100644
--- a/src/base/ftfstype.c
+++ b/src/base/ftfstype.c
@@ -18,6 +18,8 @@
#include <ft2build.h>
#include FT_TYPE1_TABLES_H
#include FT_TRUETYPE_TABLES_H
+#include FT_INTERNAL_SERVICE_H
+#include FT_SERVICE_POSTSCRIPT_INFO_H
/* documentation is in freetype.h */
@@ -25,15 +27,30 @@
FT_EXPORT_DEF( FT_UShort )
FT_Get_FSType_Flags( FT_Face face )
{
- PS_FontInfoRec font_info;
- TT_OS2* os2;
+ TT_OS2* os2;
- /* look at FSType before fsType for Type42 */
+ /* first, try to get the fs_type directly from the font */
+ if ( face )
+ {
+ FT_Service_PsInfo service = NULL;
+
+
+ FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
- if ( !FT_Get_PS_Font_Info( face, &font_info ) &&
- font_info.fs_type != 0 )
- return font_info.fs_type;
+ if ( service && service->ps_get_font_extra )
+ {
+ PS_FontExtraRec extra;
+
+ if ( !service->ps_get_font_extra( face, &extra ) &&
+ extra.fs_type != 0 )
+ {
+ return extra.fs_type;
+ }
+ }
+ }
+
+ /* look at FSType before fsType for Type42 */
if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, ft_sfnt_os2 ) ) != NULL &&
os2->version != 0xFFFFU )
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index a7f433a..286c0b3 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -380,6 +380,7 @@
static const FT_Service_PsInfoRec cff_service_ps_info =
{
(PS_GetFontInfoFunc) cff_ps_get_font_info,
+ (PS_GetFontExtraFunc) NULL,
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
(PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */
};
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index ec24710..8541d06 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -97,6 +97,10 @@
object = (FT_Byte*)&cid->font_info;
break;
+ case T1_FIELD_LOCATION_FONT_EXTRA:
+ object = (FT_Byte*)&face->font_extra;
+ break;
+
case T1_FIELD_LOCATION_BBOX:
object = (FT_Byte*)&cid->font_bbox;
break;
diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c
index 85ee6cf..42bd298 100644
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -77,10 +77,18 @@
return 0;
}
+ static FT_Error
+ cid_ps_get_font_extra( FT_Face face,
+ PS_FontExtraRec* afont_extra )
+ {
+ *afont_extra = ((CID_Face)face)->font_extra;
+ return 0;
+ }
static const FT_Service_PsInfoRec cid_service_ps_info =
{
(PS_GetFontInfoFunc) cid_ps_get_font_info,
+ (PS_GetFontExtraFunc) cid_ps_get_font_extra,
(PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */
(PS_GetFontPrivateFunc)NULL /* unsupported */
};
diff --git a/src/cid/cidtoken.h b/src/cid/cidtoken.h
index 0795f05..f734322 100644
--- a/src/cid/cidtoken.h
+++ b/src/cid/cidtoken.h
@@ -48,6 +48,12 @@
T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch, 0 )
T1_FIELD_NUM ( "UnderlinePosition", underline_position, 0 )
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )
+
+#undef FT_STRUCTURE
+#define FT_STRUCTURE PS_FontExtraRec
+#undef T1CODE
+#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
+
T1_FIELD_NUM ( "FSType", fs_type, 0 )
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 42302e5..c22d8df 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -138,6 +138,13 @@
return 0;
}
+ static FT_Error
+ t1_ps_get_font_extra( FT_Face face,
+ PS_FontExtraRec* afont_extra )
+ {
+ *afont_extra = ((T1_Face)face)->type1.font_extra;
+ return 0;
+ }
static FT_Int
t1_ps_has_glyph_names( FT_Face face )
@@ -159,6 +166,7 @@
static const FT_Service_PsInfoRec t1_service_ps_info =
{
(PS_GetFontInfoFunc) t1_ps_get_font_info,
+ (PS_GetFontExtraFunc) t1_ps_get_font_extra,
(PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
(PS_GetFontPrivateFunc)t1_ps_get_font_private,
};
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 3afbeb8..50a0b2d 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -948,6 +948,12 @@
}
break;
+ case T1_FIELD_LOCATION_FONT_EXTRA:
+ dummy_object = &face->type1.font_extra;
+ objects = &dummy_object;
+ max_objects = 0;
+ break;
+
case T1_FIELD_LOCATION_PRIVATE:
dummy_object = &face->type1.private_dict;
objects = &dummy_object;
diff --git a/src/type1/t1tokens.h b/src/type1/t1tokens.h
index db08e04..bfbd0ef 100644
--- a/src/type1/t1tokens.h
+++ b/src/type1/t1tokens.h
@@ -41,6 +41,12 @@
T1_FIELD_DICT_FONTDICT )
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness,
T1_FIELD_DICT_FONTDICT )
+
+#undef FT_STRUCTURE
+#define FT_STRUCTURE PS_FontExtraRec
+#undef T1CODE
+#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
+
T1_FIELD_NUM ( "FSType", fs_type,
T1_FIELD_DICT_FONTDICT )
diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c
index a6e4cf4..92b40e1 100644
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -127,6 +127,13 @@
return T42_Err_Ok;
}
+ static FT_Error
+ t42_ps_get_font_extra( FT_Face face,
+ PS_FontExtraRec* afont_extra )
+ {
+ *afont_extra = ((T42_Face)face)->type1.font_extra;
+ return T42_Err_Ok;
+ }
static FT_Int
t42_ps_has_glyph_names( FT_Face face )
@@ -148,6 +155,7 @@
static const FT_Service_PsInfoRec t42_service_ps_info =
{
(PS_GetFontInfoFunc) t42_ps_get_font_info,
+ (PS_GetFontExtraFunc) t42_ps_get_font_extra,
(PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,
(PS_GetFontPrivateFunc)t42_ps_get_font_private
};
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index b5e257d..88d7a44 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -68,6 +68,12 @@
T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch, 0 )
T1_FIELD_NUM ( "UnderlinePosition", underline_position, 0 )
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )
+
+#undef FT_STRUCTURE
+#define FT_STRUCTURE PS_FontExtraRec
+#undef T1CODE
+#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
+
T1_FIELD_NUM ( "FSType", fs_type, 0 )
#undef FT_STRUCTURE