How I do fonts in Puppy

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

How I do fonts in Puppy

#1 Post by Sit Heel Speak »

UPDATE July 24 2009: these instructions are now superseded by a series of PET packages specific to each version of Puppy, which I am posting at
http://www.murga-linux.com/puppy/viewtopic.php?t=44882.

I will leave this thread up so you can see the evolution of my thinking, and for the benefit of visitors from other Linux distros who may need this assistance. Since XOrg version 7.3's xorg.conf can take an

Code: Select all

Options: "DPI" "nnn x nnn"
parameter in the [Monitor] section, the Xft.dpi settings in
/root/.Xdefaults and /root/.Xresources are now obsolete.
***
The purpose of this thread is to disclose the steps I take to make fonts in Puppy apps, mainly the Mozilla browsers and Konqueror, look good. I don't know if this is "the best possible way to improve your fonts;" I have not found a really good explanation anywhere on this forum or anywhere on the Web and so will do what I can here. I am simply going to attempt to distill a lot of research and experience, including much trial-and-error, in as concise a fashion as I can.
Last edited by Sit Heel Speak on Tue 28 Jul 2009, 22:29, edited 11 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

How to compile freetype 2.1.10 with BCI hinting turned on

#2 Post by Sit Heel Speak »

The main thing which prevents Puppy (and every other Linux) from having as high of font quality as Windows and the Mac is this: OpenType and TrueType fonts are designed as glyphs and rendering hints; these glyphs and hints are translated into screen instructions by a ByteCode Interpreter function which is in the FreeType font matching library. However, since there is a key patent (originally there were three patents, but two of these crossed the 17-year term-of-patent threshold and thus presumably expired in May 2006; the third will expire in May 2009) held by Apple on ByteCode Interpreter hinting, which I will call BCI hinting from now on, very few Linux distros come with a FreeType library which has BCI hinting compiled in. Instead, they rely on a function-clone which the www.freetype.org people have developed, which they call "unpatented autohinting" or "FreeType autohinting." Unpatented autohinting is better than no hinting at all, but my eyes tell me it just isn't as good as BCI hinting. This sad truth holds for all fonts that I have tested, both Microsoft and DejaVu as well as others.

The best page that I have seen, as far as explaining the patent issue surrounding TrueType and BCI hinting, is

http://freetype.sourceforge.net/patents.html

In what follows, I am going to assume that you have read the above-cited web page, you understand the legal issues, and that either

1. You are in a country where the remaining patent does not apply;
2. You have an Apple license;
or
3. You are otherwise satisfied that you are not under legal threat from Apple Computer to be sued for turning on the ByteCode Interpreter in FreeType.

The first thing to do is, download a sourcecode package of FreeType.

Get it at
https://sourceforge.net/project/showfil ... up_id=3157

For Puppies up to 2.13, get FreeType 2.1.10, the last version in the 2.1 series. For Puppies 2.14 and newer, get FreeType 2.3.5 or newer.

Download any of the three source packages, into subdirectory /usr/
--for example

freetype-2.1.10.tar.bz2
freetype-2.1.10.tar.gz
ft2110.zip

You should check the integrity of the download, but I didn't, since I still don't know how to check filesums other than md5.

Now open Rox-Filer. Navigate up then into /usr and click to extract the downloaded source code archive into a new subdir
for example

/usr/freetype-2.1.10

Now click into this new subdir. You will see about 6 subdirs and 10 files.

Navigate to this subdir:

/usr/freetype-2.1.10/include/freetype/config

and right-click/open-as-text the file ftoption.h

You are looking for this line:

/*#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER*/

Remove the comment markers /* and */

Alt-File-Save and close the editor.

Navigate back up in Rox to the topmost / directory.

Now, you must prepare Puppy to compile. If Puppy 1.0x, you need to download the file usr_devx.sfs. You can get it from

http://ftp.nluug.nl/ftp/pub/os/Linux/distr/puppylinux/
(scroll down, it and its md5 checksum .txt file are all the way down at the end)

or several other repositories which you can find by searching the Puppy Linux Discussion forum. Download usr_devx.sfs into the same directory as your pup001 savefile resides in.

If Puppy 2.0x, you need not usr_devx.sfs but rather devx_2xx.sfs where the 2xx is your version number. Or devx_3xx.sfs for the Puppy 3 series. Or Puppy 4xx.sfs for the Puppy 4 series. Put it in the same subdir as your pup_save.3fs or pup_save.2fs savefile. You can search the Forum and Wiki to find these.

Also, if using Puppy 2.0x through 4.x, you will need to upgrade to a newer bash than the 3.0 which comes with Puppy. Current version is bash 3.2. Get the bash source at

http://ftp.club.cc.cmu.edu/pub/gnu/bash/

At present, it's

bash-3.2.tar.gz

Create two folders on a free hard disk, for example

/mnt/sda1/output
/mnt/sda1/bash_3.2

and place bash-3.2.tar.gz in this new folder /mnt/sda1/bash_3.2.

Now click on the icon of bash-3.2.tar.gz and answer OK to both prompts. This will unpack the tar.gz archive into subfolder

/mnt/sda1/bash_3.2/bash-3.2

Click on this new subfolder's icon in Roxfiler to get into it. Right-click-in-white-space, Window, Terminal Here. Now issue the following commands:

Code: Select all

./configure --prefix=/mnt/sda1/output --disable-nls
make
make install
(Why the disable-nls parameter? See the Sept. 7 2008 postings at
http://www.linuxforums.org/forum/linux- ... error.html)

This will create a file /mnt/sda1/output/bin/bash

Copy this file over your existing /bin/bash

(if you are nervous, first copy /bin/bash to /bin/bash-original).

If you are familiar with emacs, copy the rest of what's in /mnt/sda1/output to the appropriate places, otherwise you're done.

Reboot.

And now that you have usr_devx.sfs or devx_2/3/4nn.sfs, and the right bash, you are going to compile freetype.

Start-File Managers-RoxFiler and navigate to /usr/freetype-2.1.10
(or whatever the version number)

Right-click-in-white-space, left-click "Xterm here" or Window-(slide mouse right)-Terminal here"

Issue the command (do not omit the leading "./")

./configure --prefix=/usr

It will churn away some and bring you to a # prompt; now issue

make

and let it churn away...at the next # prompt, issue

make install

...and, when done, open RoxFiler, go to /usr/lib, and you will see a new file named libfreetype.so.6.3.n where, as of February 12 2008 n is 10 for freetype 2.1.10 and 16 for freetype 2.3.5.

The compilation of the FreeType source into this executable library file, is what you have just accomplished.

You need to make sure that the two symlinks to it are pointed correctly: right-click-in-white-space, Xterm (or Window>Terminal) here, and at the prompt issue these three commands:

cd /usr/lib
rm libfreetype.so
rm libfreetype.so.6
ln -s libfreetype.so.6.3.16 libfreetype.so
ln -s libfreetype.so.6.3.16 libfreetype.so.6

(or however high the last three numbers are).

...and you're done with this step. You have just compiled the BCI hinting-enabled version of FreeType and are well on your way to mastering TrueType.
Last edited by Sit Heel Speak on Wed 17 Dec 2008, 04:25, edited 22 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

Where to obtain good TrueType fonts

#3 Post by Sit Heel Speak »

Next, you must obtain a good set of .ttf (TrueType) fonts.

Puppy 1.0x has a nifty trick, wherein a hidden folder is created, /root/.fonts, which is a symlink to the Windows font folder on the hard disk. Thereby, all Windows .ttf (TrueType) fonts are available to Puppy. This symlink was removed in initial versions of Puppy 2--I presume because the early Puppy 2's were unable to write reliably to NTFS partitions, thus the creation of the necessary support files in every font subdir risked clobbering your NTFS partition and thus your Windows 2000 or XP install.

If you have the /root/.fonts subdir, and are using Puppy 1.0x or Puppy 2.02 or higher, go ahead and keep it. If you have Puppy 2.00 or 2.01 it's OK to keep it (if you've created it) so long as you are pointing the symlink to a Windows font subdir on a partition which is FAT16 or FAT32 (VFAT). But if it's pointing to an NTFS partition, get rid of it, quick!--before you destroy your Windows install.

Regardless of whether you have the /root/.fonts symlink or not, I recommend you create a new subdir to keep new .ttf fonts in. Open an rxvt or Xterm window and issue the command (unless you are in Puppy 2.10 or higher):

mkdir /usr/X11R6/lib/X11/fonts/TTF

If you are in Puppy 2.10 or higher, issue

mkdir /usr/X11R7/lib/X11/fonts/TTF

(in later Puppies this is a symlink to /usr/share/fonts/default/TTF)

Now you are going to fill that subdir. I recommend seven collections:

1. The Microsoft core web fonts. Put the phrase "Microsoft core fonts for the web" into Google to find a download site. My favorite is:

http://www.alkalay.net/software/webcore ... 2.0.tar.gz

(Note: the webmaster from time to time updates the version number at the above URL, so if you get a 404 Not Found error then just go to

http://www.alkalay.net/software/webcore-fonts/

and get the current one)

Download it to /tmp, left-click on it, Select All, extract. Now navigate to /tmp/webcore-fonts/fonts. Open another Rox window, navigate it into the so-far-empty subdir /usr/X11R7/lib/X11/fonts/TTF, move it to the far right side of the screen, go back to the /tmp/webcore-fonts/fonts subdir, and hold the Ctrl key down while clicking on every .ttf file. When you're at the last one, click-and-hold-down, roll the cursor over to the new TTF subdir, then let up first on the mouse button and then on the Ctrl key. This will multi-copy all the files over into the TTF subdir. The /tmp/webcore-fonts subdir will disappear upon your next reboot.

If you own a legal copy of Windows, I suggest you copy the tahoma .ttf files up from your Windows font subdir as well.

2. The DejaVu fonts. Create subfolder /tmp/dejavu
and go to http://sourceforge.net/project/showfile ... _id=120289
and download
dejavu-fonts-ttf-2.27.zip
to /tmp/dejavu

Click on the icon for dejavu-fonts-ttf-2.27.zip and it will unpack into /tmp/dejavu. Go into the dejavu-fonts-ttf-2.27/ttf folder and issue

Code: Select all

cp -a *.ttf /usr/share/fonts/default/TTF
3. The Linux Liberation fonts. These are currently obtainable (December 16 2008 ) at
https://fedorahosted.org/releases/l/i/liberation-fonts/
and are unpacked and copied into the TTF fonts folder similarly to the DejaVu fonts.

4. The URW TrueType GhostPCL (GhostScript) fonts. These are at
http://www.artifex.com/downloads/
as
urwfonts-1.41.tar.bz2
Download it, issue

Code: Select all

bunzip2 urwfonts-1.41.tar.bz2
tar -xvf urwfonts-1.41.tar
and then copy these .ttf files into the TTF fonts folder as above.

5. The MgOpen fonts from
http://www.ellak.gr/fonts/mgopen/index.en.html
MgOpen Cosmetica is a free font similar to Optima.
Download and unpack, similar to the above.

6. Apanov Heuristica, from
https://fedoraproject.org/wiki/Apanov_Heuristica_font
Download and unpack, similar to the above.

7.Edrip, from
https://fedoraproject.org/wiki/Edrip_fonts
Download and unpack, similar to the above.

Finally, you must tell Puppy that the new subdir exists. Open an rxvt window and issue the commands (do not omit the dot at the end of the middle three commands):

cd /usr/X11R6/lib/X11/fonts/TTF
mkfontscale .
mkfontdir .
--(note: in Puppy 2.13 and higher you must use full path, thus:
/usr/X11R7/bin/mkfontdir .
)
fc-cache -fv .
xset fp+ /usr/X11R6/lib/X11/fonts/TTF

Now you have a very capable set of fonts.
Last edited by Sit Heel Speak on Wed 17 Dec 2008, 05:29, edited 12 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

How to adjust your display's gamma

#4 Post by Sit Heel Speak »

Now, make sure the "gamma" on your display is right; this eliminates color fringeing on condensed fonts such as Tahoma and DejaVu Sans Condensed. The best tool I have found for setting it, is Monica. Go to

http://www.pcbypaul.com/software/monica.html

and scroll down a ways to "Older Binaries" and download

monica-2.4_gcc-3.2.3.tar.gz

to your /tmp folder. Then click, select all, extract just like you did the Microsoft and DejaVu fonts, above. Move the monica executeable to /usr/bin in the same manner as you moved the fonts to the TTF subdir, and click to run it. It looks like the screenshot below. Click to uncheck the "Synchronize colors" box, keep the "Apply on the fly" box checked, click on the red slider (note: in Puppy 2 you may have to tab-key to it, it does not obey my mouse). You will see a small highlight in the slider button. Now you can move the slider with the mouse, but also with the right and left arrow keys. The down key will take you to the green button, and then the up-arrow takes you back to red, you get the idea. The goal is to make the visual box look as even gray as possible. Hint #1: if the center two bars look too red, moving the red slider to the right reddens up the area not in the two bars, thus evening it out. Hint #2: moving any slider too far to the left makes the center two bars too light, too far to the right makes the center two bars too dark. Hint # 3: yellow is the combination of red and green.

When finished, click "Exit and Save." These gamma correction settings will now be made every time you boot.
Attachments
Screenshot of Monica Monitor Calibration (sets gamma).png
(17.11 KiB) Downloaded 10088 times
Last edited by Sit Heel Speak on Wed 30 Aug 2006, 20:21, edited 6 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

How to adjust your screen's dpi (dots per inch)

#5 Post by Sit Heel Speak »

Next, set your monitor to the correct dpi (dots per inch). I have tried values as high as 126 and as low as 75. Although fascinating effects can be achieved at ultra-high and low dpi settings, I find it best to adjust to the display's actual physical dpi; for one thing, at too high or too low of a setting, I can't exit to the terminal prompt, instead I see just vertical color bands.

To learn your screen's actual dpi, start either Mozilla or Seamonkey and go to Edit - Preferences - Appearance - Fonts. Click the down-arrow labeled "Display resolution" and choose "Other." You will be shown a measurement bar. Take a ruler and measure it as accurately as you can, then enter this length and units. The browser will then show you its calculation of your actual physical dpi. Click OK to save this setting.

Now you must put this value into five configuration files. The first four are:

1. /root/.XResources (RoxFiler-up one directory-click tic-tac-toe board to show hidden files--/root--.XResources)

This is the file affected by the Start-Control Panel-Set global font size setting, though the GUI frontend gives you only multiples-of-6 choices.

Make it look like this. Note: you don't have to change the font, if you don't want to. The important part is the Xft.dpi line. This example is for my ThinkPad T21 LCD monitor, which is 91 dpi; for my 19" Dell TFT, running 1280x1024, it's 87 dpi. Use whatever value the browser shows you:

*font: -monotype-arial-medium-r-normal--14-0-100-100-p-0-iso10646-1
# was -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-*
Xft.dpi: 91

2. /root/.XDefaults

Again add an Xft.dpi line, like this:

Rxvt*keysym.0xFF50:\001
Rxvt*keysym.0xFF57:\005
!Rxvt*menu: /root/.rxvt.menu
Xft.dpi: 91

