freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] wl/sbix cd2b936f7 2/5: Add `FT_FACE_FLAG_SBIX_OUTLINE` and `


From: Werner Lemberg
Subject: [freetype2] wl/sbix cd2b936f7 2/5: Add `FT_FACE_FLAG_SBIX_OUTLINE` and `FT_HAS_SBIX_OUTLINE`.
Date: Sat, 19 Mar 2022 19:05:38 -0400 (EDT)

branch: wl/sbix
commit cd2b936f7a7035d9eb82565d45081ff4dbc317f4
Author: Werner Lemberg <wl@gnu.org>
Commit: Werner Lemberg <wl@gnu.org>

    Add `FT_FACE_FLAG_SBIX_OUTLINE` and `FT_HAS_SBIX_OUTLINE`.
    
    Fonts with 'sbix' tables need special handling by the application.
    
    * include/freetype/freetype.h (FT_FACE_FLAG_SBIX_OUTLINE,
    FT_HAS_SBIX_OUTLINE): New macros.
    
    * src/sfnt/sfobjs.c (sfnt_load_face): Set `FT_FACE_FLAG_SBIX_OUTLINE` if
    'sbix' table is present.
---
 include/freetype/freetype.h | 25 +++++++++++++++++++++++++
 src/sfnt/sfobjs.c           |  5 +++++
 2 files changed, 30 insertions(+)

diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 0bd06f1b8..ccad4145a 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -154,6 +154,7 @@ FT_BEGIN_HEADER
    *   FT_FACE_FLAG_EXTERNAL_STREAM
    *   FT_FACE_FLAG_HINTER
    *   FT_FACE_FLAG_SVG
+   *   FT_FACE_FLAG_SBIX_OUTLINE
    *
    *   FT_HAS_HORIZONTAL
    *   FT_HAS_VERTICAL
@@ -163,6 +164,7 @@ FT_BEGIN_HEADER
    *   FT_HAS_COLOR
    *   FT_HAS_MULTIPLE_MASTERS
    *   FT_HAS_SVG
+   *   FT_HAS_SBIX_OUTLINE
    *
    *   FT_IS_SFNT
    *   FT_IS_SCALABLE
@@ -1236,6 +1238,12 @@ FT_BEGIN_HEADER
    *
    *   FT_FACE_FLAG_SVG ::
    *     [Since 2.12] The face has an 'SVG~' OpenType table.
+   *
+   *   FT_FACE_FLAG_SBIX_OUTLINE ::
+   *     [Since 2.12] The face has an 'sbix' OpenType table *and* outlines.
+   *     For such fonts, @FT_FACE_FLAG_SCALABLE is not set by default to
+   *     retain backward compatibility.
+   *
    */
 #define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )
 #define FT_FACE_FLAG_FIXED_SIZES       ( 1L <<  1 )
@@ -1254,6 +1262,7 @@ FT_BEGIN_HEADER
 #define FT_FACE_FLAG_COLOR             ( 1L << 14 )
 #define FT_FACE_FLAG_VARIATION         ( 1L << 15 )
 #define FT_FACE_FLAG_SVG               ( 1L << 16 )
+#define FT_FACE_FLAG_SBIX_OUTLINE      ( 1L << 17 )
 
 
   /**************************************************************************
@@ -1510,6 +1519,22 @@ FT_BEGIN_HEADER
           ( !!( (face)->face_flags & FT_FACE_FLAG_SVG ) )
 
 
+  /**************************************************************************
+   *
+   * @macro:
+   *   FT_HAS_SBIX_OUTLINE
+   *
+   * @description:
+   *   A macro that returns true whenever a face object contains an 'sbix'
+   *   OpenType table *and* outline glyphs.
+   *
+   * @since:
+   *   2.12
+   */
+#define FT_HAS_SBIX_OUTLINE( face ) \
+          ( !!( (face)->face_flags & FT_FACE_FLAG_SBIX_OUTLINE ) )
+
+
   /**************************************************************************
    *
    * @enum:
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index f9d4d3858..eb2d4a133 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -1058,8 +1058,13 @@
         flags |= FT_FACE_FLAG_COLOR;      /* color glyphs */
 
       if ( has_outline == TRUE )
+      {
         flags |= FT_FACE_FLAG_SCALABLE;   /* scalable outlines */
 
+        if ( face->sbit_table_type == TT_SBIT_TABLE_TYPE_SBIX )
+          flags |= FT_FACE_FLAG_SBIX_OUTLINE;   /* and 'sbix' bitmaps */
+      }
+
       /* The sfnt driver only supports bitmap fonts natively, thus we */
       /* don't set FT_FACE_FLAG_HINTER.                               */
       flags |= FT_FACE_FLAG_SFNT       |  /* SFNT file format  */



reply via email to

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