CustomizingFontsForUnix

From AbiWiki

(Difference between revisions)
Jump to: navigation, search
Maintenance script (Talk)
(Importing text file)
Newer edit →

Revision as of 02:54, 17 October 2007

Contents

IntlFAQ: Customizing Fonts for Unix in AbiWord

[note that this may well be obsolete information for recent versions of AbiWord using fontconfig]

Contents


1. Introduction

AbiWord limits the fonts it makes available to the user to those located in /usr/local/AbiSuite/fonts directory (unless you chose different installation location) and in the locale-specific sub-directories of this directory (see the UnixLocale.txt document). A standard set of fonts is provided with AbiWord and these are located in this directory. If you wish to make an additional font available to AbiWord, you need to do the following:

  • Place the font into the fonts directory (or symlink it there, if it is located elsewhere on your machine).
  • Update the fonts.dir file.

The detailed procedure for pfa/pfb fonts and for ttf fonts is slightly different and is descirbed below.


2. pfa / pfb fonts

If your font came with a vendor provided afm file, you should copy or symlink it alongside the pfa/pfb file. If not AW will generate the afm file automatically, but using a vendor provided afm file is preferable.

To update the fonts.dir file, you should add an entry for the new font into fonts.scale and then run mkfontdir. If you do not know what the entry in the fonts.scale should be, you can generate it using the utility ttmkfdir.

3. TTF fonts

First of all, your font server must support ttf fonts. Then, just as in the case of pfa fonts, you need to add an entry into fonts.scale, and you should use the same program (ttmkfdir) to generate the entry from the font itself. Note, that in the case of ttf fonts, the utility will generate multiple entries, for a number of diferent encodings the font supports, just disregard those you do not need. Once fonts.scale is updated, run mkfontdir.

IMPORTANT: if you decide to update a ttf font that you have used with AbiWord previously, you will need to remove some support files that AbiWord generated. If your font is called myfont.ttf, look for files myfont.afm, myfont.u2g and myfont.t42 and delete them, then install the updated ttf font; AbiWord will generate the support files the first time you use the font.

4. Unicode peculiarities

If are using a UTF-8 locale, you need to install unicode fonts. To make XFree86 to treat a font as a Unicode font, you need to specify the encoding in the XLFD (the entry in the fonts.dir/fonts.scale file) as iso10646-1. To see if your font is treated as a Unicode font run `xlsfonts -ll -fn font_name. This will dump out lot of information about your font, and somewhere among it should be values min_byte1 and max_byte1; if both of these are 0, then your font is being treated as 8-bit only font. In my experience it is not currently possible to use a pfa Type 1 or 2 font under XFree86 4.0.2 as a proper Unicode font; if you know how to make XFree treat a pfa font as a Unicode font, please let me know so that I can update this document.

5. GTK2 (Abiword) default font

To modify the default font for GTK2 applications such as Abiword, edit the global system file or ~/.gtkrc-2.0 with a line such as:

gtk-font-name="Sans 12"

See GTK2 "themes" for other possible modifications to GTK2 apps.

Contributors

Personal tools