3. /usr/X11R6/bin/xwin (/usr/X11R7/bin in Puppy 2.10 and higher)
(***edited: as of Puppy 4, do not make this setting***)
Right-click on it and open as text. I'm assuming here you are using Xorg; if you use XVesa then this may or may not work. Go to the line that says

Xorg)

A line below it says

/usr/X11R6/bin/xinit /root/.xinitrc -- > /tmp/xerrs.txt 2>&1

Change this to read

/usr/X11R6/bin/xinit /root/.xinitrc -- -bpp 24 -dpi 91 > /tmp/xerrs.txt 2>&1

(the above example assumes 24-bit color; if less, adjust according to the value you chose when you ran xorgwizard)

4. /etc/X11/xorg.conf (if running xorg). I don't know what the corresponding file is in XVesa.

Add a line in the "Monitor" section to show DisplaySize in millimeters. Calculate it (***edited: or, as of Puppy 4.1, get it from the commandline utility xdpyinfo***) based on the dpi which the browser shows, rounded up or down to the nearest integer. For example, at 91 dpi, an exactly 1024-pixel-wide screen would be 11.2527 inches wide, or (times 25.4 millimeters to the inch) 285.8 mm wide. An exactly 768-pixel-high screen would be 8.4395 inches high, or 214.36 millimeters. Therefore my "Monitor" section reads:

Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
HorizSync 31.5-48.5
VertRefresh 40-70
DisplaySize 286 214
EndSection

XOrg is especially sensitive to the 2nd value, the height measurement. I suggest you try different values up or down about 5 millimeters from the initial one, 1 millimeter at a time, to find the one which makes fonts look best on your monitor. Numeral 2 in Times New Roman on the "Serif" test page which I've supplied at http://dotpups.de/Font-Improvement (***EDITED: seems to have disappeared, I'll get it back up shortly***) is a good test example. Experiment with test height values until the diagonal stroke on numeral 2 is solid and clear.

Note that xorg.conf gets overwritten every time you run xorgwizard, so you should store a backup copy where it won't get overwritten.

When you have found the best value for height, multiply it by your monitor's aspect ratio to get the correct width value. That is, if your monitor is the old-style 4:3 ratio, and your height value is 206, then use the width value ( 206 * 4 / 3 = ) 274.667 and then round this value up or down to the nearest integer, so use 275.

Thus your DisplaySize line in the Monitor section of /etc/X11/xorg.conf will read

DisplaySize 275 206

If you have a widescreen monitor the ratio is 16:9, so multiply the height value by (16/9).

And now you have your monitor's dpi set correctly except in one place, and the next message will cover this.
Last edited by Sit Heel Speak on Wed 17 Dec 2008, 07:38, edited 12 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

Links to example fonts.conf, local.conf, and test pages

#6 Post by Sit Heel Speak »

Now you have a good set of fonts, BCI hinting capability, accurate dpi, and gamma-correction so that your video subsystem has the power to display every font as its foundry designer intended.

