Install TTF font on xterm (cygwin)

cygwin;fontsxterm

I am trying to install a new font on Cygwin. Lots of websites give tricks for an old Cygwin where everything was inside:

/usr/X11R6/lib/X11/fonts/TTF

Some say it's easy with this:

cp /cygdrive/c/WINDOWS/Fonts/*.[tT][tT][fF] /usr/X11R6/lib/X11/fonts/ttf/

I guess with the Cygwin 7.4 fonts are located into /usr/share/fonts/ instead.

I tried to run xfontsel and I have very few fonts installed. I would like to install DejaVu Sans Mono and Consolas. Is is possible? How?

Anyway, I naively tried this:

mkdir /usr/share/fonts/ttf/
cp /cygdrive/c/WINDOWS/Fonts/consola*.ttf /usr/share/fonts/ttf/
xset fp rehash
xfontsel

But I still see few fonts with a pretty bad anti-aliasing and the TTF fonts are not visible.

Any clues?

EDIT

I also get errors here:

$ xset +fp /usr/share/fonts/ttf
xset:  bad font path element (#0), possible causes are:
    Directory does not exist or has wrong permissions
    Directory missing fonts.dir
    Incorrect font server address or syntax

Best Answer

TrueType fonts with X are usually done using fontconfig. One of its features is that it looks by default in the .fonts directory under your home directory. You would use fc-list to list the fonts which are available, and use them with the -fa (family name) and -fs (font size) options of xterm. (while xfd has a corresponding -fa option, xfontsel does not).

xset on the other hand, looks for bitmap fonts which are referenced using the XLFD naming convention. You would use xlsfonts for listing those, and the -fn option of xterm.

These links discuss the .fonts directory:

However, from the example given it seems that you probably already have TrueType fonts installed, and that fc-list is the natural starting point.

Related Question