Hacking Puppy's Fonts

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
jackpipe
Posts: 5
Joined: Tue 23 Aug 2005, 22:06

Hacking Puppy's Fonts

#1 Post by jackpipe »

Hi,
Well, I'm a newbie to puppy, though I've been using and sometimes tweaking linux since the early days. I have to say puppy seems to hit a real sweet spot of simplicity, size and utility. Well done !

One thing that still isn't fixed in Linux, and in other unices, are fonts.
The first problem I find, is that compared to windows and mac, they just look horrible. Puppy is no exception, I'm afraid - the antialiasing just doesn't cut it at smaller font sizes, and even the glyph placement seems to go wrong with some faces.
As a quick hack, all I've done today is follow the instructions here :
http://avi.alkalay.net/linux/docs/font-howto/Font.html

To summarize, I've acquired a libfreetype.so ( eg from http://ftp.club-internet.fr/pub/linux/p ... f.i586.rpm ) library that has the byte-code interpreter enabled, for font hinting, I've turned off autohinting by default in fontconfig, and turned sub-pixel aliasing on (I'm on an LCD, though it still looks good on a CRT), and acquired a couple of truetype fonts - I copied verdana.ttf and tahome.ttf from /windows/fonts on a windows XP install, to /opt/TTF.

My /etc/fonts/local.conf is as follows:

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations -->
<fontconfig>
         <dir>/opt/TTF</dir>
	<match target="font">
		<test qual="all" name="rgba">
			<const>unknown</const>
		</test>
		<edit name="rgba" mode="assign"><const>rgb</const></edit>
	</match>
	<match target="font">
		<edit name="autohint" mode="assign"><const>False</const></edit>
	</match>
</fontconfig>
Its basically a filter on the replies to font queries, which basically says, whenever we find a font, that has an 'rgba' attribute, assign 'rgb' to the rgba attribute. And whenever we find a font, assign 'False' to the 'autohint' attribute, before returning the results to the application making the query.

I've also changed mozilla's fonts to use verdana, or tahoma, and modified the menu fonts etc, defined in $HOME/.mozilla/...../userChrome.css.

The second prooblem with linux is the plethora of different font schemes used by different apps - a mess for the average user (or even administrator) to deal with. I haven't made much progress on this - it seems to me a config app is required that can tweak all the different systems automatically.

Anyway, for just a quick bit of hacking, at least some of my apps now look comparable to windows and mac - substantially better than the standard linux install. I haven't measure memory use, performance, etc - but my take is that making text highly readable, and looking good is more of a priority. Or at least an option.

Just one caution - as detailed in the howto above - this is not neccessarily stuff that can go in a distro, as there are licensing issues.
I might knock up a HOWTO when I have things a bit slicker though.[/quote]

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

That's extremely interesting!
Wonderful in fact, as we are discussing fonts in Mozilla right now in another thread.

I was wondering, OpenOffice has some inbuilt TT fonts.
Maybe you could see how those look -- use PupGet package manager to download "openoffice-1.1.4_CUTDOWN" and install it.

Whe OO pupget pkg installs, it creates a link /root/.fonts to where the actual TT fonts folder is. Nothing else to do, Moz and all other apps automatically will use any TT fonts found in ~/.fonts/.
I'm interested to know how you find them compared to the MS fonts, considering that they are free for us to use.

...and a HOWTO, yes please!

jackpipe
Posts: 5
Joined: Tue 23 Aug 2005, 22:06

#3 Post by jackpipe »

The bitstream fonts don't quite look as nice as the microsoft ones, in particular at low point sizes the 'e' smudges quite a bit, and the mono, and serif faces look as though they've come from a manual typewriter - the text looks uneven somehow.

Anyway, they do still look better with the freetype library with the bytecode interpreter turned on - they are 'crisper' and the glyph placement is better, though the type does look a little less heavy than the autohinted versions - those with big hi-res displays may prefer the darker versions.

I'll put together a couple of screen captures showing a few fonts with and without the bytecode hinting, and subpixel aliasing. Is there somewhere I should post the images ?

I think the trick with this is to match fonts/sizes to the rendering method - which can be done in fontconfig. ie we could turn off anti-aliasing below a certain point size, and have some fonts use the autohinter, and others use the bytecode interpreter (by setting the value of the autohint attribute). My preference so far though is that the bytecode interpreter does a better job than the autohinter. I'll tinker around some more today ...
[/img]

jackpipe
Posts: 5
Joined: Tue 23 Aug 2005, 22:06

#4 Post by jackpipe »

On second thoughts I may have the vera fonts the wrong way round - ie they look better with autohinting, rather than bytecode hinting.
Anyway - images on the way....

jackpipe
Posts: 5
Joined: Tue 23 Aug 2005, 22:06

#5 Post by jackpipe »

On third thoughts, it really does depend on the font, the font size, and the to some extent, the display. for some fonts, at some sizes the autohinter is best, other situations the bytecode hinter is best. But sometimes the difference can be quite substantial

Leon
Posts: 265
Joined: Wed 22 Jun 2005, 21:33

#6 Post by Leon »

I've noticed that in my Chubby Puppy 1.0.4 a libfreetype.so.6.3.3 is already installed. I've changed /etc/fonts/local.conf as recommended above. I saw dramatical improvement. Fonts looked much better but the font colour turned from black to almost brown and that is unfortunatly not accaptable for me.

I' ve achieved some improvements folloving some tips about changing dpi and font in Mozilla and Firefox as suggested here: http://convexhull.com/mandrake_fonts.html.

My monitor is 15" Sony SDM-M51 LCD. Puppy Video Wizard shows current mode: 0x0118 1024x768x24.

Mozilla

Edit -> Preferences -> Appearence -> Fonts

Fonts for: Central European
Proportional: Sans Serif, Size:14
Serif: Times New Roman L2
Sans-serif: Bitstream Vera Sans
Cursive: serif
Fantasy: serif
Monospace: LucidaTypewriter, Size:14
Minimum font size: 12
Allow documents to use other fonts: unchecked
Display resolution: 72 dpi

Firefox

Edit -> Preferences -> General -> Fonts & Colors

Fonts for: Central European
Proportional: Sans Serif, Size (pixels):14
Serif: Times New Roman L2
Sans-serif: Bitstream Vera Sans
Monospace: LucidaTypewriter, Size (pixels):11
Display resolution: 96 dpi, Minimum font size: 12
Always use my: Fonts (checked)

User Chrome configuration file: /root/.mozilla/firefox/5kovolu5.default/chrome/userChrome.css:

font-size: 10pt !important;

jackpipe
Posts: 5
Joined: Tue 23 Aug 2005, 22:06

#7 Post by jackpipe »

The improvement you''re seeing is down to using sub-pixel rendering alone, I think - and yes it does have an effect on the colouring - some fonts exhibit quite unacceptable colour fringing etc.

puppy does include a libfreetype.so already, which is required for truetype font support for Xft - but this library has been compiled without support for byte-code interpreter hinting (I believe), so you'll need to download one includes that support (see my link above - in this case the version is 6.3.7). Install it in /usr/lib, and you'll need to alter the links in /usr/lib to point to the new library, ie :
ln -fs libfreetype.so.6.3.7 libfreetype.so.6
ln -fs libfreetype.so.6.3.7 libfreetype.so
And then restart any applications for the change to take effect.
You can just switch the links back to the old library to compare and contrast, or better still, edit /etc/fonts/local.conf to play with the 'autohint' attribute.

BTW I extracted the library file from the rpm on a redhat system, using rpm2cpio, though I'm sure there are better ways..

Leon
Posts: 265
Joined: Wed 22 Jun 2005, 21:33

#8 Post by Leon »

Thank you verry much jackpipe!

I've done as you suggested and fonts looks now much better.

I think that I'll keep these setings in my /etc/fonts/local.conf:

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations -->
<fontconfig>
<!-- Enable sub-pixel rendering -->
	<match target="font">
		<test qual="all" name="rgba">
			<const>unknown</const>
		</test>
		<edit name="rgba" mode="assign"><const>rgb</const></edit>
	</match>
</fontconfig>
Some characters still have some blue shade but it's nice coloured shade ... :wink:

Post Reply