Commit 693f56ffcdb91512b1d40ac45b1c503bef978b81

Werner Lemberg 2017-01-23T12:53:18

[base] Add `FT_Set_Default_Properties' (#49187). * include/freetype/ftmodapi.h: Add declaration. * src/base/ftinit.c (ft_set_default_properties): Renamed to... (FT_Set_Default_Properties): ... this. (FT_Init_FreeType): Updated. * docs/CHANGES: Updated.

diff --git a/ChangeLog b/ChangeLog
index 4a41490..788685c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2017-01-23  Werner Lemberg  <wl@gnu.org>
 
+	[base] Add `FT_Set_Default_Properties' (#49187).
+
+	* include/freetype/ftmodapi.h: Add declaration.
+
+	* src/base/ftinit.c (ft_set_default_properties): Renamed to...
+	(FT_Set_Default_Properties): ... this.
+	(FT_Init_FreeType): Updated.
+
+	* docs/CHANGES: Updated.
+
+2017-01-23  Werner Lemberg  <wl@gnu.org>
+
 	[truetype] Minor updates for OpenType 1.8.1.
 
 	* src/truetype/ttgxvar.h (GX_MVarTable): `axisCount' has been
diff --git a/docs/CHANGES b/docs/CHANGES
index da52047..be7e149 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -15,6 +15,15 @@ CHANGES BETWEEN 2.7.1 and 2.7.2
     - Variations font support now takes care of the `MVAR' table also.
 
 
+  II. MISCELLANEOUS
+
+    - A  new function  `FT_Set_Default_Properties' has  been added  to
+      parse    the    `FREETYPE_PROPERTIES'    environment    variable
+      (previously, it  was internal only).   `FT_Init_FreeType' always
+      call this  function, but  `FT_New_Library' does not  (similar to
+      `FT_Add_Default_Modules').
+
+
 ======================================================================
 
 CHANGES BETWEEN 2.7 and 2.7.1
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index d51e4fe..bd24b83 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1833,7 +1833,8 @@ FT_BEGIN_HEADER
   /* <Note>                                                                */
   /*    In case you want to provide your own memory allocating routines,   */
   /*    use @FT_New_Library instead, followed by a call to                 */
-  /*    @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module).  */
+  /*    @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module)   */
+  /*    and @FT_Set_Default_Properties.                                    */
   /*                                                                       */
   /*    See the documentation of @FT_Library and @FT_Face for              */
   /*    multi-threading issues.                                            */
@@ -1841,6 +1842,11 @@ FT_BEGIN_HEADER
   /*    If you need reference-counting (cf. @FT_Reference_Library), use    */
   /*    @FT_New_Library and @FT_Done_Library.                              */
   /*                                                                       */
+  /*    If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is   */
+  /*    set, this function reads the `FREETYPE_PROPERTIES' environment     */
+  /*    variable to control driver properties.  See sections @auto_hinter, */
+  /*    @cff_driver, @pcf_driver, and @tt_driver for more.                 */
+  /*                                                                       */
   FT_EXPORT( FT_Error )
   FT_Init_FreeType( FT_Library  *alibrary );
 
diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h
index d5bf376..4147aad 100644
--- a/include/freetype/ftmodapi.h
+++ b/include/freetype/ftmodapi.h
@@ -89,6 +89,7 @@ FT_BEGIN_HEADER
   /*                                                                       */
   /*    FT_Property_Set                                                    */
   /*    FT_Property_Get                                                    */
+  /*    FT_Set_Default_Properties                                          */
   /*                                                                       */
   /*    FT_New_Library                                                     */
   /*    FT_Done_Library                                                    */
@@ -440,6 +441,47 @@ FT_BEGIN_HEADER
   /*************************************************************************/
   /*                                                                       */
   /* <Function>                                                            */
