Add new function FT_Get_PS_Font_Private().

* include/freetype/internal/services/svpsinfo.h
(PS_GetFontPrivateFunc): New service function.

* include/freetype/t1tables.h, src/base/fttype1.c
(FT_Get_PS_Font_Private): New function.

* src/type1/t1driver.c (t1_ps_get_font_private): New function.
(t1_service_ps_info): Updated.

* src/cff/cffdrivr.c (cff_service_ps_info): Updated.
* src/cid/cidriver.c (cid_service_ps_info): Updated.
* src/type42/t42drivr.c (t42_ps_get_font_private): New function.
(t42_service_ps_info): Updated.

* src/type42/t42parse.c (t42_parse_dict): Remove compiler warning.
This commit is contained in:
Werner Lemberg 2004-11-12 07:02:45 +00:00
parent 023a4bf3be
commit 3605e470c1
9 changed files with 121 additions and 16 deletions

View File

@ -1,3 +1,25 @@
2004-11-11 Werner Lemberg <wl@gnu.org>
* src/cff/cffdrivr.c (cff_service_ps_info): Updated.
* src/cid/cidriver.c (cid_service_ps_info): Updated.
* src/type42/t42drivr.c (t42_ps_get_font_private): New function.
(t42_service_ps_info): Updated.
* src/type42/t42parse.c (t42_parse_dict): Remove compiler warning.
2004-11-11 David Bevan <dbevan@emtex.com>
Add new function FT_Get_PS_Font_Private().
* include/freetype/internal/services/svpsinfo.h
(PS_GetFontPrivateFunc): New service function.
* include/freetype/t1tables.h, src/base/fttype1.c
(FT_Get_PS_Font_Private): New function.
* src/type1/t1driver.c (t1_ps_get_font_private): New function.
(t1_service_ps_info): Updated.
2004-10-13 Werner Lemberg <wl@gnu.org>
* include/freetype/config/ftstdlib.h: Include `stddef.h'.

View File

@ -4,7 +4,7 @@
/* */
/* The FreeType PostScript info service (specification). */
/* */
/* Copyright 2003 by */
/* Copyright 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -36,11 +36,16 @@ FT_BEGIN_HEADER
typedef FT_Int
(*PS_HasGlyphNamesFunc)( FT_Face face );
typedef FT_Error
(*PS_GetFontPrivateFunc)( FT_Face face,
PS_PrivateRec* afont_private );
FT_DEFINE_SERVICE( PsInfo )
{
PS_GetFontInfoFunc ps_get_font_info;
PS_HasGlyphNamesFunc ps_has_glyph_names;
PS_GetFontInfoFunc ps_get_font_info;
PS_HasGlyphNamesFunc ps_has_glyph_names;
PS_GetFontPrivateFunc ps_get_font_private;
};
/* */

View File

@ -387,6 +387,38 @@ FT_BEGIN_HEADER
FT_Get_PS_Font_Info( FT_Face face,
PS_FontInfoRec *afont_info );
/************************************************************************
*
* @function:
* FT_Get_PS_Font_Private
*
* @description:
* Retrieve the @PS_PrivateRec structure corresponding to a given
* Postscript font.
*
* @input:
* face ::
* Postscript face handle.
*
* @output:
* afont_private ::
* Output private dictionary structure pointer.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The string pointers within the font info structure are owned by
* the face and don't need to be freed by the caller.
*
* If the font's format is not Postscript-based, this function will
* return the FT_Err_Invalid_Argument error code.
*/
FT_EXPORT( FT_Error )
FT_Get_PS_Font_Private( FT_Face face,
PS_PrivateRec *afont_private );
/* */

View File

@ -4,7 +4,7 @@
/* */
/* FreeType utility file for PS names support (body). */
/* */
/* Copyright 2002, 2003 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -67,4 +67,28 @@
}
/* documentation is in t1tables.h */
FT_EXPORT_DEF( FT_Error )
FT_Get_PS_Font_Private( FT_Face face,
PS_PrivateRec* afont_private )
{
FT_Error error = FT_Err_Invalid_Argument;
if ( face )
{
FT_Service_PsInfo service = NULL;
FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO );
if ( service && service->ps_get_font_private )
error = service->ps_get_font_private( face, afont_private );
}
return error;
}
/* END */

View File

@ -338,8 +338,9 @@
static const FT_Service_PsInfoRec cff_service_ps_info =
{
(PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */
(PS_HasGlyphNamesFunc)cff_ps_has_glyph_names
(PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
(PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */
};

View File

@ -78,8 +78,9 @@
static const FT_Service_PsInfoRec cid_service_ps_info =
{
(PS_GetFontInfoFunc) cid_ps_get_font_info,
(PS_HasGlyphNamesFunc)NULL /* unsupported with CID fonts */
(PS_GetFontInfoFunc) cid_ps_get_font_info,
(PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */
(PS_GetFontPrivateFunc)NULL /* unsupported */
};

View File

@ -160,10 +160,20 @@
}
static FT_Error
t1_ps_get_font_private( FT_Face face,
PS_PrivateRec* afont_private )
{
*afont_private = ((T1_Face)face)->type1.private_dict;
return 0;
}
static const FT_Service_PsInfoRec t1_service_ps_info =
{
(PS_GetFontInfoFunc) t1_ps_get_font_info,
(PS_HasGlyphNamesFunc)t1_ps_has_glyph_names
(PS_GetFontInfoFunc) t1_ps_get_font_info,
(PS_HasGlyphNamesFunc) t1_ps_has_glyph_names,
(PS_GetFontPrivateFunc)t1_ps_get_font_private,
};

View File

@ -139,7 +139,7 @@
PS_FontInfoRec* afont_info )
{
*afont_info = ((T42_Face)face)->type1.font_info;
return 0;
return T42_Err_Ok;
}
@ -151,10 +151,20 @@
}
static FT_Error
t42_ps_get_font_private( FT_Face face,
PS_PrivateRec* afont_private )
{
*afont_private = ((T42_Face)face)->type1.private_dict;
return T42_Err_Ok;
}
static const FT_Service_PsInfoRec t42_service_ps_info =
{
(PS_GetFontInfoFunc) t42_ps_get_font_info,
(PS_HasGlyphNamesFunc)t42_ps_has_glyph_names
(PS_GetFontInfoFunc) t42_ps_get_font_info,
(PS_HasGlyphNamesFunc) t42_ps_has_glyph_names,
(PS_GetFontPrivateFunc)t42_ps_get_font_private
};

View File

@ -1053,9 +1053,9 @@
if ( !name )
continue;
if ( cur[0] == name[0] &&
len == ft_strlen( (const char *)name ) &&
ft_memcmp( cur, name, len ) == 0 )
if ( cur[0] == name[0] &&
len == (FT_PtrDist)ft_strlen( (const char *)name ) &&
ft_memcmp( cur, name, len ) == 0 )
{
/* we found it -- run the parsing callback! */
parser->root.error = t42_load_keyword( face,