shithub: freetype+ttf2subf

Download patch

ref: 693f56ffcdb91512b1d40ac45b1c503bef978b81
parent: f502092bcd6f86c24e119aee76622ba3849e25e8
author: Werner Lemberg <[email protected]>
date: Mon Jan 23 07:53:18 EST 2017

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2017-01-23  Werner Lemberg  <[email protected]>
 
+	[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  <[email protected]>
+
 	[truetype] Minor updates for OpenType 1.8.1.
 
 	* src/truetype/ttgxvar.h (GX_MVarTable): `axisCount' has been
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -15,6 +15,15 @@
     - 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
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1833,7 +1833,8 @@
   /* <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.                                            */
@@ -1840,6 +1841,11 @@
   /*                                                                       */
   /*    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 );
--- a/include/freetype/ftmodapi.h
+++ b/include/freetype/ftmodapi.h
@@ -89,6 +89,7 @@
   /*                                                                       */
   /*    FT_Property_Set                                                    */
   /*    FT_Property_Get                                                    */
+  /*    FT_Set_Default_Properties                                          */
   /*                                                                       */
   /*    FT_New_Library                                                     */
   /*    FT_Done_Library                                                    */
@@ -440,6 +441,47 @@
   /*************************************************************************/
   /*                                                                       */
   /* <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 @@
   /*    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.                                                  */
--- 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
-   *
-   */
+  /* documentation is in ftmodapi.h */
 
-  static void
-  ft_set_default_properties( FT_Library  library )
+  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;
   }