Fontconfig abuse by VTE, or Fonts setup for the international LiveCD

Alexander E. Patrakov patrakov at ums.usu.ru
Sat Sep 24 03:10:07 PDT 2005


Hello,

the following TrueType fonts are present on the LFS Live CD 
(utf8-newmake branch):

bkai00mp.ttf                          DejaVuSerif-Oblique.ttf  luximri.ttf
bsmi00lp.ttf                          DejaVuSerif-Roman.ttf    luximr.ttf
DejaVuSans-BoldOblique.ttf            FreeMonoBoldOblique.ttf  luxirbi.ttf
DejaVuSans-Bold.ttf                   FreeMonoBold.ttf         luxirb.ttf
DejaVuSansCondensed-BoldOblique.ttf   FreeMonoOblique.ttf      luxirri.ttf
DejaVuSansCondensed-Bold.ttf          FreeMono.ttf             luxirr.ttf
DejaVuSansCondensed-Oblique.ttf       FreeSansBoldOblique.ttf  luxisbi.ttf
DejaVuSansCondensed.ttf               FreeSansBold.ttf         luxisb.ttf
DejaVuSansMono-BoldOb.ttf             FreeSansOblique.ttf      luxisri.ttf
DejaVuSansMono-Bold.ttf               FreeSans.ttf             luxisr.ttf
DejaVuSansMono-Oblique.ttf            FreeSerifBoldItalic.ttf  VeraBd.ttf
DejaVuSansMono-Roman.ttf              FreeSerifBold.ttf        VeraBI.ttf
DejaVuSans-Oblique.ttf                FreeSerifItalic.ttf      VeraIt.ttf
DejaVuSans.ttf                        FreeSerif.ttf            VeraMoBd.ttf
DejaVuSerif-BoldOblique.ttf           gbsn00lp.ttf             VeraMoBI.ttf
DejaVuSerif-Bold.ttf                  gkai00mp.ttf             VeraMoIt.ttf
DejaVuSerifCondensed-BoldOblique.ttf  kochi-gothic-subst.ttf   VeraMono.ttf
DejaVuSerifCondensed-Bold.ttf         kochi-mincho-subst.ttf   VeraSeBd.ttf
DejaVuSerifCondensed-Oblique.ttf      luximbi.ttf              VeraSe.ttf
DejaVuSerifCondensed.ttf              luximb.ttf               Vera.ttf

All Type1 fonts that come with Xorg are removed. The version of DejaVu 
fonts is 1.14. The contents of /etc/fonts/fonts.conf is the same as in 
the unmodified Fontconfig-2.3.2, with the following exception: the 
string "Bitstream Vera" is globally replaced with "DejaVu".

This font setup works perfectly with xterm in Xft mode when the font is 
set to Monospace (aka xterm -lc -fa Monospace -fs 12). For locales where 
DejaVu Sans Mono contains all characters of the national alphabet, it is 
used. For el_GR and el_GR.UTF-8 (where DejaVu doesn't contain all the 
Greek characters), FreeMono is automatically used instead, and no 
characters (even no English characters) are taken from DejaVu Sans Mono. 
In the similar way, Arphic fonts are used for Chinese and Kochi fonts 
for Japanese. That's good, because all characters (both Latin and 
national) are rendered in a consistent fashion. Moreover, xterm accepts 
font size in points, not pixels, thus the described setup works for all 
screen resolutions. This fits nicely with the principle that any need to 
configure anything except the LANG variable and the timezone after 
booting from the LiveCD is a bug.

I think that such behaviour is by good design. Thanks to Fontconfig 
developers for their good work.

However, due to better integration with Xfce and better support for 
GTK-based input method editors (such as SCIM), I decided to install 
(VTE-based) Xfce Terminal as a terminal emulator on this CD. 
Unfortunately, this brings a lot of font-related problems due a very bad 
font matching algorithm implemented in the file src/vtexft.c in VTE 
sources, function _vte_xft_font_for_char(). This basically chooses the 
first font that contains a given character, and doesn't look at the 
locale and its orthography at all. Thus, it happily picks (even in Greek 
locales!) Greek letters π and Ω from DejaVu Sans Mono and other  Greek 
letters from some other random fonts like Arphic ones (and they also 
don't fully cover Greek orthography) instead of consistently using 
FreeMono. I think it is a design bug in VTE, fonts that don't contain 
the full character range commonly used in the language implied by the 
locale should be either completely rejected or used only as a last resort.

Question to VTE developers: are there any plans to fix this? (please CC: 
livecd at linuxfromscratch.org)

Possible results of various font setups on the LiveCD are shown on 
screenshots located at http://ums.usu.ru/~patrakov/fontshots/ . 16 and 
20 are font sizes (in pixels! Arrgh!). Screenshots with names starting 
with "Monospace" are prepared with the Monospace generic font alias 
being selected, "BitstreamVera" means the hack where the Bitstream Vera 
Sans Mono font is selected (but not necessarily used because it contains 
very few glyphs).

As you can see, Monospace looks really bad for Greek. This is not the 
case with xterm (although one isn't able to cheat with xterm and put all 
languages on one screenshot because xterm rightfully consults its own 
$LANG when choosing a font). Selecting the (obviously wrong because of 
poor Unicode coverage) Bitstream Vera Sans Mono font leads to 
surprizingly good results, although glyphs from some proportional fonts 
are leaked into the screenshot (that manifests itself in the overlapping 
characters).

Question to LiveCD developers: is this hackish "Bitstream Vera Sans 
Mono" setup acceptable for the LFS LiveCD release?

Also: what's the proper TrueType font for Korean?

-- 
Alexander E. Patrakov



More information about the livecd mailing list