freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master ccd3188: Allow native CFF hinter in FT_RENDER_MODE_LI


From: Werner LEMBERG
Subject: [freetype2] master ccd3188: Allow native CFF hinter in FT_RENDER_MODE_LIGHT.
Date: Tue, 10 Nov 2015 21:34:15 +0000

branch: master
commit ccd3188af18fc0e96a105ec68483e815209b9981
Author: Jan Alexander Steffens (heftig) <address@hidden>
Commit: Werner Lemberg <address@hidden>

    Allow native CFF hinter in FT_RENDER_MODE_LIGHT.
    
    Both the native CFF hinter and the auto-hinter now have a very
    similar rendering style.
    
    * include/freetype/freetype.h: Mention that FT_LOAD_TARGET_LIGHT no
    longer implies FT_LOAD_FORCE_AUTOHINT.
    
    * include/freetype/ftmodapi.h (FT_MODULE_DRIVER_HINTS_LIGHTLY): New
    macro.
    
    * include/freetype/internal/ftobjs.h (FT_DRIVER_HINTS_LIGHTLY): New
    macro.
    
    * src/cff/cffdrivr.c (cff_driver_class): Use it.
    
    * src/base/ftobjs.c (FT_Load_Glyph): Update auto-hinter selection
    logic.
---
 ChangeLog                          |   21 +++++++++++++++++++++
 include/freetype/freetype.h        |    5 -----
 include/freetype/ftmodapi.h        |   15 +++++++++------
 include/freetype/internal/ftobjs.h |    3 +++
 src/base/ftobjs.c                  |    3 ++-
 src/cff/cffdrivr.c                 |    7 ++++---
 6 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 09475eb..b348dbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2015-11-10  Jan Alexander Steffens (heftig)  <address@hidden>
