[cff] Add glyph name support for CFF2 using post table

Temporarily make sfnt_get_glyph_name() extern
Need to replace this with service interface.
This commit is contained in:
Dave Arnold 2016-11-18 15:29:13 -08:00
parent 88ad21fbe5
commit 8dba6305da
2 changed files with 23 additions and 7 deletions

View File

@ -38,6 +38,17 @@
#include "../truetype/ttgxvar.h"
#endif
/* TODO use services interface to link to these functions (in sfdriver.c) */
FT_EXPORT( FT_Error )
sfnt_get_glyph_name( TT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max );
FT_EXPORT( FT_UInt )
sfnt_get_name_index( TT_Face face,
FT_String* glyph_name );
#include "cfferrs.h"
#include "cffpic.h"
@ -297,12 +308,11 @@
FT_Error error;
/* TODO: for testing: cff2 does not have glyph names */
/* will need to use post table method */
/* CFF2 table does not have glyph names */
/* we need to use post table method */
if ( font->version_major == 2 )
{
FT_STRCPYN( buffer, "noname", buffer_max );
return FT_Err_Ok;
return sfnt_get_glyph_name( face, glyph_index, buffer, buffer_max );
}
if ( !font->psnames )
@ -342,10 +352,16 @@
FT_UShort sid;
FT_UInt i;
cff = (CFF_FontRec *)face->extra.data;
charset = &cff->charset;
/* CFF2 table does not have glyph names */
/* we need to use post table method */
if ( cff->version_major == 2 )
{
return sfnt_get_name_index( face, glyph_name );
}
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
if ( !psnames )
return 0;

View File

@ -151,7 +151,7 @@
*
*/
static FT_Error
FT_EXPORT_DEF( FT_Error )
sfnt_get_glyph_name( TT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
@ -169,7 +169,7 @@
}
static FT_UInt
FT_EXPORT_DEF( FT_UInt )
sfnt_get_name_index( TT_Face face,
FT_String* glyph_name )
{