freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] severe problems with subpixel hinting


From: Werner LEMBERG
Subject: Re: [ft-devel] severe problems with subpixel hinting
Date: Sat, 22 Dec 2012 10:27:29 +0100 (CET)

> > I'm unable to duplicate the first issue you mentioned, regarding
> > the B/W text.  When I run ftview as you stated, and hit 'a', the
> > result is the same as your first picture, with the well-hinted
> > monochrome characters.  So, something must be different between
> > our builds.
> 
> I see good results in ftview unless I turn on forced autohinting, then
> some of the stems are one pixel wider than the majority of the stems.
> 
> So, try hitting f to duplicate.

Hmm, with auto-hinting active it is rather *expected* to get bad B/W
hinting, so this is the wrong route.

Attached is a script which builds FreeType with and without subpixel
hinting in development mode (from the git repositories), then taking
snapshots in B/W mode. While testing the script, I've used Windows 7's
arial.ttf (version 5.10), but the results are the same as before.

You need `xdotool' and ImageMagick, BTW.


    Werner
#!/bin/sh
#
# Using X11, make two snapshots from `ftview' in B/W mode, with and without
# compile-time macro TT_CONFIG_OPTION_SUBPIXEL_HINTING.
#
# This script uses the FreeType git repositories, compiling the programs
# with development options in a temporary directory (`fttest.XXX').
#
# You need the `xdotool' program to send X11 keyboard events and to get
# Window IDs (note that some versions of `xdotool' are buggy, not correctly
# understanding the `--pid' option; it is thus assumed that there is no
# ftview window opened when running this script)
#
# Images are created with ImageMagick's `import' tool; after the script has
# finished, you can find them in the top level of the temporary directory.


# Adjust to your setup.
FT2_REP="/home/wl/git/freetype/freetype2"
FT2_DEMO_REP="/home/wl/git/freetype/freetype2-demos"
FONT="/usr/local/backup/Fonts Windows 7/ttf/arial.ttf"

IMG=`basename "$FONT" .ttf`

T=`mktemp -d fttest.XXX` || exit 1
D1="$T/without-subpixel-hinting"
D2="$T/with-subpixel-hinting"

git clone -l -s "$FT2_REP" "$D1/freetype2"
git clone -l -s "$FT2_DEMO_REP" "$D1/freetype2-demos"

(
  cd "$D1/freetype2"
  mv devel/ftoption.h devel/ftoption.h.orig
  sed 's|\(#define TT_CONFIG_OPTION_SUBPIXEL_HINTING\)|/* \1 */|' \
      < devel/ftoption.h.orig \
      > devel/ftoption.h

  make devel
  make
  cd ../freetype2-demos
  make

  cd ../..
  without-subpixel-hinting/freetype2-demos/bin/ftview 15 "$FONT" &
  sleep 1
  WID=`xdotool search --name "FreeType Glyph Viewer"`
  xdotool key --window $WID a
  sleep 1
  import -silent -window $WID "${IMG}-without-subpixel-hinting.png"
  sleep 1
  xdotool key --window $WID q
)

git clone -l -s "$FT2_REP" "$D2/freetype2"
git clone -l -s "$FT2_DEMO_REP" "$D2/freetype2-demos"

(
  cd "$D2/freetype2"

  make devel
  make
  cd ../freetype2-demos
  make

  cd ../..
  with-subpixel-hinting/freetype2-demos/bin/ftview 15 "$FONT" &
  sleep 1
  WID=`xdotool search --name "FreeType Glyph Viewer"`
  xdotool key --window $WID a
  sleep 1
  import -silent -window $WID "${IMG}-with-subpixel-hinting.png"
  sleep 1
  xdotool key --window $WID q
)

reply via email to

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