2

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
4

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.

  • Great it worked perfectly! – nowox May 28 '15 at 8:46
1

To install fonts in Cygwin X11 so they are available to xterm: get a listing of fonts loaded by setup:

ls -d /usr/share/X11/fonts

The result for me is:

/usr/share/X11/fonts/100dpi     /usr/share/X11/fonts/OTF
/usr/share/X11/fonts/75dpi      /usr/share/X11/fonts/TTF
/usr/share/X11/fonts/cyrillic   /usr/share/X11/fonts/Type1
/usr/share/X11/fonts/encodings  /usr/share/X11/fonts/urw-fonts
/usr/share/X11/fonts/misc       /usr/share/X11/fonts/util

in my case something is wrong with "misc" and "encodings" so I wont use them

Put a script similar to this in your ~/.xinitrc

fontinit=$HOME/.xfonts
xterm 2> /dev/null &
start-lxqt 2> /dev/null
# Ignore these for now, but fix them some time
#   encodings   util 
for font in 100dpi  75dpi  cyrillic  OTF  TTF  Type1  urw-fonts
do
# (for debugging ) echo trying $font
xset +fp /usr/share/X11/fonts/$font
done
xset fp rehash

After that when you start the X server using xinit or startxwin and then start an xterm then the font selection menu works for some things but especially true type fonts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.