The next step is to configure FreeType. In all Puppies up through 4.00, FreeType uses just two configuration files to turn on and adjust the font-display powers (note: actually, this is a slight oversimplification. It would be more accurate to say, "Fontconfig uses these two config files to establish by what rules it commands FreeType to perform the matching of an application font request to a served-up font." And certain applications, notably Adobe Reader, Open Office, AbiWord, and Java have their own internal fonts and font display code.

But for now, it is good enough for the purpose to understand that that these two files are "the Freetype configuration files." Both files are in XML format and are easy to edit in Geany, Leafpad, or Beaver. These configuration files are:

/etc/fonts/fonts.conf
and
/etc/fonts/local.conf

A suggested fonts.conf and two suggested variants of local.conf, are given below. The three key powers are BCI hinting, antialiasing, and subpixel rendering. Plus, I have made additional tweaks in order to compensate for weaknesses and exploit strengths in specific font families.

If you examine my tweaked fonts.conf and local.conf, you can see how adjustments are made and then you can edit these two files to make your own further tests and adjustments as you prefer. Your edits take effect when you click Start-Shut Down-X Restart. You can test your ideas by opening, in Seamonkey (Puppy 2) or Mozilla (Puppy 1), the three font family test pages for Serif, Sans-serif, and Monospace which I supply at the links at the bottom of this message (***EDITED still trying to get these posted***). These test pages are HTML documents which you can save locally and then edit in AbiWord.

The XML parsing in FreeType is not perfect and so not all "ought-to-work" XML grammars are accepted by it. For example, sometimes putting a "</const>" delimiter on the same line as an "</edit>" delimiter doesn't work. The comment delimiters "<!--" and "-->" are quirky as well. Therefore, if you make your own experimental edits, I suggest you do so by copy-and-pasting similar edits from my example fonts.conf and local.conf, all of which have been tested to work OK, and then edit the values within the pasted lines.

A mild warning here: in the course of extravagant experiments, I discovered that there is an upper limit on the size of /etc/fonts/local.conf, somewhere around 43,700 bytes. If you exceed this size, then it wrecks your Puppy installation and you will have to start with a fresh savefile. The larger of my two example local.conf's is only about 14,500 bytes, so there is lots of room to experiment.

You can check your work, in other words see if you've made a mistake in editing, by opening an rxvt window and issuing the commands:

cd /usr/X11R6/lib/X11/fonts/misc
(**EDITED Jan 4 2007: in newer Puppies 2.11 and up, change to
cd /usr/X11R7/lib/X11/fonts/TTF)
fc-cache -fv .

(don't omit the ending space+period in the final line)

The fc-cache program will notify you of any lines which don't make sense to FreeType. If the bad lines are in /etc/fonts/local.conf then fc-cache will say so, otherwise they are in etc/fonts/fonts.conf.

I suggest that you copy your original, pristine /etc/fonts/fonts.conf and /etc/fonts/local.conf to a safe place on your hard disk before you overwrite them with my examples.

Looking through the original fonts.conf, you can see that, aside from the heading and initial warning to not modify it, it consists of twelve sections:

1. A list of subdirs in which to look for fonts.
2. Permission to accept several alternate spellings of default font family names.
3. The aliases list. A notification to FreeType, in the event an application calls for a font which is not present, of which font families may be substituted, and an instruction to consider a font to be in the sans-serif face category if it is not explicitly listed.
4. A fixup for certain Asian fonts.
5. A fixup for Bitstream Vera fonts.
6. Instructions to read and obey any higher-level fonts.conf (there is none, in Puppy) and then to read and obey local.conf.
7. Instructions to not permit the use of certain older fixed-width (bitmap) fonts from Adobe, but rather to substitute for them newer Monotype and Microsoft TrueType equivalents.
8. Instructions to substitute Arial for any form of TrueType Helvetica which may be present, and Times New Roman for any form of TrueType Times which may be present.
9. The preference list. This says, for example, that if a web page specifies a "serif" face but not any particular serif family, and if the browser (or other application) itself does not specify which serif font family to use, then FreeType is to supply the first font it finds present, going down the Serif families list. In other words, if Bitstream Vera Serif is present, you will see that; if not, Times New Roman if present; if Times New Roman is not present, Nimbus Roman No 9, and so on down.
10. An instruction for producing italicized fonts, for font families which do not include an italic-version .ttf file.
11. Instructions for enforcing Unicode conventions with regard to blank characters.
12. A rescan instruction, which KDE apps call frequently, such that if you are running KDE (the "K Desktop Environment") and you change fonts.conf or local.conf, then you don't have to restart KDE to see the changes.

Looking at my modified fonts.conf, you will see these changes:

First off, at the top I have added a dpi specification, so that FreeType is painting on the same canvas as XOrg, Xft, my browser, and other applications.

Then...

1. I have changed the directories list to reflect what is actually present in Puppies 1 through 4.
2. No change to the alternate-spellings section.
3. Additions of some font families which are not in the default alias list. Also I have rearranged the alias list to be identical in content and order to the preference list.
4. No change to the Asian fonts fixup.
5. No change to the Bitstream Vera fonts fixup. The DejaVu fonts are similar enough to the Vera fonts that I can't help but wonder why there is no similar fixups list for DejaVu. However, regardless, DejaVu fonts work fine on my systems, and I see no difference between them and Vera, so I've left this section alone.
6. No change to the instructions to read and obey any higher-level fonts.conf and then to read and obey local.conf.
7. I have commented-out the instructions to not use the older Adobe bitmap fonts. In other words, I permit their use. In my modified local.conf, I specify more precisely when they may be used--specifically, only at the small sizes for which they were originally intended and designed--and specify there that at larger sizes the substitutions specified here in the default fonts.conf are to be enforced.
8. I have commented-out the instructions to substitute Arial for any form of TrueType Helvetica which may be present, and Times New Roman for any form of TrueType Times which may be present. I have not tried TrueType Helvetica and Times, but I suspect they may be quite good. If you try them and find they look unacceptable, then uncomment this section.
9. I have added to and rearranged the preference list to reflect my own taste, in other words the order in which I prefer to see font families within the three face categories.
10. No change to the instruction for producing synthetic italicized fonts.
11. No change to the instructions for enforcing Unicode conventions with regard to blank characters.
12. No change to the rescan instruction.

My suggested example fonts.conf, local.conf, and font test pages are at the end of this thread.

"Save as" the example .conf files as local.conf and fonts.conf somewhere other than your /etc/fonts subdir, rename your originals, and then move the new ones into /etc/fonts and Start - Shut Down - X Restart for them to take effect.
Last edited by Sit Heel Speak on Wed 13 Feb 2008, 20:42, edited 21 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

Discussion of local.conf

#7 Post by Sit Heel Speak »

Go ahead now, if you haven't already done so, and install the modified /etc/fonts/fonts.conf and the first /etc/fonts/local.conf at the bottom of this thread.

The only thing the original local.conf does, is to turn on subpixel rendering. This is usually of enormous benefit when using an LCD or TFT monitor, but some CRT monitors may not benefit and may actually look worse. And so, you should experiment by substituting "bgr" and "none" in the "constant" field where the default value is "rgb". If your monitor is oriented vertically (in other words, portrait mode), try "vrgb" and "vbgr".

Then, I make the following tweaks. Many of these may seem trivial, but when you add up all the improvements in the little details, the result looks splendid:

1. Turn on full BCI hinting and antialiasing for all fonts, except, don't waste CPU cycles by trying to fix up miniscule fonts.

2. Thin, weak fonts below medium weight, increase them to medium weight. There is just no way thinner-weight fonts look good.

3. The same fixups for my preferred Chinese fonts as for the Asian fonts listed in fonts.conf. Also, the language specification "zh-hk" (Hong Kong Chinese) for these fonts. Other Asian fonts can have their language specifications (e.g. "ta" for Tamil in the Suntommy font) stated using a pattern similar to this.

That's all I do in the first variant of local.conf; I suggest you try this for awhile, and then try the second one.

The second one provides the same fixups as the first, and in addition I've provided a framework of font families organized by foundry names, so you can experiment with your own fixups. You can read through this local.conf and see the comments which tell why these fixups are useful.
Last edited by Sit Heel Speak on Wed 13 Feb 2008, 07:47, edited 11 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

Suggested experiments and requested feedback

#8 Post by Sit Heel Speak »

And so, there you have it. We may not always like what each other writes, but at least we can now read it without eyestrain 8) .

You can play with these .conf files, to see whether BCI hinting or Freetype's own unpatented autohinting looks better; in local.conf, change the line

<edit mode="assign" name="hinting" ><bool>true</bool></edit>

to read

<edit mode="assign" name="autohint" ><bool>true</bool></edit>

I find that Freetype autohinting makes the fonts too uneven in width on my display, but perhaps yours will look better. In particular, I have seen some (but not all) full-KDE systems on which autohinting looks better than BCI hinting.

You can also specify that Freetype uses both BCI hinting and Freetype autohinting together, by editing local.conf to include both lines:

<edit mode="assign" name="hinting" ><bool>true</bool></edit>
<edit mode="assign" name="autohint" ><bool>true</bool></edit>

On my displays, both LCD and TFT, this makes all fonts pleasingly sharp, but causes much font substitution and gives unacceptable color-fringeing. Perhaps your system will be different.

Suggestions for changes to the .conf files, and ideas for how to make it work with XVesa, and corrections to any mistaken ideas I have ventured above, and suggestions for application settings, are welcome. Below, I will show a few screenshots, and disclose the settings I find work well for several applications.
Last edited by Sit Heel Speak on Wed 13 Feb 2008, 20:54, edited 8 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

Screenshots with font improvements

#9 Post by Sit Heel Speak »

(Note: if when viewing the images linked below, your cursor becomes a magnifying glass with a little "+" sign in the lens, hover it over the image and left-click to magnify the image)

Here is Puppy 2.13 beta-2, without any tweaks, as supplied:
http://i10.tinypic.com/345bkva.png

and here is what it looks like with the tweaks described here, just making the three small changes to fonts.conf and local.conf:
http://i17.tinypic.com/40mph1u.png

Here are two comparison screenshots of the Puppy Linux Discussion Forum Index.

The first is in Windows 98SE + IE6 with the Crazy Browser tabbing frontend:
http://i6.tinypic.com/2621ssz.png

And the next is in Puppy Linux 2.01r2 with Seamonkey. Times New Roman is set as the Serif font and Helvetica as the Sans serif font, in Edit - Preferences - Appearance - Fonts, all font sizes set to 13:
http://i7.tinypic.com/2621w7o.png

Here is the top of www.puppylinux.com. Again, Times New Roman and Helvetica are the Serif and Sans serif fonts:
http://i4.tinypic.com/2622kww.png

Here is www.puppylinux.com scrolled down, showing the URW Chancery L font specified as both the Cursive and Fantasy font:
http://i2.tinypic.com/2622mba.png

Finally, a page with DejaVu Serif and DejaVu Sans as the Serif and Sans serif fonts:
http://i4.tinypic.com/2622oh4.png
Last edited by Sit Heel Speak on Wed 17 Dec 2008, 22:34, edited 7 times in total.

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

#10 Post by BarryK »

Yes, 2.1.10 is a good choice, as that is what Pup 2.10 uses -- hence you'll get
maximum compatibility. I really should make the freetype Unleashed package
with bytecode hinting, so you won't have to do that step.
So, fill in the blanks for that step and I'll do it! -- will put it into Pup 2.10beta.

Um, perhaps it already has, it was compiled in T2, using their config settings.
-- probably they are aware of the patent issue and had that feature turned off.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

/etc/fonts/font.conf

#11 Post by Sit Heel Speak »

Here is my font.conf
(last revised: December 17 2008):

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<!-- Modified version for Puppy Linux versions up through February 2008 by P.N. Courier a.k.a. -->
<!-- "SitHeelSpeak" or "Sit Heel Speak" on the Puppy Linux forums -->
<!-- SHS version 0.07 beta -->
<!-- Maintainer Keith Packard says not to edit this file, but I did. -->
<!-- Make a backup copy, in case this gets overwritten! -->
<!-- ...and, back up your original first! -->

<fontconfig>

<!-- Set dpi to match actual display reality as shown by xdpyinfo or older Seamonkey/Mozilla -->
<!-- on my display this is 91, yours may vary -->
<match target="pattern">
	<edit name="dpi" mode="assign">
	<double>91</double></edit>
</match> 


<!-- (maintainer Keith Packard says...)
	DO NOT EDIT THIS FILE.
	IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
	LOCAL CHANGES BELONG IN 'local.conf'.

	The intent of this standard configuration file is to be adequate for
	most environments.  If you have a reasonably normal environment and
	have found problems with this configuration, they are probably
	things that others will also want fixed.  Please submit any
	problems to the fontconfig bugzilla system located at fontconfig.org

	Note that the normal 'make install' procedure for fontconfig is to
	replace any existing fonts.conf file with the new version.  Place
	any local customizations in local.conf which this file references.

	Keith Packard
-->

<!-- Font subdirectories list for all Puppy Linuxes 1 and 2 up though 2.10 -->
<!-- Depending on whether it's Puppy 1 or 2, one or more of these subdirs may -->
<!-- not exist.  Doesn't matter, no harm will result. -->
<!-- Should work in Puppy 2.10 since /usr/X11R6 is a symlink to /usr/X11R7. -->
<!-- If not, add corresponding X11R7 subdirs -->
<dir>~/.fonts</dir>
<dir>/usr/X11R6/lib/X11/fonts/TTF</dir> 
<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
<dir>/usr/X11R6/lib/X11/fonts/misc</dir>

<!-- Font cache directory list -->
	<cachedir>/var/cache/fontconfig</cachedir>
	<cachedir>~/.fontconfig</cachedir>

<!-- Alternate-spellings section begins here. -->
<!-- Accept deprecated 'mono' alias, replacing it with 'monospace' -->
<match target="pattern">
	<test qual="any" name="family">
		<string>mono</string>
	</test>
	<edit name="family" mode="assign">
		<string>monospace</string>
	</edit>
</match>

<!-- Accept alternate 'sans serif' spelling, replacing it with 'sans-serif' -->
<match target="pattern">
	<test qual="any" name="family">
		<string>sans serif</string>
	</test>
	<edit name="family" mode="assign">
		<string>sans-serif</string>
	</edit>
</match>

<!-- Accept deprecated 'sans' alias, replacing it with 'sans-serif' -->
<match target="pattern">
	<test qual="any" name="family">
		<string>sans</string>
	</test>
	<edit name="family" mode="assign">
		<string>sans-serif</string>
	</edit>
</match>
<!-- Alternate-spellings section ends here. -->

<!-- The aliases list begins here. -->
<!-- Mark common families with their generic names as aliases -->
<!-- so we'll get something reasonable if only generic face, not family, is specified -->

<!-- Serif faces -->
<alias>
	<family>DejaVu Serif</family>
	<family>Gentium</family>
	<family>Bitstream Vera Serif</family>
	<family>Times New Roman</family>
	<family>URW Bookman L</family>
	<family>Nimbus Roman No9 L</family>
	<family>Century Schoolbook L</family>
	<family>New Century Schoolbook</family>
	<family>Georgia</family>
	<family>Times</family>
	<family>Luxi Serif</family>
	<family>Kochi Mincho</family>
	<family>AR PL SungtiL GB</family>
	<family>AR PL Mingti2L Big5</family>
	<family>Baekmuk Batang</family>			
	<default><family>serif</family></default>
</alias>

<!-- Sans-serif faces -->
<alias>
	<family>DejaVu Sans</family>
	<family>Humnst777 BT</family>
	<family>Tahoma</family>
	<family>Verdana</family>
	<family>Arial</family>
	<family>Lucida Sans Unicode</family>
	<family>URW Gothic L</family>
	<family>Trebuchet MS</family>
	<family>Helvetica</family>
	<family>Microsoft Sans Serif</family>
	<family>Nimbus Sans L</family>
	<family>Luxi Sans</family>
	<family>Bitstream Vera Sans</family>
	<family>Kochi Gothic</family>
	<family>AR PL KaitiM GB</family>
	<family>AR PL KaitiM Big5</family>
	<family>AR PL ZenKai Uni</family>
	<family>AR PL ZenKai Uni MBE</family>
	<family>Kai PC .TTF</family>
	<family>Baekmuk Dotum</family>
	<family>SimSun</family>
	<default><family>sans-serif</family></default>
</alias>

<!-- Monospace faces -->
<alias>
	<family>Andale Mono</family>
	<family>DejaVu Sans Mono</family>
	<family>Bitstream Vera Sans Mono</family>
	<family>Courier New</family>
	<family>Courier</family>
	<family>Luxi Mono</family>
	<family>Nimbus Mono L</family>
	<family>NSimSun</family>
	<family>Kochi Gothic</family>
	<family>AR PL KaitiM GB</family>
	<family>Baekmuk Dotum</family>
	<default><family>monospace</family></default>
</alias>

<!-- If a font is not in the above lists, consider it sans-serif -->
<match target="pattern">
	<test qual="all" name="family" compare="not_eq">
		<string>sans-serif</string>
	</test>
	<test qual="all" name="family" compare="not_eq">
		<string>serif</string>
	</test>
	<test qual="all" name="family" compare="not_eq">
		<string>monospace</string>
	</test>
	<edit name="family" mode="append_last">
		<string>sans-serif</string>
	</edit>
</match>

<!-- The aliases list ends here. -->
<!-- Font cache directory list -->
	<cachedir>/var/cache/fontconfig</cachedir>
	<cachedir>~/.fontconfig</cachedir>

<!-- Asian font fixups begin here. -->	
<!--
  Some Asian fonts misadvertise themselves as monospaced when
  in fact they are dual-spaced (half and full).  This makes
  FreeType very confused as it forces all widths to match.
  Undo this magic by disabling the width forcing code -->
<match target="font">
	<test name="family"><string>GulimChe</string></test>
	<edit name="globaladvance"><bool>false</bool></edit>
</match>
	
<match target="font">
	<test name="family"><string>DotumChe</string></test>
	<edit name="globaladvance"><bool>false</bool></edit>
</match>

<match target="font">
	<test name="family"><string>BatangChe</string></test>
	<edit name="globaladvance"><bool>false</bool></edit>
</match>

<match target="font">
	<test name="family"><string>GungsuhChe</string></test>
	<edit name="globaladvance"><bool>false</bool></edit>
</match>
<!-- Asian font fixups end here. -->	

<!-- Bitstream Vera font fixups begin here. -->
<!-- 
	The Bitstream Vera fonts have GASP entries suggesting that hinting be
	disabled below 8 ppem, but FreeType ignores those, preferring to use
	the data found in the instructed hints.  The initial Vera release
	didn't include the right instructions in the 'prep' table. Fix this
	by disabling hinting manually at smaller sizes (< 8ppem)
 -->
	
<match target="font">
	<test name="family">
		<string>Bitstream Vera Sans</string>
	</test>
	<test name="pixelsize" compare="less">
		<double>7.5</double>
	</test>
	<edit name="hinting">
		<bool>false</bool>
	</edit>
</match>
	
<match target="font">
	<test name="family">
		<string>Bitstream Vera Serif</string>
	</test>
	<test name="pixelsize" compare="less">
		<double>7.5</double>
	</test>
	<edit name="hinting">
		<bool>false</bool>
	</edit>
</match>
	
<match target="font">
	<test name="family">
		<string>Bitstream Vera Sans Mono</string>
	</test>
	<test name="pixelsize" compare="less">
		<double>7.5</double>
	</test>
	<edit name="hinting">
		<bool>false</bool>
	</edit>
</match>
<!-- Bitstream Vera font fixups end here. -->
	
<!-- Load per-user customization file (not present in Puppy Linux) -->
<include ignore_missing="yes">~/.fonts.conf</include>

<!-- Load local system customization file -->
<include ignore_missing="yes">local.conf</include>

<!-- Keith Packard says here, -->
<!-- "Alias well known font names to available TrueType fonts" -->
<!-- ...but, I've commented these out because I LIKE fixed-width fonts... -->
<!-- ...at small sizes, that is.  I disallow them at larger sizes, in local.conf. -->
<!-- ...and, I have no problem with Arial. -->
<!-- 	<alias>
		<family>Times</family>
		<accept><family>Times New Roman</family></accept>
	</alias>
	<alias>
		<family>Helvetica</family>
		<accept><family>Verdana</family></accept>
	</alias>

	<alias>
		<family>Arial</family>
		<accept><family>Verdana</family></accept>
	</alias>

	<alias>
		<family>Courier</family>
		<accept><family>Courier New</family></accept>
	</alias>
-->

	<alias>
		<family>Times</family>
		<accept><family>Times New Roman</family></accept>
	</alias>

<!--
 Keith Packard says, "Check user preference to avoid bitmap fonts and replace
 bitmap face names with equivalent scalable fonts"
 -->

<!-- no, I've commented this out; I do not know whether TrueType Helvetica -->
<!-- and Times are good or not -->
<!--	<match target="pattern">
	        <test name="prefer_outline">
	                <bool>true</bool>
	        </test>
	        <test name="family">
	                <string>Helvetica</string>
	        </test>
	        <edit name="family" mode="prepend" binding="same">
	                <string>Arial</string>
	        </edit>
	</match>
	
	<match target="pattern">
	        <test name="prefer_outline">
	                <bool>true</bool>
	        </test>
	        <test name="family">
	                <string>Times</string>
	        </test>
	        <edit name="family" mode="prepend" binding="same">
	                <string>Times New Roman</string>
	        </edit>
	</match>
-->

<!-- Preference list begins here. -->
<!-- This is the order in which fonts will be chosen when just -->
<!-- "serif," "sans-serif," or "monospace" is specified on the web page. -->
<!-- I believe it should match the "alias" lists, above, but am not sure. -->

<alias>
	<family>serif</family>
		<prefer>
			<family>DejaVu Serif</family>
			<family>Gentium</family>
			<family>Bitstream Vera Serif</family>
			<family>Times New Roman</family>
			<family>URW Bookman L</family>
			<family>Nimbus Roman No9 L</family>
			<family>Century Schoolbook L</family>
			<family>New Century Schoolbook</family>
			<family>Georgia</family>
			<family>Times</family>
			<family>Luxi Serif</family>
			<family>Kochi Mincho</family>
			<family>AR PL SungtiL GB</family>
			<family>AR PL Mingti2L Big5</family>
			<family>Baekmuk Batang</family>			
		</prefer>
</alias>

<alias>
	<family>sans-serif</family>
		<prefer>
			<family>DejaVu Sans</family>
			<family>Humnst777 BT</family>
			<family>Tahoma</family>
			<family>Verdana</family>
			<family>Arial</family>
			<family>Lucida Sans Unicode</family>
			<family>URW Gothic L</family>
			<family>Trebuchet MS</family>
			<family>Helvetica</family>
			<family>Microsoft Sans Serif</family>
			<family>Nimbus Sans L</family>
			<family>Luxi Sans</family>
			<family>Bitstream Vera Sans</family>
			<family>Kochi Gothic</family>
			<family>AR PL KaitiM GB</family>
			<family>AR PL KaitiM Big5</family>
			<family>AR PL ZenKai Uni</family>
			<family>AR PL ZenKai Uni MBE</family>
			<family>Kai PC .TTF</family>
			<family>Baekmuk Dotum</family>
			<family>SimSun</family>
		</prefer>
	</alias>

<alias>
	<family>monospace</family>
		<prefer>
			<family>Andale Mono</family>
			<family>DejaVu Sans Mono</family>
			<family>Bitstream Vera Sans Mono</family>
			<family>Courier New</family>
			<family>Courier</family>
  			<family>Luxi Mono</family>
			<family>Nimbus Mono L</family>
			<family>NSimSun</family>
			<family>Kochi Gothic</family>
			<family>AR PL KaitiM GB</family>
			<family>Baekmuk Dotum</family>
		</prefer>
</alias>
<!-- Preference list ends here. -->

<!-- Artificial oblique (italic) for fonts without an italic or oblique version -->
<match target="font">
	<!-- check to see if the font is roman -->
	<test name="slant">
		<const>roman</const>
	</test>
	<!-- check to see if the pattern requested non-roman -->
	<test target="pattern" name="slant" compare="not_eq">
		<const>roman</const>
	</test>
	<!-- multiply the matrix to slant the font -->
	<edit name="matrix" mode="assign">
		<times>
			<name>matrix</name>
			<matrix><double>1</double><double>0.2</double>
				<double>0</double><double>1</double>
			</matrix>
		</times>
	</edit>
	<!-- pretend the font is oblique now -->
	<edit name="slant" mode="assign">
		<const>oblique</const>
	</edit>
</match>

<config>

<!--
  These are the default Unicode chars that are expected to be blank
  in fonts.  All other blank chars are assumed to be broken and
  won't appear in the resulting charsets
 -->
		<blank>
			<int>0x0020</int>	<!-- SPACE -->
			<int>0x00a0</int>	<!-- NO-BREAK SPACE -->
			<int>0x00ad</int>	<!-- SOFT HYPHEN -->
			<int>0x115f</int>	<!-- HANGUL CHOSEONG FILLER -->
			<int>0x1160</int>	<!-- HANGUL JUNGSEONG FILLER -->
			<int>0x1680</int>	<!-- OGHAM SPACE MARK -->
			<int>0x2000</int>	<!-- EN QUAD -->
			<int>0x2001</int>	<!-- EM QUAD -->
			<int>0x2002</int>	<!-- EN SPACE -->
			<int>0x2003</int>	<!-- EM SPACE -->
			<int>0x2004</int>	<!-- THREE-PER-EM SPACE -->
			<int>0x2005</int>	<!-- FOUR-PER-EM SPACE -->
			<int>0x2006</int>	<!-- SIX-PER-EM SPACE -->
			<int>0x2007</int>	<!-- FIGURE SPACE -->
			<int>0x2008</int>	<!-- PUNCTUATION SPACE -->
			<int>0x2009</int>	<!-- THIN SPACE -->
			<int>0x200a</int>	<!-- HAIR SPACE -->
			<int>0x200b</int>	<!-- ZERO WIDTH SPACE -->
			<int>0x200c</int>	<!-- ZERO WIDTH NON-JOINER -->
			<int>0x200d</int>	<!-- ZERO WIDTH JOINER -->
			<int>0x200e</int>	<!-- LEFT-TO-RIGHT MARK -->
			<int>0x200f</int>	<!-- RIGHT-TO-LEFT MARK -->
			<int>0x2028</int>	<!-- LINE SEPARATOR -->
			<int>0x2029</int>	<!-- PARAGRAPH SEPARATOR -->
			<int>0x202a</int>	<!-- LEFT-TO-RIGHT EMBEDDING -->
			<int>0x202b</int>	<!-- RIGHT-TO-LEFT EMBEDDING -->
			<int>0x202c</int>	<!-- POP DIRECTIONAL FORMATTING -->
			<int>0x202d</int>	<!-- LEFT-TO-RIGHT OVERRIDE -->
			<int>0x202e</int>	<!-- RIGHT-TO-LEFT OVERRIDE -->
			<int>0x202f</int>	<!-- NARROW NO-BREAK SPACE -->
			<int>0x205f</int>	<!-- MEDIUM MATHEMATICAL SPACE -->
			<int>0x2060</int>	<!-- WORD JOINER -->
			<int>0x2061</int>	<!-- FUNCTION APPLICATION -->
			<int>0x2062</int>	<!-- INVISIBLE TIMES -->
			<int>0x2063</int>	<!-- INVISIBLE SEPARATOR -->
			<int>0x206A</int>	<!-- INHIBIT SYMMETRIC SWAPPING -->
			<int>0x206B</int>	<!-- ACTIVATE SYMMETRIC SWAPPING -->
			<int>0x206C</int>	<!-- INHIBIT ARABIC FORM SHAPING -->
			<int>0x206D</int>	<!-- ACTIVATE ARABIC FORM SHAPING -->
			<int>0x206E</int>	<!-- NATIONAL DIGIT SHAPES -->
			<int>0x206F</int>	<!-- NOMINAL DIGIT SHAPES -->
			<int>0x3000</int>	<!-- IDEOGRAPHIC SPACE -->
			<int>0x3164</int>	<!-- HANGUL FILLER -->
			<int>0xfeff</int>	<!-- ZERO WIDTH NO-BREAK SPACE -->
			<int>0xffa0</int>	<!-- HALFWIDTH HANGUL FILLER -->
			<int>0xfff9</int>	<!-- INTERLINEAR ANNOTATION ANCHOR -->
			<int>0xfffa</int>	<!-- INTERLINEAR ANNOTATION SEPARATOR -->
			<int>0xfffb</int>	<!-- INTERLINEAR ANNOTATION TERMINATOR -->
		</blank>

<!--
  Rescan configuration every 30 seconds when FcFontSetList is called
 -->
		<rescan>
			<int>30</int>
		</rescan>
	</config>

</fontconfig>
Last edited by Sit Heel Speak on Wed 17 Dec 2008, 22:28, edited 11 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

/etc/fonts/local.conf -- simplified version

#12 Post by Sit Heel Speak »

Here is the first, simple version of local.conf:

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations -->
<!-- version 0.03-simple-beta by P.N. Courier a.k.a. "SitHeelSpeak" -->
<!-- or "Sit Heel Speak" on the Puppy Linux forums -->
<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>

<!-- Initialize bytecode interpreter (BCI) hinting to be on for all fonts -->
<!-- Initialize hinting style as "full" for all fonts -->
<!-- ...but, don't waste CPU cycles doing fixups for fonts pixelsize 10 and smaller -->
<!-- if full KDE try autohint instead of hinting --> 
<match target="font">
   <test name="pixelsize" compare="more"><double>10.5</double></test>
   <edit mode="assign" name="hinting" ><bool>true</bool></edit>
   <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
</match>

<!-- Turn anti-aliasing on for fonts pixelsize 13 or larger -->
<match target="font">
   <test name="pixelsize" compare="more"><double>13</double></test>
   <edit name="antialias"><bool>true</bool></edit>
   <test name="pixelsize" compare="less"><double>13</double></test>
   <edit name="antialias"><bool>false</bool></edit>
</match>

<!-- If weight is greater than 65 but less than 100, boost it to 100 (medium weight) -->
<match target="pattern">
   <test name="weight" compare="less">
      <double>100</double></test>
   <test name="weight" compare="more">
      <double>70</double></test>
   <edit name="weight" mode="assign" target="default">
      <double>100</double></edit>
</match>

<!-- Chinese fonts -->
<match target="font">
	<test compare="eq" name="family" qual="any">
		<string>AR PL ZenKai Uni</string>
		<string>AR PL ZenKai Uni MBE</string>
		<string>Kai PC .TTF</string>
	</test>
	<edit name="globaladvance"><bool>false</bool></edit>
	<edit name="spacing"><int>0</int></edit> 
	<edit name="lang" >
		<string>zh-hk</string>
	</edit>
</match>

</fontconfig>
Last edited by Sit Heel Speak on Wed 13 Feb 2008, 20:55, edited 2 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

/etc/fonts/local.conf -- version with font substitutions

#13 Post by Sit Heel Speak »

Here is the version of local.conf which performs substitutions to exploit the strengths of various fonts at different sizes and weights.
(last revised: Feb 25 2008):

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations -->
<!-- version 0.03-long-beta by P.N. Courier a.k.a. "SitHeelSpeak" -->
<!-- or "Sit Heel Speak" on the Puppy Linux forums -->
<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>

<!-- Initialize bytecode interpreter (BCI) hinting to be on for all fonts -->
<!-- Initialize hinting style as "full" for all fonts -->
<!-- ...but, don't waste CPU cycles doing fixups for fonts pixelsize 10 and smaller -->
<!-- if full KDE try autohint instead of hinting -->
<match target="font">
   <test name="pixelsize" compare="more"><double>10.5</double></test>
   <edit mode="assign" name="hinting" ><bool>true</bool></edit>
   <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
</match>

<!-- Turn anti-aliasing on for fonts pixelsize 13 or larger -->
<match target="font">
   <test name="pixelsize" compare="more"><double>13</double></test>
   <edit name="antialias"><bool>true</bool></edit>
   <test name="pixelsize" compare="less"><double>13</double></test>
   <edit name="antialias"><bool>false</bool></edit>
</match>

<!-- If weight is greater than 65 but less than 100, boost it to 100 (medium weight) -->
<match target="pattern">
   <test name="weight" compare="less">
      <double>100</double></test>
   <test name="weight" compare="more">
      <double>70</double></test>
   <edit name="weight" mode="assign" target="default">
      <double>100</double></edit>
</match>

<!-- Chinese fonts -->
<match target="font">
	<test compare="eq" name="family" qual="any">
		<string>AR PL ZenKai Uni</string>
		<string>AR PL ZenKai Uni MBE</string>
		<string>Kai PC .TTF</string>
	</test>
	<edit name="globaladvance"><bool>false</bool></edit>
	<edit name="spacing"><int>0</int></edit> 
	<edit name="lang" >
		<string>zh-hk</string>
	</edit>
</match>

<!-- Fixups for individual fonts -->

<!-- Arial Black -->
<!-- A poor-quality font no matter how I try to fix it. -->
<!-- Substitute Arial in bold weight for it. -->
<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Arial Black</string> </test>
	<edit name="family" mode="prepend" binding="same">
		<string>Arial</string>	</edit>
	<edit name="weight" mode="assign">
		<const>bold</const></edit>
</match>

<!-- Arial -->
<!-- Under pixelsize 16 substitute DejaVu Sans -->
<match target="pattern">
	<test name="family" compare="eq" qual="any">
		<string>Arial</string>
	</test>
	<test name="pixelsize" compare="less">
		<double>16.5</double></test>
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>DejaVu Sans</string>
	</edit>
</match>

<!-- Arial at pixelsize 21 and up is inferior to Microsoft Sans Serif -->
<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Arial</string></test>
	<test name="pixelsize" compare="more">
		<double>20.5</double></test>
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>Microsoft Sans Serif</string>
	</edit>
</match>

<!-- Calibri -->
<alias binding="same">
    <family>Calibri</family>
    <accept>
      <family>Humnst777 BT</family>
    </accept>
</alias>
 
<!-- Helvetica -->
<!-- said to be "overused", "unrecommended" etc. but I find it very readable at -->
<!-- up to pointsize 13, a very good small sans-serif, but too jagged at 14 and higher. -->
<!-- AbiWord in Puppy Linux 2.01r2 is incapable of handling Helvetica, it converts it -->
<!-- to Times New Roman. -->
<!-- Substitute DejaVu Sans at pixelsizes 14 and higher -->
<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Helvetica</string>
	</test>
	<test name="pixelsize" compare="more" target="default">
		<double>13.5</double>
	</test>
	<edit name="family" mode="prepend" binding="strong" target="default">
	<string>DejaVu Sans</string></edit>
<!--	<string>Lucida Sans Unicode</string></edit> -->
<!--	<string>Verdana</string></edit>  -->
	<edit name="weight" mode="assign">
		<const>bold</const></edit>
</match>


<!-- Impact -->
<!-- I cannot get a web page to render in Impact, neither in SeaMonkey nor in IE6. -->
<!-- and on my next Puppy boot the menu font is messed up. -->
<!-- And so best to a l i a s this destructive f o n t -->
<!-- Wherever a page calls for Impact, substitute Arial in bold weight -->
<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Impact</string>
	</test>
	<edit name="family" mode="prepend" binding="same">
		<string>Arial</string>
	</edit>
	<edit name="weight" mode="assign" >
		<const>bold</const>
	</edit>
</match>

<!-- Times New Roman -->
<!-- save your eyes enforce TNR to be minimum pixelsize 14 -->
<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Times New Roman</string> </test>
	<test name="pixelsize" compare="less">
		<double>14</double> </test>
	<edit name="pixelsize" mode="assign" target="default">
		<double>14</double></edit>
</match>

<!-- Tahoma -->
<!-- substitute DejaVu Sans for Tahoma at under pixelsize 17 -->
<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Tahoma</string> </test>
	<test name="pixelsize" compare="less" target="default">
		<double>17</double> </test>					
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>DejaVu Sans</string> </edit>
</match>

<!-- Verdana -->

<!-- For Verdana at small pixelsizes, substitute it with something better-looking. -->
<!-- ...this cures the missing stroke on lowercase k when viewing the -->
<!-- Puppy Linux Discussion Forum on a TFT or LCD screen -->
<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Verdana</string> </test>
	<test name="pixelsize" compare="less" target="default">
		<double>13.5</double> </test>					
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>Helvetica</string> </edit>
</match>

<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Verdana</string> </test>
	<test name="pixelsize" compare="more" target="default">
		<double>13.5</double> </test>
	<test name="pixelsize" compare="less" target="default">
		<double>15</double> </test>
	<test name="weight" compare="less" target="default">
		<double>110</double></test>
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>DejaVu Sans</string> </edit>
</match>

<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Verdana</string> </test>
	<test name="pixelsize" compare="more">
		<double>13.5</double> </test>
	<test name="weight" compare="less" target="default">
		<double>110</double></test>
	<edit name="aspect" mode="assign" target="default">
		<double>0.94</double></edit>
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>DejaVu Sans</string> </edit>
</match>

<!-- For bold Verdana, substitute a compacted DejaVu Sans -->
<!-- ...cures the thick W and N section headings on the Puppy Linux Discussion Forum -->
<match target="pattern">
	<test name="family" compare="eq" target="default">
		<string>Verdana</string></test>
	<test name="weight" compare="more" target="default">
		<double>110</double></test>
	<test name="pixelsize" compare="less" target="default">
		<double>20.5</double> </test>
	<edit name="aspect" mode="assign" target="default">
		<double>0.90</double></edit>          
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>DejaVu Sans</string></edit>
</match>

<!-- Andale Mono is the best monospace up to pixelsize 19, -->
<!-- when the best becomes Lucida Console, but then at 24 DejaVu Sans Mono takes over -->
<match target="pattern">
	<test name="family" compare="eq" qual="any">
		<string>Andale Mono</string>
	</test>
	<test name="pixelsize" compare="more">
		<double>18</double></test>
	<test name="pixelsize" compare="less">
		<double>24</double></test>
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>Lucida Console</string>
	</edit>
</match>
<match target="pattern">
	<test name="family" compare="eq" qual="any">
		<string>Andale Mono</string>
	</test>
	<test name="pixelsize" compare="more">
		<double>23</double></test>
	<edit name="family" mode="prepend" binding="strong" target="default">
		<string>DejaVu Sans Mono</string>
	</edit>
</match>

</fontconfig>
Last edited by Sit Heel Speak on Mon 25 Feb 2008, 22:08, edited 3 times in total.

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

#14 Post by Sit Heel Speak »

~~ THE END ~~

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#15 Post by Flash »

And thanks! :D

User avatar
Eyes-Only
Posts: 1043
Joined: Thu 10 Aug 2006, 06:32
Location: La Confederation Abenaquaise

#16 Post by Eyes-Only »

There's a gentleman by the name of deniros who's done a basic package of this in "Additional Software", either as a .pup or .pet, and released it to us where he's turned on the bytecoding and stuff. Now of course the results will be in no way as good as what SHS has documented above because following his methods you'll get the exactitude for your size monitor whereas this package is solely a "rough guesstimate" of course.

However, I've found that for lazy people like me -rolls eyes- deniros's packages do make a fairly "good 'nuff" substitute for the time being until the day when I do have time from working on five separate distros to sit back and give some attention to going through with what SHS has very graciously taken a great deal of time to hand to us here freely of his own time and effort.

BTW: Deniros's packages may be found here: http://www.murga-linux.com/puppy/viewtopic.php?t=26020

Thank you so very much SHS for doing this and I have bookmarked this page for future reference. I hope others have as well. I've also taken one of the sections you'd written prior---equally as detailed---and copied it to a text file which is now backed up on a CD with other important documents. Way to go! You know how I feel about this as we've discussed this in the past to great extent.

Once again SHS, thank you for all your hard work in making Puppy more easily readable for those with vision problems.

Amicalement,

Eyes-Only
"L'Peau-Rouge"
*~*~*~*~*~*
Proud user of LXpup and 3-Headed Dog. 8)
*~*~*~*~*~*

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#17 Post by disciple »

