The default fonts that ship with XFree86 are less than ideal for typical desktop publishing applications. Large presentation fonts show up jagged and unprofessional looking, and small fonts in Netscape are almost completely unintelligible. However, there are several free, high quality Type1 (PostScript) fonts available which can be readily used with XFree86, either version 3.X or version 4.X. For instance, the URW font collection ( x11-fonts/urwfonts) includes high quality versions of standard type1 fonts (Times Roman, Helvetica, Palatino and others). The Freefont collection ( x11-fonts/freefont) includes many more fonts, but most of them are intended for use in graphics software such as the Gimp, and are not complete enough to serve as screen fonts. In addition, XFree86 can be configured to use TrueType fonts with a minimum of effort: see the section on TrueType fonts later.
To install the above Type1 font collections from the ports collection, run the following commands:
# cd /usr/ports/x11-fonts/urwfonts # make install clean
And likewise with the freefont or other collections. To tell the X server that these fonts exist, add an appropriate line to the XF86Config file (in /etc/ for XFree86 version 3, or in /etc/X11/ for version 4), which reads:
FontPath "/usr/X11R6/lib/X11/fonts/URW/"
Alternatively, at the command line in the X session run:
% xset fp+ /usr/X11R6/lib/X11/fonts/URW % xset fp rehash
This will work but will be lost when the X session is closed, unless it is added to the startup file (~/.xinitrc for a normal startx session, or ~/.xsession when logging in through a graphical login manager like XDM). A third way is to use the new XftConfig file: see the section on anti-aliasing.
XFree86 4.X has built in support for rendering TrueType fonts. There are two different modules that can enable this functionality. The freetype module is used in this example because it is more consistent with the other font rendering back-ends. To enable the freetype module just add the following line to the "Module" section of the /etc/X11/XF86Config file.
Load "freetype"
For XFree86 3.3.X, a separate TrueType font server is needed. Xfstt is commonly used for this purpose. To install Xfstt, simply install the port x11-servers/Xfstt.
Now make a directory for the TrueType fonts (for example, /usr/X11R6/lib/X11/fonts/TrueType) and copy all of the TrueType fonts into this directory. Keep in mind that TrueType fonts cannot be directly taken from a Macintosh; they must be in Unix/DOS/Windows format for use by XFree86. Once the files have been copied into this directory, use ttmkfdir to create a fonts.dir file, so that the X font renderer knows that these new files have been installed. ttmkfdir is available from the FreeBSD Ports Collection as x11-fonts/ttmkfdir.
# cd /usr/X11R6/lib/X11/fonts/TrueType # ttmkfdir > fonts.dir
Now add the TrueType directory to the font path. This is just the same as described above for Type1 fonts, that is, use
% xset fp+ /usr/X11R6/lib/X11/fonts/TrueType % xset fp rehash
or add a FontPath line to the XF86Config file.
That's it. Now Netscape, Gimp, StarOffice, and all of the other X applications should now recognize the installed TrueType fonts. Extremely small fonts (as with text in a high resolution display on a web page) and extremely large fonts (within StarOffice) will look much better now.
Starting with version 4.0.2, XFree86 supports anti-aliased fonts. Currently, most software has not been updated to take advantage of this new functionality. However, Qt (the toolkit for the KDE desktop) does; so if XFree86 4.0.2 is used (or higher), Qt 2.3 (or higher) and KDE, all KDE/Qt applications can be made to use anti-aliased fonts.
To configure anti-aliasing, create (or edit, if it already exists) the file /usr/X11R6/lib/X11/XftConfig. Several advanced things can be done with this file; this section describes only the simplest possibilities.
First, tell the X server about the fonts that are to be anti-aliased. For each font directory, add a line similar to this:
dir "/usr/X11R6/lib/X11/fonts/Type1"
Likewise for the other font directories (URW, TrueType, etc) containing fonts to be anti-aliased. Anti-aliasing makes sense only for scalable fonts (basically, Type1 and TrueType) so do not include bitmap font directories here. The directories included here can now be commented out of the XF86Config file.
Anti-aliasing makes borders slightly fuzzy, which makes very small text more readable and removes ``staircases'' from large text, but can cause eyestrain if applied to normal text. To exclude point sizes between 9 and 13 from anti-aliasing, include these lines:
match any size > 8 any size < 14 edit antialias = false;
Spacing for some monospaced fonts may also be inappropriate with anti-aliasing. This seems to be an issue with KDE, in particular. One possible fix for this is to force the spacing for such fonts to be 100. Add the following lines:
match any family == "fixed" edit family =+ "mono"; match any family == "console" edit family =+ "mono";
(this aliases the other common names for fixed fonts as "mono"), and then add:
match any family == "mono" edit spacing = 100;
Supposing the Lucidux fonts as desired whenever monospaced fonts are required (these look nice, and do not seem to suffer from the spacing problem), replace that last line with these:
match any family == "mono" edit family += "LuciduxMono"; match any family == "Lucidux Mono" edit family += "LuciduxMono"; match any family == "LuciduxMono" edit family =+ "Lucidux Mono";
(the last lines alias different equivalent family names).
Finally, it is nice to allow users to add commands to this file, via their personal .xftconfig files. To do this, add a last line:
includeif "~/.xftconfig"
One last point: with an LCD screen, sub-pixel sampling may be desired. This basically treats the (horizontally separated) red, green and blue components separately to improve the horizontal resolution; the results can be dramatic. To enable this, add the line somewhere in the XftConfig file
match edit rgba=rgb;
(depending on the sort of display, the last word may need to be changed from ``rgb'' to ``bgr'', ``vrgb'' or ``vbgr'': experiment and see which works best.)
Anti-aliasing should be enabled the next time the X server is started. However, note that programs must know how to take advantage of it. At the present time, the toolkit Qt does, so the entire KDE environment can use anti-aliased fonts (see Section 5.7.3.2 on KDE for details); there are patches for GTK+ to do the same, so if compiled against such a patched GTK+, the GNOME environment and Mozilla can also use anti-aliased fonts. In fact, there is now a port called x11/gdkxft which allows one to use antialiased fonts without recompiling: see Section 5.7.1.3 for details.
Anti-aliasing is still new to FreeBSD and XFree86; configuring it should get easier with time, and it will soon be supported by many more applications.
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
For questions about FreeBSD, read the
documentation
before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |