On 7 May 2006 23:55:05 -0700, Atul <[EMAIL PROTECTED]> wrote: > Hi, > > I have installed a truetype font (.ttf) on a linux machne (SUSE linux > 10, KDE) by copying it to my .fonts folder. I can use the font in all > applications like open-office and firefox browser. > > However, I cannot use the font in a python app that I am writing. The > list returned by Tkfont.families does not contain this particular font.
I don't know the Suse distro, but it seems on "modern" Linux distributions, there are 2 levels of font support: the first is the "native" X support, the second is provided by the graphical toolkit you're using (Qt with KDE, but I think OpenOffice & FireFox use Gtk). Unfortunately, tk - and therefore Tkinter - only sees the fonts at the X level, and not those at the Qt/Gtk level. But apparently, dropping your font file in your .fonts directory only makes the font available for Qt/Gtk, not for X. You can check that by running the command xlsfonts in a terminal: I really suspect your font will not appear in the list. To make the font visible at X level, you should make your .fonts directory a component of the X font path: - Go to your .fonts directory. - Check if the directory contains file named fonts.dir; If it does, check that the file contains a line referencing your .ttf file. If it does, skip the next 2 steps. - Create the fonts.scale file describing your TrueType fonts; this is done via a distribution-dependent utility, usually mkfontscale or ttmkfdir. - Create the fonts.dir file describing all the fonts in the directory by running mkfontdir in it. - Add the directory to you X font path by running the command: xset +fp ~/.fonts This last step is for testing purposes only, since its results won't survive your X session. You'll have to find a way to do it each time you log to your session, or each time your X server is restarted. You may also add your font file to a global font directory so that X will automatically see it when it starts (you'll have to rebuild the fonts.scale and fonts.dir files as above). HTH -- python -c "print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])" -- http://mail.python.org/mailman/listinfo/python-list