[ltp] font rendering
Christoph Singer
linux-thinkpad@linux-thinkpad.org
Sat, 03 Jul 2004 14:02:09 +0200
On 02.07.2004 12:23, Hartwig, Thomas wrote:
> I don't like the antialiasing thing in Mozilla, because it makes thing
> less readable with small font settings. But if I turn off antialiasing
> the standard TTF fonts from windows look very crispy in it. I have
> tested a lot and even converted the fonts to Type1 ones, but nothing
> helped. Finally I made the windows fonts not available any more.
>
> Do you have a tip for me, or do the windows fonts simply not work with
> linux?
There are 2 differences in font rendering between Windows and current
Linux systems:
1. In Windows, TrueType instructions are executed to produce better
output at small sizes. In most current Linux distributions, however,
those TrueType instructions are ignored by the font rendering engine
Freetype2 because of patent issues, though FreeType is capable of
executing TrueType instructions if compiled with the "byte code
interpreter" enabled. That's why TrueType fonts look so ugly in Linux
when antialiasing is disabled.
2. In TrueType fonts there is a special table that tells the system not
to do antialiasing at small sizes (typically between 11 pixels and 17
pixels font height). Windows does this as specified in the font, Linux
(Freetype) ignores those settings (imho, again a patent issue). But you
can set this in your .fonts.conf file.
If you want your fonts in Linux look exactly like they look in Windows
(this IS really possible!), you have to do 2 things:
1. enable the byte code interpreter in Freetype (requires recompiling of
Freetype)
2. edit your .fonts.conf to disable anti-aliasing between 11 pixels and
17 pixels resp. 8 and 13 pt (at 96 dpi).
Step 1 (recompiling Freetype):
I don't use Fedora and that's why I don't know how recompiling of
Freetype can be done the easiest way.
In SuSE, I do the following (this is always my first step after
installing a new SuSE system; since Fedora is rpm-based, too, I guess it
should be similar to do):
- install the source rpm of Freetype2
- in /usr/src/packages/SPECS/freetype2.spec, find the following lines:
# Remove the comment character in front ot the '%patch100' line
# if you want to turn on the bytecode interpreter.
# But first read http://www.freetype.org/freetype2/2.1.3-explained.html
# I.3. Do I still need to enable the TrueType bytecode interpreter ?
#
# Short answer: No for most people !!
#
# %%patch100 -p 1 -b .bytecode
Uncomment the last line, then recompile with
rpmbuild -bi /usr/src/packages/SPECS/freetype2.spec
(The comment "most people should not use the bytecode interpreter" is
bullshit. Good fonts (i.e. well instructed fonts) look ways better with
the bytecode interpreter enabled.)
Step 2 (editing .fonts.conf):
<match target="font" >
<test name="family" qual="any">
<string>Tahoma</string>
<string>Times New Roman</string>
<string>Arial</string>
<string>Verdana</string>
<string>Trebuchet MS</string>
<string>Courier New</string>
</test>
<test compare="more" name="size" qual="any" >
<double>8</double>
</test>
<test compare="less" name="size" qual="any" >
<double>13</double>
</test>
<edit mode="assign" name="antialias" >
<bool>false</bool>
</edit>
</match>
<match target="font" >
<test name="family" qual="any">
<string>Tahoma</string>
<string>Times New Roman</string>
<string>Arial</string>
<string>Verdana</string>
<string>Trebuchet MS</string>
<string>Courier New</string>
</test>
<test compare="more" name="pixelsize" qual="any" >
<double>11</double>
</test>
<test compare="less" name="pixelsize" qual="any" >
<double>17</double>
</test>
<edit mode="assign" name="antialias" >
<bool>false</bool>
</edit>
</match>
Hope this helps,
Christoph