shithub: freetype+ttf2subf

Download patch

ref: 141f0ea5abc2e5d44c8e82c353839ca497d5f34e
parent: 693f56ffcdb91512b1d40ac45b1c503bef978b81
author: Werner Lemberg <[email protected]>
date: Tue Jan 24 12:00:36 EST 2017

[truetype] For OpenType 1.7: s/preferred/typographic/ (sub)family.

* include/freetype/ftsnames.h
(FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY,
FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY): New macros.
(FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY,
FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Deprecated.

* include/freetype/ttnameid.h (TT_NAME_ID_TYPOGRAPHIC_FAMILY,
TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY): New macros.
(TT_NAME_ID_PREFERRED_FAMILY, TT_NAME_ID_PREFERRED_SUBFAMILY):
Deprecated.

* src/sfnt/sfobjs.c (sfnt_load_face): Updated.

* docs/CHANGES: Updated.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2017-01-24  Werner Lemberg  <[email protected]>
+
+	[truetype] For OpenType 1.7: s/preferred/typographic/ (sub)family.
+
+	* include/freetype/ftsnames.h
+	(FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY,
+	FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY): New macros.
+	(FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY,
+	FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Deprecated.
+
+	* include/freetype/ttnameid.h (TT_NAME_ID_TYPOGRAPHIC_FAMILY,
+	TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY): New macros.
+	(TT_NAME_ID_PREFERRED_FAMILY, TT_NAME_ID_PREFERRED_SUBFAMILY):
+	Deprecated.
+
+	* src/sfnt/sfobjs.c (sfnt_load_face): Updated.
+
+	* docs/CHANGES: Updated.
+
 2017-01-23  Werner Lemberg  <[email protected]>
 
 	[base] Add `FT_Set_Default_Properties' (#49187).
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -23,6 +23,22 @@
       call this  function, but  `FT_New_Library' does not  (similar to
       `FT_Add_Default_Modules').
 
+    - To be in sync with OpenType version 1.7 and newer, macros
+
+        FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY,
+        FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY,
+        TT_NAME_ID_PREFERRED_FAMILY
+	TT_NAME_ID_PREFERRED_SUBFAMILY
+
+      are renamed to
+
+        FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY,
+        FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY,
+        TT_NAME_ID_TYPOGRAPHIC_FAMILY
+        TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY
+
+      The old macro names are deprecated (but still available).
+
 
 ======================================================================
 
--- a/include/freetype/ftsnames.h
+++ b/include/freetype/ftsnames.h
@@ -162,31 +162,43 @@
   /***************************************************************************
    *
    * @constant:
-   *   FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY
+   *   FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
    *
    * @description:
-   *   A constant used as the tag of @FT_Parameter structures to make
-   *   FT_Open_Face() ignore preferred family subfamily names in `name'
-   *   table since OpenType version 1.4.  For backwards compatibility with
-   *   legacy systems that have a 4-face-per-family restriction.
+   *   A tag for @FT_Parameter to make @FT_Open_Face ignore typographic
+   *   family names in the `name' table (introduced in OpenType version
+   *   1.4).  Use this for backwards compatibility with legacy systems that
+   *   have a four-faces-per-family restriction.
    *
    */
-#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY  FT_MAKE_TAG( 'i', 'g', 'p', 'f' )
+#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY \
+          FT_MAKE_TAG( 'i', 'g', 'p', 'f' )
 
 
+  /* this constant is deprecated */
+#define FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY \
+          FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY
+
+
   /***************************************************************************
    *
    * @constant:
-   *   FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY
+   *   FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
    *
    * @description:
-   *   A constant used as the tag of @FT_Parameter structures to make
-   *   FT_Open_Face() ignore preferred subfamily names in `name' table since
-   *   OpenType version 1.4.  For backwards compatibility with legacy
-   *   systems that have a 4-face-per-family restriction.
+   *   A tag for @FT_Parameter to make @FT_Open_Face ignore typographic
+   *   subfamily names in the `name' table (introduced in OpenType version
+   *   1.4).  Use this for backwards compatibility with legacy systems that
+   *   have a four-faces-per-family restriction.
    *
    */
-#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY  FT_MAKE_TAG( 'i', 'g', 'p', 's' )
+#define FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY \
+          FT_MAKE_TAG( 'i', 'g', 'p', 's' )
+
+
+  /* this constant is deprecated */
+#define FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY \
+          FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY
 
   /* */
 
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1300,7 +1300,7 @@
   /*                                                                       */
   /*    sbit_table_size      :: The size of `sbit_table'.                  */
   /*                                                                       */
-  /*    sbit_table_type      :: The sbit table type (CBLC, SBIX, etc.).    */
+  /*    sbit_table_type      :: The sbit table type (CBLC, sbix, etc.).    */
   /*                                                                       */
   /*    sbit_num_strikes     :: The number of sbit strikes exposed by      */
   /*                            FreeType's API, omitting invalid strikes.  */
--- a/include/freetype/ttnameid.h
+++ b/include/freetype/ttnameid.h
@@ -786,46 +786,48 @@
    *   an SFNT `name' table.  These values are platform independent.
    */
 
-#define TT_NAME_ID_COPYRIGHT            0
-#define TT_NAME_ID_FONT_FAMILY          1
-#define TT_NAME_ID_FONT_SUBFAMILY       2
-#define TT_NAME_ID_UNIQUE_ID            3
-#define TT_NAME_ID_FULL_NAME            4
-#define TT_NAME_ID_VERSION_STRING       5
-#define TT_NAME_ID_PS_NAME              6
-#define TT_NAME_ID_TRADEMARK            7
+#define TT_NAME_ID_COPYRIGHT              0
+#define TT_NAME_ID_FONT_FAMILY            1
+#define TT_NAME_ID_FONT_SUBFAMILY         2
+#define TT_NAME_ID_UNIQUE_ID              3
+#define TT_NAME_ID_FULL_NAME              4
+#define TT_NAME_ID_VERSION_STRING         5
+#define TT_NAME_ID_PS_NAME                6
+#define TT_NAME_ID_TRADEMARK              7
 
   /* the following values are from the OpenType spec */
-#define TT_NAME_ID_MANUFACTURER         8
-#define TT_NAME_ID_DESIGNER             9
-#define TT_NAME_ID_DESCRIPTION          10
-#define TT_NAME_ID_VENDOR_URL           11
-#define TT_NAME_ID_DESIGNER_URL         12
-#define TT_NAME_ID_LICENSE              13
-#define TT_NAME_ID_LICENSE_URL          14
+#define TT_NAME_ID_MANUFACTURER           8
+#define TT_NAME_ID_DESIGNER               9
+#define TT_NAME_ID_DESCRIPTION            10
+#define TT_NAME_ID_VENDOR_URL             11
+#define TT_NAME_ID_DESIGNER_URL           12
+#define TT_NAME_ID_LICENSE                13
+#define TT_NAME_ID_LICENSE_URL            14
   /* number 15 is reserved */
-#define TT_NAME_ID_PREFERRED_FAMILY     16
-#define TT_NAME_ID_PREFERRED_SUBFAMILY  17
-#define TT_NAME_ID_MAC_FULL_NAME        18
+#define TT_NAME_ID_TYPOGRAPHIC_FAMILY     16
+#define TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY  17
+#define TT_NAME_ID_MAC_FULL_NAME          18
 
   /* The following code is new as of 2000-01-21 */
-#define TT_NAME_ID_SAMPLE_TEXT          19
+#define TT_NAME_ID_SAMPLE_TEXT            19
 
   /* This is new in OpenType 1.3 */
-#define TT_NAME_ID_CID_FINDFONT_NAME    20
+#define TT_NAME_ID_CID_FINDFONT_NAME      20
 
   /* This is new in OpenType 1.5 */
-#define TT_NAME_ID_WWS_FAMILY           21
-#define TT_NAME_ID_WWS_SUBFAMILY        22
+#define TT_NAME_ID_WWS_FAMILY             21
+#define TT_NAME_ID_WWS_SUBFAMILY          22
 
   /* This is new in OpenType 1.7 */
-#define TT_NAME_ID_LIGHT_BACKGROUND     23
-#define TT_NAME_ID_DARK_BACKGROUND      24
+#define TT_NAME_ID_LIGHT_BACKGROUND       23
+#define TT_NAME_ID_DARK_BACKGROUND        24
 
   /* This is new in OpenType 1.8 */
-#define TT_NAME_ID_VARIATIONS_PREFIX    25
+#define TT_NAME_ID_VARIATIONS_PREFIX      25
 
-  /* */
+  /* these two values are deprecated */
+#define TT_NAME_ID_PREFERRED_FAMILY     TT_NAME_ID_TYPOGRAPHIC_FAMILY
+#define TT_NAME_ID_PREFERRED_SUBFAMILY  TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY
 
 
   /***********************************************************************
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -1079,8 +1079,8 @@
     FT_Bool       has_outline;
     FT_Bool       is_apple_sbit;
     FT_Bool       is_apple_sbix;
-    FT_Bool       ignore_preferred_family    = FALSE;
-    FT_Bool       ignore_preferred_subfamily = FALSE;
+    FT_Bool       ignore_typographic_family    = FALSE;
+    FT_Bool       ignore_typographic_subfamily = FALSE;
 
     SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
 
@@ -1095,10 +1095,10 @@
 
       for ( i = 0; i < num_params; i++ )
       {
-        if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY )
-          ignore_preferred_family = TRUE;
-        else if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY )
-          ignore_preferred_subfamily = TRUE;
+        if ( params[i].tag == FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_FAMILY )
+          ignore_typographic_family = TRUE;
+        else if ( params[i].tag == FT_PARAM_TAG_IGNORE_TYPOGRAPHIC_SUBFAMILY )
+          ignore_typographic_subfamily = TRUE;
       }
     }
 
@@ -1281,13 +1281,13 @@
     face->root.style_name  = NULL;
     if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
     {
-      if ( !ignore_preferred_family )
-        GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
+      if ( !ignore_typographic_family )
+        GET_NAME( TYPOGRAPHIC_FAMILY, &face->root.family_name );
       if ( !face->root.family_name )
         GET_NAME( FONT_FAMILY, &face->root.family_name );
 
-      if ( !ignore_preferred_subfamily )
-        GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
+      if ( !ignore_typographic_subfamily )
+        GET_NAME( TYPOGRAPHIC_SUBFAMILY, &face->root.style_name );
       if ( !face->root.style_name )
         GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
     }
@@ -1294,14 +1294,14 @@
     else
     {
       GET_NAME( WWS_FAMILY, &face->root.family_name );
-      if ( !face->root.family_name && !ignore_preferred_family )
-        GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
+      if ( !face->root.family_name && !ignore_typographic_family )
+        GET_NAME( TYPOGRAPHIC_FAMILY, &face->root.family_name );
       if ( !face->root.family_name )
         GET_NAME( FONT_FAMILY, &face->root.family_name );
 
       GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
-      if ( !face->root.style_name && !ignore_preferred_subfamily )
-        GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
+      if ( !face->root.style_name && !ignore_typographic_subfamily )
+        GET_NAME( TYPOGRAPHIC_SUBFAMILY, &face->root.style_name );
       if ( !face->root.style_name )
         GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
     }