[Fontconfig] [PATCH] don't artificially embolden fixed-width fonts

Raimund Steger rs at mytum.de
Sat Feb 14 05:02:54 PST 2015


On 02/12/15 01:32, Raimund Steger wrote:
>>>> [...]
>
> I'll have a look at them over the weekend. I think it should be possible
> to isolate the interesting part.

I've taken a look at 
freetype-entire-infinality-patchset-20130514-01.patch now and I think 
the relevant part is only the following (the patch contains other 
changes to emboldening, but these address unrelated things like pixel 
snapping):

diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index 241d37f..3d5a593 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -141,6 +173,9 @@

      slot->metrics.width       += xstr;
      slot->metrics.height      += ystr;
+#ifdef FT_CONFIG_OPTION_INFINALITY_PATCHSET
+    if ( !use_various_tweaks )
+#endif
      slot->metrics.horiAdvance += xstr;
      slot->metrics.vertAdvance += ystr;

If I replace the "if ( !use_various_tweaks )" with "if ( 
!FT_IS_FIXED_WIDTH( face ) )", I seem to come up with a patch that keeps 
the advance width for monospace fonts and leaves the rest unchanged. 
(Suggestion attached; note it's only created with quilt from a 2.5.5 
tarball.) I've put up screenshots of Lucida Console at 
http://steg0.eu/saurus/2015/02.emboldenmono/.

Could this already be it...??

Raimund

-- 
Worringer Str 31 Duesseldorf 40211 DE  home: <rs at mytum.de>
+49-179-2981632 icq 16845346           work: <rs at interface-ag.de>
-------------- next part --------------
Index: freetype-2.5.5/src/base/ftsynth.c
===================================================================
--- freetype-2.5.5.orig/src/base/ftsynth.c	2014-11-26 18:45:48.000000000 +0100
+++ freetype-2.5.5/src/base/ftsynth.c	2015-02-14 11:46:28.929503116 +0100
@@ -150,7 +150,10 @@
 
     slot->metrics.width        += xstr;
     slot->metrics.height       += ystr;
-    slot->metrics.horiAdvance  += xstr;
+    /* for mono-width fonts (like Andale, Courier, etc.) we need */
+    /* to keep the original advance width                        */
+    if ( !FT_IS_FIXED_WIDTH( face ) )
+      slot->metrics.horiAdvance  += xstr;
     slot->metrics.vertAdvance  += ystr;
     slot->metrics.horiBearingY += ystr;
 
Index: freetype-2.5.5/include/ftsynth.h
===================================================================
--- freetype-2.5.5.orig/include/ftsynth.h	2014-12-02 13:11:52.000000000 +0100
+++ freetype-2.5.5/include/ftsynth.h	2015-02-14 13:12:50.014546469 +0100
@@ -62,8 +62,10 @@
   /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden.           */
   /*                                                                       */
   /* For emboldened outlines the height, width, and advance metrics are    */
-  /* increased by the strength of the emboldening.  You can also call      */
-  /* @FT_Outline_Get_CBox to get precise values.                           */
+  /* increased by the strength of the emboldening.  (An exception to this  */
+  /* are mono-width fonts, where the horizontal advance metrics are left   */
+  /* unchanged.)  You can also call @FT_Outline_Get_CBox to get precise    */
+  /* values.                                                               */
   FT_EXPORT( void )
   FT_GlyphSlot_Embolden( FT_GlyphSlot  slot );
 


More information about the Fontconfig mailing list