+  /*    FT_Set_Default_Properties                                          */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    If compilation option FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES is   */
+  /*    set, this function reads the `FREETYPE_PROPERTIES' environment     */
+  /*    variable to control driver properties.  See sections @auto_hinter, */
+  /*    @cff_driver, @pcf_driver, and @tt_driver for more.                 */
+  /*                                                                       */
+  /*    If the compilation option is not set, this function does nothing.  */
+  /*                                                                       */
+  /*    `FREETYPE_PROPERTIES' has the following syntax form (broken here   */
+  /*    into multiple lines for better readability).                       */
+  /*                                                                       */
+  /*    {                                                                  */
+  /*      <optional whitespace>                                            */
+  /*      <module-name1> ':'                                               */
+  /*      <property-name1> '=' <property-value1>                           */
+  /*      <whitespace>                                                     */
+  /*      <module-name2> ':'                                               */
+  /*      <property-name2> '=' <property-value2>                           */
+  /*      ...                                                              */
+  /*    }                                                                  */
+  /*                                                                       */
+  /*    Example:                                                           */
+  /*                                                                       */
+  /*    {                                                                  */
+  /*      FREETYPE_PROPERTIES=truetype:interpreter-version=35 \            */
+  /*                          cff:no-stem-darkening=1 \                    */
+  /*                          autofitter:warping=1                         */
+  /*    }                                                                  */
+  /*                                                                       */
+  /* <InOut>                                                               */
+  /*    library :: A handle to a new library object.                       */
+  /*                                                                       */
+  FT_EXPORT( void )
+  FT_Set_Default_Properties( FT_Library  library );
+
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
   /*    FT_Reference_Library                                               */
   /*                                                                       */
   /* <Description>                                                         */
@@ -477,8 +519,9 @@ FT_BEGIN_HEADER
   /*    valid for the life of the @FT_Library object.                      */
   /*                                                                       */
   /*    Normally, you would call this function (followed by a call to      */
-  /*    @FT_Add_Default_Modules or a series of calls to @FT_Add_Module)    */
-  /*    instead of @FT_Init_FreeType to initialize the FreeType library.   */
+  /*    @FT_Add_Default_Modules or a series of calls to @FT_Add_Module,    */
+  /*    and a call to @FT_Set_Default_Properties) instead of               */
+  /*    @FT_Init_FreeType to initialize the FreeType library.              */
   /*                                                                       */
   /*    Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a      */
   /*    library instance.                                                  */
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index 1c4b76f..b3b08fa 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -230,31 +230,10 @@
 
 #define MAX_LENGTH  128
 
-  /*
-   * Set default properties derived from the `FREETYPE_PROPERTIES'
-   * environment variable.
-   *
-   * `FREETYPE_PROPERTIES' has the following syntax form (broken here into
-   * multiple lines for better readability)
-   *
-   *   <optional whitespace>
-   *   <module-name1> ':'
-   *   <property-name1> '=' <property-value1>
-   *   <whitespace>
-   *   <module-name2> ':'
-   *   <property-name2> '=' <property-value2>
-   *   ...
-   *
-   * Example:
-   *
-   *   FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
-   *                       cff:no-stem-darkening=1 \
-   *                       autofitter:warping=1
-   *
-   */
-
-  static void
-  ft_set_default_properties( FT_Library  library )
+  /* documentation is in ftmodapi.h */
+
+  FT_EXPORT_DEF( void )
+  FT_Set_Default_Properties( FT_Library  library )
   {
     const char*  env;
     const char*  p;
@@ -326,8 +305,8 @@
 
 #else
 
-  static void
-  ft_set_default_properties( FT_Library  library )
+  FT_EXPORT_DEF( void )
+  FT_Set_Default_Properties( FT_Library  library )
   {
     FT_UNUSED( library );
   }
@@ -365,7 +344,7 @@
     else
       FT_Add_Default_Modules( *alibrary );
 
-    ft_set_default_properties( *alibrary );
+    FT_Set_Default_Properties( *alibrary );
 
     return error;
   }