Fonts on Linux

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chris
    PosChengband Maintainer
    • Jan 2008
    • 702

    Fonts on Linux

    I finally managed to figure out how to get better fonts installed and running on Linux for the X11 port. This was rather difficult and I seem to remember it used to just work, but these days (Mint 17.1) it seems that installing new font packages does not tell X11 about them at all. So xlsfonts won't list the new fonts, and only things listed by xlsfonts will work in the X11 port.

    Here is how I got this working:
    Code:
    [1] Install some better fonts. For example
    $ sudo apt-get install fonts-liberation
    
    [2] See what fonts are on your system that PosChengband can use:
    $ xlsfonts
    Notice that the new fonts aren't there!
    
    [3] Find where the new fonts were installed. For example
    $ fc-list | grep liberation
    /usr/share/fonts/truetype/liberation/LiberationSansNarrow-Italic.ttf: Liberation Sans Narrow:style=Italic
    /usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf: Liberation Sans:style=Regular
    /usr/share/fonts/truetype/liberation/LiberationMono-BoldItalic.ttf: Liberation Mono:style=Bold Italic
    /usr/share/fonts/truetype/liberation/LiberationSerif-Italic.ttf: Liberation Serif:style=Italic
    /usr/share/fonts/truetype/liberation/LiberationMono-Bold.ttf: Liberation Mono:style=Bold
    /usr/share/fonts/truetype/liberation/LiberationSansNarrow-Regular.ttf: Liberation Sans Narrow:style=Regular
    /usr/share/fonts/truetype/liberation/LiberationSerif-Bold.ttf: Liberation Serif:style=Bold
    /usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf: Liberation Mono:style=Regular
    /usr/share/fonts/truetype/liberation/LiberationSans-Italic.ttf: Liberation Sans:style=Italic
    /usr/share/fonts/truetype/liberation/LiberationSerif-BoldItalic.ttf: Liberation Serif:style=Bold Italic
    /usr/share/fonts/truetype/liberation/LiberationSansNarrow-BoldItalic.ttf: Liberation Sans Narrow:style=Bold Italic
    /usr/share/fonts/truetype/liberation/LiberationMono-Italic.ttf: Liberation Mono:style=Italic
    /usr/share/fonts/truetype/liberation/LiberationSans-BoldItalic.ttf: Liberation Sans:style=Bold Italic
    /usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf: Liberation Serif:style=Regular
    /usr/share/fonts/truetype/liberation/LiberationSansNarrow-Bold.ttf: Liberation Sans Narrow:style=Bold
    /usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf: Liberation Sans:style=Bold
    
    [4] Bang head on wall in frustration!!
    
    [5] Tell X Server about the fonts:
    $ cd /usr/share/fonts/truetype/liberation/
    $ su
    $ mkfontscale
    $ mkfontdir
    $ exit
    $ cat fonts.dir
    ...
    LiberationMono-Regular.ttf -misc-liberation mono-medium-r-normal--0-0-0-0-m-0-adobe-standard
    LiberationMono-Regular.ttf -misc-liberation mono-medium-r-normal--0-0-0-0-m-0-ascii-0
    LiberationMono-Regular.ttf -misc-liberation mono-medium-r-normal--0-0-0-0-m-0-ibm-cp437
    ... [and many more]
    
    $ xset +fp /usr/share/fonts/truetype/liberation
    $ xset fp rehash
    $ xlsfonts | grep liberation
    ...
    -misc-liberation sans-medium-i-normal--0-0-0-0-p-0-iso8859-1
    -misc-liberation sans-medium-i-normal--0-0-0-0-p-0-iso8859-10
    -misc-liberation sans-medium-i-normal--0-0-0-0-p-0-iso8859-13
    -misc-liberation sans-medium-i-normal--0-0-0-0-p-0-iso8859-15
    -misc-liberation sans-medium-i-normal--0-0-0-0-p-0-iso8859-16
    ... [and many more]
    
    [6] Now, try to find a font you like. For example:
    $ cd [path to poschengband]
    ~/Src/poschengband> ANGBAND_X11_FONT='-misc-liberation mono-medium-r-normal--20-0-0-0-m-0-iso8859-1' ./poschengband -mx11
    You can play with the point size since these are vector fonts. I chose 20pt since my eyes suck!
    
    [7] Smile. Grab beer to recover from step [4].
Working...
😀
😂
🥰
😘
🤢
😎
😞
😡
👍
👎