|
|
|
Fonts On X
By default, X only supports bitmapped fonts, which are not scaleable. If you scale them anyway, they will look crumbly and rugged. This bitmapping is one reason why X eats up so much memory: instead of vectorial descriptions it sends bitmaps (i.e. smal
l pictures of each displayed character).
Later there came support for PostScript Type 1 and Speedo fonts which are scaleable, but the Type 1 font rendering machine is mediocre at best. Furthermore, good PostScript fonts are very expensive and therefore can't be included. There are a lot of free
fonts but their quality doesn't match commercial ones.
Now X supports TrueType fonts via the X Font Server 'xfs', but isn't able to do nifty stuff like anti-aliasing yet (some window managers however - like Enlightenment - do. The results are not very convincing,
though). Many X applications don't know about TrueType at all (note: you can get around this by converting TrueType to PostScript fonts). 'Hinting' works differently than with PostScript&re
g; so that even if the application allows using TT fonts, the results could differ widely from what you might have expected.
Until X includes a decent font rendering machine, one has to resort to shifts for the most serious problems.
section index / top
7.x versions of LM prefer using 100 dpi (dots per inch) fonts to 75 dpi fonts, which results in quite decently sized fonts on bigger monitors. If you are using an earlier version, you might have to do some configuring yourself to achieve this:
Check '/etc/X11/fs/config'. If you have an entry there like
/usr/X11R6/lib/X11/fonts/75dpi:unscaled,
/usr/X11R6/lib/X11/fonts/100dpi:unscaled,
then that's the source of your problem.
These entries define the order in which font directories are queried. This will lead to incredibly tiny fonts on most modern monitors, which are usually displaying in 96 dpi. This is why many web pages come with itsy-bitsy sized fonts: They have been crea
ted on MS-Windows, where fonts look larger (Offtopic: If you write pages for a multi-platform readership, make sure they can actually read them ...).
Fix:
-
Check if you have the 100dpi-fonts package installed:
rpm -qa | grep 100
If not, install them ('XFree86-100dpi-fonts-[version].rpm').
-
Open '/etc/X11/fs/config' in an editor as 'root' and switch the entries
/usr/X11R6/lib/X11/fonts/75dpi:unscaled,
/usr/X11R6/lib/X11/fonts/100dpi:unscaled,
to
/usr/X11R6/lib/X11/fonts/100dpi:unscaled,
/usr/X11R6/lib/X11/fonts/75dpi:unscaled,
-
(Optional): Change
# 100 x 100 and 75 x 75
default-resolutions = 75,75,100,100
to
# 100 x 100 and 75 x 75
default-resolutions = 100,100,75,75
and save the file.
-
Restart the X Font Server by issuing this command as 'root':
kill -SIGUSR1 $(pidof xfs)
-
Restart X. Enjoy ;-).
Note: A growing amount of apps allow setting font size and family, for instance most KDE / GNOME apps and the Netscape browser (via 'edit-preferences-appearance-fonts'). With a correct 'xfs' setting however this shouldn't be necessary.
section index / top
PostScript (*.pcf)
-
As 'root', create a new directory for your fonts in '/usr/X11R6/lib/X11/fonts' and put your new fonts in there.
-
Run mkfontdir /usr/X11R6/lib/X11/fonts/[new directory]
This creates the files 'fonts.alias' and 'fonts.dir'.
-
Run xset fp rehash
Ready.
TrueType (*.ttf)
-
Create a new directory for the fonts you want to add (like mkdir /usr/X11R6/lib/X11/fonts/my_ttf.)
This is necessary because some of the fonts in 'ttfonts' are broken and would lead to a corrupt fonts.dir file if processed with ttmkfdir and mkfontdir.
-
Put your fonts into this new directory. Make sure their file names consist of small letters only. Make sure there are no empty spaces within the filenames. Check the permissions (ls -l
code>) on the new font directory (should be drwxr-xr-x) and the fonts (should be -rw-r--r--).
If you get something wrong here, you might not be able to restart X!
-
Run chkfontpath --add /usr/X11R6/lib/X11/fonts/my_ttf to add this directory to your font path.
-
Run ttmkfdir > fonts.scale to create a fonts.scale file to be processed by 'mkfontdir'.
-
Sheldon Lee Wen adds: "If you get errors such as 'unknown encodings' those fonts won't get added to the 'fonts.scale' or 'fonts.dir' files and hence will not be accessible. To make those fonts available try running
ttmkfdir -c -p > fonts.scale
You'll still get the errors but your fonts should get added to the fonts.scale file."
-
Run mkfontdir.
-
Run /usr/sbin/chkfontpath --add [new font directory
This will add the directory to '/etc/X11/fs/config'.
-
Run xset fp rehash to make sure that X recognizes the new fonts.
Someone asked me if it were possible to use font directories which reside on other filesystems (e.g. on a Windows partition). This shouldn't be a problem, as long as you tell Linux via /etc/fstab to mount this partition each time you boot
(you can do this with 'Linuxconf': choose 'File systems - Access local drives - Add'). Of course you have to add the path to that directory to '/etc/X11/fs/config', too. LM 7.1 features the 'DrakFont' tool, which allows you to import fonts from other oper
ating systems.
Caveats:
-
It is very easy to get something wrong here. If you do, 'xfs' won't be able to come up and so X won't work anymore. If this happens, switch to another virtual console (e.g. by pressing ALT-F2), log in as 'root', open '/etc/X11/fs/config' in an editor,
put a hash (#) in front of the new directory entry, safe the file and reboot.
-
Make sure the licences of the fonts you are going to use allow you to use them in more than one operating system.
section index / top
-
xfontsel displays fonts known to the X server. In case you wonder what the 'select' button is for: it copies the font recognition string to the clipboard.
-
KDE and GNOME come with their own font managers.
-
gfontview "is a small GTK+ font viewer for PostScript Type 1 and TrueType fonts. It allows you to display any character or string in a particular font as well as all glyphs present in it".
section index / top
TrueType's 'Great TrueType Fonts' page lists all major resources for TT fonts.
Please pay attention to copyright issues, many of these fonts may not be redistributable!
Fonts packages available at the RPM repository at Rufus.Org in RPM-Format.
Shareware Typefaces is a large, searchable collection of freeware and shareware fonts.
The fonts page of GIMP.org lists some packages useful for GIMP. If you've ever encountered those annoying script-fu errors because of missing fonts, this is the place to go!
Freshmeat lists font packages and font applications.
section index / top
|