I've done a whole lot more experimenting in the last couple of days, and here are some of my observations:

-The change to /usr/X11R6/bin/xwin stops X starting on my machine
-for some bizarre reason the code for antialiasing in local.conf didn't work, but if I first turn antialiasing off for all fonts, and kept the suggested code to turn it back on for large fonts (taking out the code relating to small fonts), then I got the intended results.
-I prefer to have antialiasing turned off for fonts up to 26 pixels rather than 13.
-changing the code in Xorg.conf I can't fix the stroke on the capital K in Times New Roman at size 28. But maybe this is because I don't have the change to /usr/X11R6/bin/xwin?

User avatar
Eyes-Only
Posts: 1043
Joined: Thu 10 Aug 2006, 06:32
Location: La Confederation Abenaquaise

#18 Post by Eyes-Only »

I'm just curious disciple: Are you using a Puppy version below 2.10? I ask because you supposedly only needed to make that directory if using a Pup below 2.10---2.10 and above used the X11R7 pathway if I've read SHS's instructions correctly.

Not that I really know all that much about this topic in all actuality. So like I should be speaking! :oops:

Amicalement,

Eyes-Only
"L'Peau-Rouge"
*~*~*~*~*~*
Proud user of LXpup and 3-Headed Dog. 8)
*~*~*~*~*~*

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#19 Post by disciple »

Yes.
The really funny thing is that the sub-pixel rendering settings don't do anything on my (LCD) screen. I'm wondering if it is a problem with fontconfig not reading local.conf correctly, but there seems to be no way of finding out.

User avatar
erikson
Posts: 735
Joined: Wed 27 Feb 2008, 09:22
Location: Ghent, Belgium
Contact:

#20 Post by erikson »

Now *here* is a thread that I have to read very carefully !!!

Having had various ancestors and close relatives in the printing business, coming from the Windows world and being used to Verdana, Tahoma, Arial, Times New Roman etc, and having taken pains to make my personal website typographically appealing... I was missing that in Puppy.

Now let's see if my computer skills are on par to get these fonts working.
[size=84][i]If it ain't broke, don't fix it.[/i] --- erikson
hp/compaq nx9030 (1.6GHz/480MB/37.2GB), ADSL, Linksys wireless router
[url]http://www.desonville.net/[/url]
Puppy page: [url]http://www.desonville.net/en/joere.puppy.htm[/url][/size]

Post Reply