Commit 481b25f00969549816b94e5d2d1f7d75d1cd930f

David Turner 2007-07-01T09:51:15

* include/freetype/freetype.h, src/base/ftpatent.c: adding FT_Face_SetUnpatentedHinting to dynamically change the setting after a face is created.

diff --git a/ChangeLog b/ChangeLog
index fc3982e..9424ca8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2007-07-01  David Turner  <david@freetype.org>
 
+	* include/freetype/freetype.h, src/base/ftpatent.c: adding
+	FT_Face_SetUnpatentedHinting to dynamically change the setting
+	after a face is created.
+
 	* src/truetype/ttgload.c: fix a small bug that created distortions
 	in the bytecode interpreter results
 
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 2ff95f7..726599d 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -3389,9 +3389,37 @@ FT_BEGIN_HEADER
   /*    1 if this is a TrueType font that uses one of the patented         */
   /*    opcodes, 0 otherwise.                                              */
   /*                                                                       */
+  /* <Since> 2.3.5                                                         */
+  /*                                                                       */
   FT_EXPORT( FT_Bool )
   FT_Face_CheckTrueTypePatents( FT_Face  face );
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* <Function>                                                            */
+  /*    FT_Face_SetUnpatentedHinting                                       */
+  /*                                                                       */
+  /* <Description>                                                         */
+  /*    Enable or disable the unpatented hinter for a given face.          */
+  /*    Only enable it if you have determined that the face doesn't        */
+  /*    use any patented opcodes (see @FT_Face_CheckTrueTypePatents).      */
+  /*                                                                       */
+  /* <Input>                                                               */
+  /*    face  :: A face handle.                                            */
+  /*    value :: new boolean setting                                       */
+  /*                                                                       */
+  /* <Return>                                                              */
+  /*    the old setting value. this will always be false if this is not    */
+  /*    a SFNT font, or if the unpatented hinter is not compiled in the    */
+  /*    this instance of the library.                                      */
+  /*                                                                       */
+  /* <Since> 2.3.5                                                         */
+  /*                                                                       */
+  FT_EXPORT( FT_Bool )
+  FT_Face_SetUnpatentedHinting( FT_Face   face,
+                                FT_Bool   value );
+
   /* */
 
 
diff --git a/src/base/ftpatent.c b/src/base/ftpatent.c
index a2bda8f..f598a3c 100644
--- a/src/base/ftpatent.c
+++ b/src/base/ftpatent.c
@@ -246,7 +246,7 @@
   {
     FT_Bool  result = FALSE;
 
-  
+
     if ( face && FT_IS_SFNT( face ) )
       result = _tt_face_check_patents( face );
 
@@ -254,4 +254,25 @@
   }
 
 
+  FT_EXPORT_DEF( FT_Bool )
+  FT_Face_SetUnpatentedHinting( FT_Face   face,
+                                FT_Bool   value )
+  {
+    FT_Bool  result = 0;
+
+#if defined(TT_CONFIG_OPTION_UNPATENTED_HINTING) && \
+   !defined(TT_CONFIG_OPTION_BYTECODE_INTEPRETER)
+    if ( face && FT_IS_SFNT(face) )
+    {
+      result = !face->internal->ignore_unpatented_hinter;
+      face->internal->ignore_unpatented_hinter = !value;
+    }
+#else
+    FT_UNUSED(face);
+    FT_UNUSED(value);
+#endif
+
+    return  result;
+  }
+
 /* END */