freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Force PMingLiU like font do HINTING


From: JustFillBug
Subject: [ft-devel] Force PMingLiU like font do HINTING
Date: Mon, 1 Dec 2008 13:23:55 +0000 (UTC)
User-agent: slrn/0.9.9 (Linux)


The "tricky" font like PMingLiU need unpatented hinting. Those fonts are
unusable at all when programmers accidently turns on FT_LOAD_NO_HINTING.
So I think freetype should force fonts like those to ignore
FT_LOAD_NO_HINTING.

And detecting of tricky font should be outside of this defines:

    #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING    ) && \
        !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )

otherwise, the fonts are not detected on my debian box.

diff -urb freetype-2.3.7.orig/include/freetype/internal/ftobjs.h 
freetype-2.3.7/include/freetype/internal/ftobjs.h
--- freetype-2.3.7.orig/include/freetype/internal/ftobjs.h      2008-12-01 
21:00:28.000000000 +0800
+++ freetype-2.3.7/include/freetype/internal/ftobjs.h   2008-12-01 
21:00:55.000000000 +0800
@@ -288,6 +288,7 @@
 #endif
 
     FT_Bool             ignore_unpatented_hinter;
+    FT_Bool             tricky_font;
 
   } FT_Face_InternalRec;
 
diff -urb freetype-2.3.7.orig/src/base/ftobjs.c freetype-2.3.7/src/base/ftobjs.c
--- freetype-2.3.7.orig/src/base/ftobjs.c       2008-12-01 21:00:28.000000000 
+0800
+++ freetype-2.3.7/src/base/ftobjs.c    2008-12-01 21:08:09.000000000 +0800
@@ -573,6 +573,9 @@
       load_flags &= ~FT_LOAD_RENDER;
     }
 
+    if (face->internal->tricky_font)
+       load_flags &= ~FT_LOAD_NO_HINTING;
+
     /*
      * Determine whether we need to auto-hint or not.
      * The general rules are:
diff -urb freetype-2.3.7.orig/src/truetype/ttobjs.c 
freetype-2.3.7/src/truetype/ttobjs.c
--- freetype-2.3.7.orig/src/truetype/ttobjs.c   2008-12-01 21:00:28.000000000 
+0800
+++ freetype-2.3.7/src/truetype/ttobjs.c        2008-12-01 21:06:11.000000000 
+0800
@@ -251,22 +251,24 @@
 
     }
 
-#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING    ) && \
-    !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
-
     {
       FT_Bool  unpatented_hinting;
-      int      i;
-
 
       /* Determine whether unpatented hinting is to be used for this face. */
       unpatented_hinting = FT_BOOL
         ( library->debug_hooks[FT_DEBUG_HOOK_UNPATENTED_HINTING] != NULL );
 
+#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING    ) && \
+    !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
+
+      int      i;
       for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )
         if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
           unpatented_hinting = TRUE;
 
+#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
+          !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+
       /* Compare the face with a list of well-known `tricky' fonts. */
       /* This list shall be expanded as we find more of them.       */
       if ( !unpatented_hinting )
@@ -292,6 +294,7 @@
                ft_strstr( ttface->family_name, trick_names[nn] ) )
           {
             unpatented_hinting = 1;
+           ttface->internal->tricky_font = TRUE;
             break;
           }
         }
@@ -301,8 +304,6 @@
         FT_BOOL( !unpatented_hinting );
     }
 
-#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
-          !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
     /* initialize standard glyph loading routines */
     TT_Init_Glyph_Loading( face );





reply via email to

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