+
+       Allow native CFF hinter in FT_RENDER_MODE_LIGHT.
+
+       Both the native CFF hinter and the auto-hinter now have a very
+       similar rendering style.
+
+       * include/freetype/freetype.h: Mention that FT_LOAD_TARGET_LIGHT no
+       longer implies FT_LOAD_FORCE_AUTOHINT.
+
+       * include/freetype/ftmodapi.h (FT_MODULE_DRIVER_HINTS_LIGHTLY): New
+       macro.
+
+       * include/freetype/internal/ftobjs.h (FT_DRIVER_HINTS_LIGHTLY): New
+       macro.
+
+       * src/cff/cffdrivr.c (cff_driver_class): Use it.
+
+       * src/base/ftobjs.c (FT_Load_Glyph): Update auto-hinter selection
+       logic.
+
 2015-11-09  Werner Lemberg  <address@hidden>
 
        * src/cid/cidload.c (cid_face_open): Fix GDBytes guard (#46408).
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index b6247f5..c239f1b 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -2821,9 +2821,6 @@ FT_BEGIN_HEADER
    *   have specified (e.g., the TrueType bytecode interpreter).  You can set
    *   @FT_LOAD_FORCE_AUTOHINT to ensure that the auto-hinter is used.
    *
-   *   Also note that @FT_LOAD_TARGET_LIGHT is an exception, in that it
-   *   always implies @FT_LOAD_FORCE_AUTOHINT.
-   *
    * @values:
    *   FT_LOAD_TARGET_NORMAL ::
    *     This corresponds to the default hinting algorithm, optimized for
@@ -2835,8 +2832,6 @@ FT_BEGIN_HEADER
    *     generated glyphs are more fuzzy but better resemble its original
    *     shape.  A bit like rendering on Mac OS~X.
    *
-   *     As a special exception, this target implies @FT_LOAD_FORCE_AUTOHINT.
-   *
    *   FT_LOAD_TARGET_MONO ::
    *     Strong hinting algorithm that should only be used for monochrome
    *     output.  The result is probably unpleasant if the glyph is rendered
diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h
index 544279a..89d9347 100644
--- a/include/freetype/ftmodapi.h
+++ b/include/freetype/ftmodapi.h
@@ -111,12 +111,14 @@ FT_BEGIN_HEADER
 #define FT_MODULE_HINTER              4  /* this module is a glyph hinter */
 #define FT_MODULE_STYLER              8  /* this module is a styler       */
 
-#define FT_MODULE_DRIVER_SCALABLE     0x100   /* the driver supports      */
+#define FT_MODULE_DRIVER_SCALABLE      0x100  /* the driver supports      */
                                               /* scalable fonts           */
-#define FT_MODULE_DRIVER_NO_OUTLINES  0x200   /* the driver does not      */
+#define FT_MODULE_DRIVER_NO_OUTLINES   0x200  /* the driver does not      */
                                               /* support vector outlines  */
-#define FT_MODULE_DRIVER_HAS_HINTER   0x400   /* the driver provides its  */
+#define FT_MODULE_DRIVER_HAS_HINTER    0x400  /* the driver provides its  */
                                               /* own hinter               */
+#define FT_MODULE_DRIVER_HINTS_LIGHTLY 0x800  /* the driver's hinter      */
+                                              /* produces LIGHT hints     */
 
 
   /* deprecated values */
@@ -125,9 +127,10 @@ FT_BEGIN_HEADER
 #define ft_module_hinter              FT_MODULE_HINTER
 #define ft_module_styler              FT_MODULE_STYLER
 
-#define ft_module_driver_scalable     FT_MODULE_DRIVER_SCALABLE
-#define ft_module_driver_no_outlines  FT_MODULE_DRIVER_NO_OUTLINES
-#define ft_module_driver_has_hinter   FT_MODULE_DRIVER_HAS_HINTER
+#define ft_module_driver_scalable       FT_MODULE_DRIVER_SCALABLE
+#define ft_module_driver_no_outlines    FT_MODULE_DRIVER_NO_OUTLINES
+#define ft_module_driver_has_hinter     FT_MODULE_DRIVER_HAS_HINTER
+#define ft_module_driver_hints_lightly  FT_MODULE_DRIVER_HINTS_LIGHTLY
 
 
   typedef FT_Pointer  FT_Module_Interface;
diff --git a/include/freetype/internal/ftobjs.h 
b/include/freetype/internal/ftobjs.h
index da5582d..9a333fc 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -506,6 +506,9 @@ FT_BEGIN_HEADER
 #define FT_DRIVER_HAS_HINTER( x )  ( FT_MODULE_CLASS( x )->module_flags & \
                                      FT_MODULE_DRIVER_HAS_HINTER )
 
+#define FT_DRIVER_HINTS_LIGHTLY( x )  ( FT_MODULE_CLASS( x )->module_flags & \
+                                        FT_MODULE_DRIVER_HINTS_LIGHTLY )
+
 
   /*************************************************************************/
   /*                                                                       */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index dc3a513..ea40396 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -686,7 +686,8 @@
         /* check the size of the `fpgm' and `prep' tables, too --    */
         /* the assumption is that there don't exist real TTFs where  */
         /* both `fpgm' and `prep' tables are missing                 */
-        if ( mode == FT_RENDER_MODE_LIGHT                       ||
+        if ( ( mode == FT_RENDER_MODE_LIGHT                   &&
+               !FT_DRIVER_HINTS_LIGHTLY( driver ) )             ||
              face->internal->ignore_unpatented_hinter           ||
              ( FT_IS_SFNT( face )                             &&
                ttface->num_locations                          &&
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 9fbc1eb..9a06b7c 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -870,9 +870,10 @@
   FT_DEFINE_DRIVER(
     cff_driver_class,
 
-      FT_MODULE_FONT_DRIVER       |
-      FT_MODULE_DRIVER_SCALABLE   |
-      FT_MODULE_DRIVER_HAS_HINTER,
+      FT_MODULE_FONT_DRIVER          |
+      FT_MODULE_DRIVER_SCALABLE      |
+      FT_MODULE_DRIVER_HAS_HINTER    |
+      FT_MODULE_DRIVER_HINTS_LIGHTLY,
 
       sizeof ( CFF_DriverRec ),
       "cff",



reply via email to

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