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.
This commit is contained in:
parent
7585683c4a
commit
01ca4da203
24
ChangeLog
24
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.
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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,16 +27,31 @@
|
||||
FT_EXPORT_DEF( FT_UShort )
|
||||
FT_Get_FSType_Flags( FT_Face face )
|
||||
{
|
||||
PS_FontInfoRec font_info;
|
||||
TT_OS2* os2;
|
||||
TT_OS2* os2;
|
||||
|
||||
|
||||
/* 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 ( 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 ( !FT_Get_PS_Font_Info( face, &font_info ) &&
|
||||
font_info.fs_type != 0 )
|
||||
return font_info.fs_type;
|
||||
|
||||
if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, ft_sfnt_os2 ) ) != NULL &&
|
||||
os2->version != 0xFFFFU )
|
||||
return os2->fsType;
|
||||
|
@ -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 */
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
};
|
||||
|
@ -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 )
|
||||
|
||||
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user