freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 3f3e3de34: * src/cff/cffobjs.c (cff_face_init): Bette


From: Werner Lemberg
Subject: [freetype2] master 3f3e3de34: * src/cff/cffobjs.c (cff_face_init): Better handling of Type0 fonts.
Date: Wed, 6 Nov 2024 00:35:35 -0500 (EST)

branch: master
commit 3f3e3de34ee3613d621b643c58a40b93148e0932
Author: Honnesh Ramachandra <hramachandra@adobe.com>
Commit: Werner Lemberg <wl@gnu.org>

    * src/cff/cffobjs.c (cff_face_init): Better handling of Type0 fonts.
    
    This issue relates to the PDF specification and its usage of CFF-based
    embedded Type0 fonts.  For Type0 fonts containing CID-keyed descendant
    CFF-based fonts, the glyph index is the CID present in the content stream.
    As a result, there is no requirement for a 'cmap' table to be present in the
    font since the glyph indices are derived directly from the CIDs.  FreeType
    throws an error when it doesn’t find a 'cmap' table for such an Open Type
    font containing CFF outlines.  This commit relaxes this requirement for a
    'cmap' table for such fonts.
---
 src/cff/cffobjs.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 7c6713739..dd4e82122 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -550,13 +550,13 @@
         if ( error )
           goto Exit;
       }
-      else
-      {
-        /* load the `cmap' table explicitly */
-        error = sfnt->load_cmap( face, stream );
-        if ( error )
-          goto Exit;
-      }
+
+      /* load the `cmap' table explicitly */
+      error = sfnt->load_cmap( face, stream );
+
+      /* this may fail because CID-keyed fonts don't have a cmap */
+      if ( FT_ERR_NEQ( error, Table_Missing ) && FT_ERR_NEQ( error, Ok ) )
+        goto Exit;
 
       /* now load the CFF part of the file; */
       /* give priority to CFF2              */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]