freetype
[Top][All Lists]
Advanced

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

[ft] Change in monochrome rendered font behaviour from 2.5.0.1 to 2.5.1


From: follower
Subject: [ft] Change in monochrome rendered font behaviour from 2.5.0.1 to 2.5.1
Date: Thu, 11 Jun 2015 17:34:28 -0700

Hi,

I've encountered a change in behaviour which I've narrowed down to
being between libfreetype6 version 2.5.0.1 and 2.5.1 (I originally
encountered the issue moving code from 2.4.8 & 2.5.2 and can confirm
the new behaviour continues in 2.6).

Specifically, the change is that monochrome rendered fonts (in small
sizes for a low resolution display) appear noticeably "worse" unless
the `FT_LOAD_FORCE_AUTOHINT` option is supplied. It's not clear to me
if this is a bug or an intended change in behaviour.

The following demonstrates the difference in behaviour (when viewed
with a monospace font) with a 14 pt letter 'e' from
`DejaVuSansCondensed-Bold.ttf`:

LD_PRELOAD=../libfreetype6_2.4.8-1ubuntu2.2_amd64/usr/lib/x86_64-linux-gnu/libfreetype.so.6
python fontdemo.py
..###..
.#####.
##...##
#######
#######
##.....
.######
..####.

LD_PRELOAD=../libfreetype6_2.5.1-1ubuntu2_amd64/usr/lib/x86_64-linux-gnu/libfreetype.so.6
python fontdemo.py
..###..
######.
##..###
#######
#######
##.....
###..##
.######

Note particularly the bottom right curved portion of the 'e'. (Another
obvious character is 'f' where the vertical changes from 2 to 3 pixels
wide.)

The `fontdemo.py` file is from
<https://gist.githubusercontent.com/dbader/5488053/raw/b835eb8705ad954a0711248c4b52834243c8b28d/fontdemo.py>
via <https://dbader.org/blog/monochrome-font-rendering-with-freetype-and-python>
using `freetype-py`. But the original code I encountered this with
used the PIL/Pillow library in Python.

In the `fontdemo.py` code, when run with 2.5.1+, if I change this:

    self.face.load_char(char, freetype.FT_LOAD_RENDER |
freetype.FT_LOAD_TARGET_MONO)

to this:

    self.face.load_char(char, freetype.FT_LOAD_RENDER |
freetype.FT_LOAD_TARGET_MONO | freetype.FT_LOAD_FORCE_AUTOHINT)

the original behaviour is retained. Unfortunately PIL/Pillow does not
provide a way to supply this option AFAICT:

   
<https://github.com/python-pillow/Pillow/blob/1b2f6ae1b8ab89faba678208cae0d0d7007980ad/_imagingft.c#L371>

I seem to recall reading that there was some intentional change in
hinting/grid-fitting for monochrome fonts. Is what I'm seeing a bug or
is this an intentional change in behaviour?

Thanks!

--Philip;



reply via email to

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