Re: Font references and info
On Thu, 2003-07-10 at 04:20, Aaron wrote:
>
> I don't really care about bitmap fonts, but I am still very unclear
> how X11 is made aware of the availability of the FreeType fonts.
Sorry for the rather long delay for this reply. Procastination is my
weakness. :)
I am assuming that you're using at least XFree86 4.2.
- Applications can use a particular font only if the applications
know it's there.
So, first thing first, how to let the application knows that a
font exist? Nowadays, X11 appplications get access to fonts
(i.e. knows about a font) either through:
1. Asking the X11 Server
2. Fontconfig
3. Application-specific procedure.
For (1), the X11 Server needs to have the appropriate
directories listed in its FontPath.
We're mainly talking about TrueType fonts here, so, the
directory /usr/share/fonts/truetype should be listed in your
FontPath in XF86Config-4. You can check if you have the
directory listed if you do "xset q" in an xterm and check the
values for the "FontPath:" entry. If you do have the TTF
directory in your X11 server's font path, there still two more
things to do -- creating the fonts.dir and fonts.scale files.
The X server needs this two files, and you create them by using
the following commands in the TTF directory:
ttmkfdir -o fonts.scale
mkfontdir
If you're doing this while in X, you might need to do
xset fp rehash
before the fonts will show up when doing an "xlsfonts".
Now, if you're using defoma (Debian Font Manager) to managed
your fonts, the actual directory should be
/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType. Just having
this directory in the X server's font path, AND loading the
freetype or xtt module in XF86config-4 should make the TrueType
fonts available to your applications. All that mucking about
with creating fonts.scale and fonts.dir files is done for you by
defoma.
In either case, the actual font files themselves should be in
/usr/share/fonts/truetype.
Now, this WON'T give you anti-aliased fonts at all, but at least
you do get access to the TrueType fonts on your system when
you're using applications which relies on the X11 font protocol.
If you want anti-aliased fonts (both TrueType and Postscript
Type 1), see (2).
For (2), all you have to do is put the directory containing the
fonts you want to use in the fontconfig configuration file.
This applies to both Xft and Xft2.
Xft is the old and deprecated. If possible, upgrade to Xft2.
Xft's configuration file is XftConfig and it lives in /etc/X11/.
Just add lines like:
dir "/usr/X11R6/lib/X11/fonts/Type1"
dir "/usr/share/fonts/truetype"
to the beginning of the file.
Xft2's configuration file lives in /etc/fonts/fonts.conf and is
an XML file. Check that entries like:
<dir>/usr/share/fonts</dir>
<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
<dir>/var/lib/defoma/x-ttcidfont-conf.d/dirs</dir>
<dir>~/.fonts</dir>
are found in it. Technically, if the directories where you have
your font files are not found in it, you should put them in
/etc/fonts/local.conf instead of modifying fonts.conf itself.
Note that there was no need to make fonts.scale and fonts.dir
files at all.
For (3), you're only your own buddy. :) Look to GhostScript for
an
example of an application which uses it's own font access
mechanism.
- Now that applications have been made aware of the fonts, give the
X server a mechanism to actually display the fonts.
Load the modules "freetype" or "xtt" in XF86Config-4, one or the
other, but NOT both.
If your video card supports RENDER extension, the X server will do
the anti-aliasing on fonts accessed through fontconfig.
Otherwise, what happens is that the X server renders the fonts
non-antialiased and ship it back to the application. The Xft/Xft2
library used by the application will then do the actual
antialiasing. This is slower and uses more network bandwidth if
you're displaying applications remotely.
> My understanding was that FreeType could rasterize TTFs on request
> so that the application thinks it's dealing with a bitmap or pixmap
> or what have you, when in fact it was derived from a TTF.
That's correct (more or less, depending on how pedantic one wants to
be).
> Yet "verdana" doesn't appear in any of my available font lists in
> various applications (xfontsel, openoffice.org). I just want to know
> what I'm doing wrong.
For xfontsel (which uses the "legacy" X11 font mechanism) you have to
do the steps in (1) above. For openoffice.org and other Xft-aware
(both version 1 and 2) applications, you have to do the steps in (2)
above.
Hope that helps.
--
Steven Yap <syap@shaw.ca>
Reply to: