freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 0f0912e: [ftcommon] Improve loading of font col


From: Werner LEMBERG
Subject: [freetype2-demos] master 0f0912e: [ftcommon] Improve loading of font collections.
Date: Tue, 04 Aug 2015 07:44:10 +0000

branch: master
commit 0f0912e268fd6c09c423900a1a9775b02b263270
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftcommon] Improve loading of font collections.
    
    * src/ftcommon.c (FTDemo_Install_Font): Don't exit if first face of
    a font is invalid.
    Don't exit if we want outline fonts only and the first face isn't.
    Don't exit if there are problems with the cmap.
    
    In all three cases, simply skip the font face.
---
 ChangeLog      |   11 +++++++++++
 src/ftcommon.c |   23 ++++++++++++-----------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ee1881a..286f093 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-07-08  Werner Lemberg  <address@hidden>
+
+       [ftcommon] Improve loading of font collections.
+
+       * src/ftcommon.c (FTDemo_Install_Font): Don't exit if first face of
+       a font is invalid.
+       Don't exit if we want outline fonts only and the first face isn't.
+       Don't exit if there are problems with the cmap.
+
+       In all three cases, simply skip the font face.
+
 2015-06-07  Werner Lemberg  <address@hidden>
 
        * Version 2.6 released.
diff --git a/src/ftcommon.c b/src/ftcommon.c
index b2cf8d0..5940a26 100644
--- a/src/ftcommon.c
+++ b/src/ftcommon.c
@@ -367,25 +367,26 @@
     strncpy( filename, filepath, len );
     filename[len] = 0;
 
-    error = FT_New_Face( handle->library, filename, 0, &face );
+    error = FT_New_Face( handle->library, filename, -1, &face );
     if ( error )
       return error;
-
-    if ( outline_only && !FT_IS_SCALABLE( face ) )
-      return FT_Err_Invalid_Argument;
-
-    /* allocate new font object */
     num_faces = face->num_faces;
+    FT_Done_Face( face );
+
+    /* allocate new font object(s) */
     for ( i = 0; i < num_faces; i++ )
     {
       PFont  font;
 
 
-      if ( i > 0 )
+      error = FT_New_Face( handle->library, filename, i, &face );
+      if ( error )
+        continue;
+
+      if ( outline_only && !FT_IS_SCALABLE( face ) )
       {
-        error = FT_New_Face( handle->library, filename, i, &face );
-        if ( error )
-          continue;
+        FT_Done_Face( face );
+        continue;
       }
 
       if ( handle->encoding != FT_ENCODING_NONE )
@@ -394,7 +395,7 @@
         if ( error )
         {
           FT_Done_Face( face );
-          return error;
+          continue;
         }
       }
 



reply via email to

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