shithub: freetype+ttf2subf

Download patch

ref: 3cc076dae765f3b3ed554fcf38dbe56edba422c3
parent: 40623a1f3adce02f7e6dcf395f0a50f58c2e2cf7
author: Werner Lemberg <[email protected]>
date: Tue Apr 28 05:16:27 EDT 2015

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2015-04-28  Werner Lemberg  <[email protected]>
+
+	[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 <[email protected]>
 
 	[truetype] Speed up IUP.
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -437,8 +437,26 @@
   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;
   }