From 3cc076dae765f3b3ed554fcf38dbe56edba422c3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 28 Apr 2015 09:16:27 +0200 Subject: [PATCH] [cff] Use `name' table for PS name if we have a SFNT-CFF. This follows the OpenType 1.7 specification. See http://tug.org/pipermail/tex-live/2015-April/036634.html for a discussion. * src/cff/cffdrivr.c (cff_get_ps_name): Use the `sfnt' service if we have an SFNT. --- ChangeLog | 13 +++++++++++++ src/cff/cffdrivr.c | 20 +++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8bac04c14..f86e05fcc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2015-04-28 Werner Lemberg + + [cff] Use `name' table for PS name if we have a SFNT-CFF. + + This follows the OpenType 1.7 specification. See + + http://tug.org/pipermail/tex-live/2015-April/036634.html + + for a discussion. + + * src/cff/cffdrivr.c (cff_get_ps_name): Use the `sfnt' service if we + have an SFNT. + 2015-04-27 Alexei Podtelezhnikov [truetype] Speed up IUP. diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index f46a1c574..a718b7a00 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -437,9 +437,27 @@ static const char* cff_get_ps_name( CFF_Face face ) { - CFF_Font cff = (CFF_Font)face->extra.data; + CFF_Font cff = (CFF_Font)face->extra.data; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; + /* following the OpenType specification 1.7, we return the name stored */ + /* in the `name' table for a CFF wrapped into an SFNT container */ + + if ( sfnt ) + { + FT_Library library = FT_FACE_LIBRARY( face ); + FT_Module sfnt_module = FT_Get_Module( library, "sfnt" ); + FT_Service_PsFontName service = + (FT_Service_PsFontName)ft_module_get_service( + sfnt_module, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME ); + + + if ( service && service->get_ps_font_name ) + return service->get_ps_font_name( FT_FACE( face ) ); + } + return (const char*)cff->font_name; }