Qt fonts HOWTO
This is a short HOWTO describing what is needed to get a good font support
with Qt applications on X11. It is mainly interesting for distributors or people setting
up Unix font support on their own. It is by no means complete, and you'll
have to work out some of the details I just sketch by yourself.
Enjoy,
Lars
(updated by Ivan E. Moore II rkrusty@debian.org with Debian specific information).
Contents
- Getting Antialiased fonts on XFree86 with Qt & KDE
- Getting a nice looking desktop without antialiased fonts
- Bitmapped fonts on X11
- Add existing scalable fonts to your fontpath
- Using true type fonts
- Using true type and postscript fonts for printing in KDE
- Where to find nice looking true type fonts on the web
- Getting good fonts for other scripts than latin
- Resources on the web
1. Getting Antialiased fonts on XFree86 with Qt & KDE
You will need to follow a few steps to get antialiased fotns on your X11 desktop. Please note,
that parts of the X11 code for the rendering extension are still experimental and drivers
do not exist for all graphics hardware.
There are a few preconditions you'll have to meet: (most are auto with Debian)
- You will need freetype2 installed on your system. (libfreetype6)
- You will need XFree86 >= 4.0.2, current CVS is recommended.
- The XFree driver for your graphics card will have to support the
rendering extension. Information as to which hardware is supported is
unfortunately a bit incomplete. Matrox is (and as the only one currently
hardware accelerated). As far as I heard the NVidia drivers are still under
development, but should come out soon.
- For other drivers have a look at the XFree86 web site.
Once you have all this, you can see if the rendering extension is available, by looking
at the output of xdpyinfo and checking if RENDER is listed as an extension.
If yes, you'll need to get a Qt-2.3.0 or later compled with Xft support. If you compile Qt yourself,
add -xft to the configure line.
You will need some nice looking true type fonts to really enjoy the Xft extension to
X11. See Chapter 4 in this HOWTO on where to get some. The Microsoft webfonts
are of very high quality and a good start.
After having downloaded them, you will need to add the path to your
true type fonts to the XftConfig file in /etc/X11.
Now set the environment variable QT_XFT to true
and start any Qt appliction (for example the designer). You should hopefully get
nice antialised fonts.
In case you are running KDE and don't get any fonts on your desktop, try removing the ~/.kde/share/config/kdefonts file.
2. Getting a nice looking desktop without antialiased fonts
2.1. Bitmapped fonts on X11
The standard X11 distribution comes with a set of bitmapped fonts. Unfortunately,
the standard setup allows the XServer to scale these fonts. As scaled
bitmap fonts look really ugly, the first thing to do is to tell the XServer not to
scale these fonts. This can be done, by editing the XF86Config file.
Replace all font path entries pointing to directories containing bitmapped fonts
as for example:
FontPath "/usr/lib/X11/fonts/75dpi"
by
FontPath "/usr/lib/X11/fonts/75dpi:unscaled"
Like this you'll never again see ugly scaled bitmapped fonts on your screen.
2.2. Add existing scalable fonts to your fontpath
There are a lot of free scalable fonts out there, that can be downloaded
and used. Some of them are distributed with X11 and some with ghostscript.
The sclable fonts distributed with X11 are automatically included in your
fontpath, so there is no need to worry about them. But you might want to add
the postscript fonts coming with ghostscript to your list of scalable
fonts.
The ghostscript font directory comes with a predefined set of fonts.dir,
fonts.scale and fonts.alias files, so basically all you need to do is to
add the directory to the fontpath in XF86Config.
A bit of caution is needed however. Some of the scalable postscript
fonts tend to look rather bad on screen, and should thus not get included
into the font list. If you get a font that looks a bit blocky using Qt/KDE,
this might be the reason and I'd recommend removing that particular font from
the font.* files.
(Packages include sharefont, freefont, msttcorefonts)
2.3. Using true type fonts
There are a few high quality fonts on the web available you can download for
free. Most of them are true type fonts, so you'll need to either install an
XServer that can deal with true type, or use a true type font server.
Most modern Linux distributions alread ship an XServer, that can handle true
type fonts natively. If you are using a commercial Unix, or an older system, that doesn't
ship with a true type enabled XServer, you will need to install a true type font server.
apt-get install xfs-xtt
Additionally you will need a tool called mkttfdir, to create a fonts.dir file
for your true type fonts.
apt-get install fttools
Now you can go on and download all thos nifty, nice looking true type fonts from the
web. See chapter 4 for a list of locations with nice fonts. Download
the fonts you are interested in and put them all in a directory named trueType
under /usr/lib/X11/fonts. Then run the utility mkttfdir utility in
that directory and put it's output in the fonts.dir file.
Add this directory to your font path in XF86Config (if your XServer can deal
with true type directly) or to the search path of your font server (xfsft or
xfstt).
3. Using true type and postscript fonts for printing in KDE
Qt 2.3.0 and later will use true type and postscript fonts it can find on your hard disk
to produce better quality printout. This will work automatically as long as the
postscript or true type can be found in your fontpath or if you use the X11 rendering extension.
A font server won't work, as the font server doesn't publish from where the fonts reside
on the hard disk. In this case add the postscript fonts directly to your fontpath (either in
you XServer configuration file; XF86Config if you are using XFree), or add them temporarily with
xset +fp /path/to/your/fonts/. To be able to use true type fonts without a font server, your XServer
must be able to use them.
4. Where to find nice looking true type fonts on the web
Most of the free fonts you can find out on the web are latin only. If you go to
some of the font websites listed at the end of this HOWTO, you can find thousands
of them. But unfortunately 90% of them are either special purpose or very low
quality.
The first thing I should perhaps mention is to have a look in your c:\windows\fonts directory
if you have windows installed, and just use these fonts. They are mostly of an excellent
quality and can already provide you with most of the fonts you need.
If you don't have Windows installed, you can still enjoy some good looking fonts
from Microsoft. The "core fonts for the web" are a collection of high quality
downloadbale fonts, that many webmasters rely on. However, their licensing is
a bit unclear, but you can download them at no cost for personal use.
The core fonts cover the WGL4 character set, that covers the Latin script,
cyrillic, greek and turkish. It is certainly a good idea to get them
from http://www.microsoft.com/truetype/fontpack/.
As a tip: The win3.1 version fo the fonts can be unpacked with unzip.
A list of great downloadable fonts for all different kind of scripts can be found
at http://www.hclrss.demon.co.uk/unicode/fonts.html
Another font worth mentioning is the bistream cyberbit font.
Licensing seems to allow to include it into distributions (but don't nail
me down on this; check yourself) and it is more or less complete in that it
contains almost all of Unicode-2.1. You can find it on any mirror of the netscape
ftp server.
A big bunch of fonts for latin cyrillic (and partly hebrew)
are part of the openoffice distribution. You can get them
from openoffice's CVS repository under extras/wnt/source/fonts/
4.1 Getting good fonts for other scripts than latin
Finding good free fonts for scripts other than latin1 is usually a lot harder
and for some scripts almost impossible, so I'll list the resources I know
of below. It is probably not complete, so if you know of a good free font
for a certain script feel free to tell me so I can add it to the list.
I'm only listing fonts I consider free in a sense that you can most
probably include them into a distribution in this list. Some other fonts
as the microsoft webfonts might be exactly what your looking for, but are
not listed here because their license does not match the above constraint.
- Supporting most of Unicode
- Bitstream Cyberbit:
ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/
- Japanese
- The only free fonts I know of are wadalab gothic and mincho
(postscript) and can be found at:
ftp://ftp.ipl.t.u-tokyo.ac.jp/Font/
A note how to turn these into type0 fonts (needed for
ghostscript support) can be found at:
http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/kanji.html
- Chinese (simplified and traditional):
- I also know of only two fonts here. They can be found at
http://trolls.troll.no/~lars/fonts/
- Korean:
- I heard there are free korean fonts available from:
ftp://ftp.cair-archive.kaist.ac.kr/pub/hangul/fonts/munhwa-fonts
but I could not reach the archive in the last time. I'd appreciate
any update on these.
Some more asian postscript fonts can be found at
http://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe
Here the license is a bit unclear and it's quite tedious to get them installed.
I managed to get them running for ghostscript but never tried to convince
X11 to use them. In princinple it should be possible though.
- Georgian
- Some georgian true type font can be found at:
http://www.redrival.com/giasher/download.htm
- Fonts covering Latin and cyrillic:
- A big bunch of fonts for latin cyrillic (and partly hebrew)
are part of the openoffice distribution. You can get them
from openoffice's CVS repository under extras/wnt/source/fonts/
See openoffice's web site for more.
- Arabic
- I only know of bitstream syberbit (see above) and some bitmapped
fonts:
Arabic Newspaper and ClearlyU from
http://crl.nmsu.edu/~mleisher/arabic24.html
- Hebrew:
- lots of fonts can be found at:
http://user.dtcc.edu/~berlin/font/hebrew.htm
some nonscalable fonts can be found at:
http://elmar.co.il/wwh/wwh/xfiles/H.fonts/index.en.html
http://sunsite.unc.edu/pub/Linux/X11/fonts/hebxfonts-0.2.tgz
- Greek:
- ftp://ftp.rhrz.uni-bonn.de/pub/institute/evtheol/milan.zip
ftp://ftp.rhrz.uni-bonn.de/pub/institute/evtheol/greekofc.zip
- Tamil:
- http://software.thai.net/tis-620/courierthai.html
- Ancient greek, hebrew and coptic:
- http://rosetta.atla-certr.org/TC/fonts/
5. Resources on the web
- Another font FAQ for Unix/X11:
- http://www.cs.ruu.nl/wais/html/na-dir/internationalization/font-faq.html
- Sites if you search for true type fonts for specific scripts:
- http://user.dtcc.edu/~berlin/fonts.html
http://www.sil.org/computing/fonts/
Last modified: Fri Mar 9 22:00:07 CET 2001