Add FT_Get_PS_Font_Info interface to CFF driver.
* src/cff/cfftypes.h: Include FT_TYPE1_TABLES_H. (CFF_FontRec): Add `font_info' field. * src/cff/cffload.c: Include FT_TYPE1_TABLES_H. (cff_font_done): Free font->font_info if necessary. * src/cff/cffdrvr.c (cff_ps_get_font_info): New function. (cff_service_ps_info): Register cff_ps_get_font_info.
This commit is contained in:
parent
b0398be6b8
commit
ac250b228a
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2007-01-13 Derek Clegg <dclegg@apple.com>
|
||||
|
||||
Add FT_Get_PS_Font_Info interface to CFF driver.
|
||||
|
||||
* src/cff/cfftypes.h: Include FT_TYPE1_TABLES_H.
|
||||
(CFF_FontRec): Add `font_info' field.
|
||||
|
||||
* src/cff/cffload.c: Include FT_TYPE1_TABLES_H.
|
||||
(cff_font_done): Free font->font_info if necessary.
|
||||
|
||||
* src/cff/cffdrvr.c (cff_ps_get_font_info): New function.
|
||||
(cff_service_ps_info): Register cff_ps_get_font_info.
|
||||
|
||||
2007-01-13 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/base/ftoutln.c (FT_Outline_Get_Orientation): Fix compilation
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* OpenType font driver implementation (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
|
||||
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -302,9 +302,57 @@
|
||||
}
|
||||
|
||||
|
||||
static FT_Error
|
||||
cff_ps_get_font_info( CFF_Face face,
|
||||
PS_FontInfoRec* afont_info )
|
||||
{
|
||||
CFF_Font cff = (CFF_Font)face->extra.data;
|
||||
FT_Error error = FT_Err_Ok;
|
||||
|
||||
|
||||
if ( cff && cff->font_info == NULL )
|
||||
{
|
||||
CFF_FontRecDict dict = &cff->top_font.font_dict;
|
||||
PS_FontInfoRec *font_info;
|
||||
FT_Memory memory = face->root.memory;
|
||||
|
||||
|
||||
if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
|
||||
goto Fail;
|
||||
|
||||
font_info->version = cff_index_get_sid_string( &cff->string_index,
|
||||
dict->version,
|
||||
cff->psnames );
|
||||
font_info->notice = cff_index_get_sid_string( &cff->string_index,
|
||||
dict->notice,
|
||||
cff->psnames );
|
||||
font_info->full_name = cff_index_get_sid_string( &cff->string_index,
|
||||
dict->full_name,
|
||||
cff->psnames );
|
||||
font_info->family_name = cff_index_get_sid_string( &cff->string_index,
|
||||
dict->family_name,
|
||||
cff->psnames );
|
||||
font_info->weight = cff_index_get_sid_string( &cff->string_index,
|
||||
dict->weight,
|
||||
cff->psnames );
|
||||
font_info->italic_angle = dict->italic_angle;
|
||||
font_info->is_fixed_pitch = dict->is_fixed_pitch;
|
||||
font_info->underline_position = dict->underline_position;
|
||||
font_info->underline_thickness = dict->underline_thickness;
|
||||
|
||||
cff->font_info = font_info;
|
||||
}
|
||||
|
||||
*afont_info = *cff->font_info;
|
||||
|
||||
Fail:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
static const FT_Service_PsInfoRec cff_service_ps_info =
|
||||
{
|
||||
(PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */
|
||||
(PS_GetFontInfoFunc) cff_ps_get_font_info,
|
||||
(PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
|
||||
(PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */
|
||||
};
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
||||
#include FT_TRUETYPE_TAGS_H
|
||||
#include FT_TYPE1_TABLES_H
|
||||
|
||||
#include "cffload.h"
|
||||
#include "cffparse.h"
|
||||
@ -1582,6 +1583,16 @@
|
||||
|
||||
CFF_Done_FD_Select( &font->fd_select, font->stream );
|
||||
|
||||
if (font->font_info != NULL)
|
||||
{
|
||||
FT_FREE( font->font_info->version );
|
||||
FT_FREE( font->font_info->notice );
|
||||
FT_FREE( font->font_info->full_name );
|
||||
FT_FREE( font->font_info->family_name );
|
||||
FT_FREE( font->font_info->weight );
|
||||
FT_FREE( font->font_info );
|
||||
}
|
||||
|
||||
FT_FREE( font->global_subrs );
|
||||
FT_FREE( font->font_name );
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_TYPE1_TABLES_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
@ -255,6 +256,9 @@ FT_BEGIN_HEADER
|
||||
/* interface to Postscript Names service */
|
||||
void* psnames;
|
||||
|
||||
/* since version 2.3.0 */
|
||||
PS_FontInfoRec* font_info; /* font info dictionary */
|
||||
|
||||
} CFF_FontRec, *CFF_Font;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user