Skip to content
D Groth edited this page Oct 11, 2024 · 2 revisions

MicroEmacs Font Support

Font selection done in the terminal is provided by the terminal emulator and for the Windows version on the Windows operating system is just using the system fonts.. Font support of the GUI MicroEmacs version on MacOS and on linux systems is more problematic as the existing fonts on the system are often not indexed for older X11 applications. Usually just a few X11 bitmap fonts are installed with X11 applications.

However MicroEmacs can use as well TrueType fonts for display if they are properly indexed. See below for a little guide on how to do this.

Font Selection on X11

First you should check if you have the tool xfontsel available on your system. This is an useful tool to select fonts for core X11 applications. On Red Hat systems like Fedora or AlmaLinux this can be done usually like this:

sudo dnf install xfontsel

On Debian systems and its derivatives like Ubuntu, MX LInux or Mint you can install it usually with:

sudo apt install x11-xutils

More X11 Bitmap Fonts

Some more bitmap fonts can be installed btw with:

sudo dnf install xorg-x11-fonts-ISO8859-1-*  # iso-8859-1 fonts western european
sudo dnf install xorg-x11-fonts-ISO8859-2-*  # iso-8859-2 fonts central european
sudo dnf install xorg-x11-fonts-ISO8859-9-*  # iso-8859-9 fonts european and turkish
sudo dnf install xorg-x11-fonts-ISO8859-15-* # iso-8859-15 fonts with Euro symbol etc

And on Debian systems:

sudo apt install xfonts-base xfonts-75dpi xfonts-100dpi \
   xfonts-100dpi-transcoded xfonts-75dpi-transcoded

After you restart your X-session more X11 monospace fonts like Courier and lucidatypewriter should be available. Both should support the basic (ISO-8859-1) and some extended character sets (ISO-8859-9 and ISO-8859-15 etc).

True Type fonts on X11

Older X11 applications need an index for existing True Type fonts on the system before they can use them. For details have a look at the FreeBSD manual

Some systems provide already such index, but most do not. For instance on my Fedora system I have True Type fonts like "LiberationMono" installed in /usr/share/fonts by they might not show-up in my xfontsel font selection tool.

The procedure below should work on Debian and Red Hat based systems.So we link all True Type Fonts which have the string Mono in their filename into the users ~/.local/share/fonts folder and then update the font index using the mkfontscale commands. Afterwards we refresh the font path for X11 applications using the xset command we should have these fonts available for our X11 applications like MicroEmacs.

[[ -d ~/.local/share/fonts ]] || mkdir ~/.local/share/fonts
find /usr -iname "*Mono*.ttf" | xargs ln -s -t ~/.local/share/fonts/
mkfontscale ~/.local/share/fonts/ 
mkfontdir ~/.local/share/fonts/ 
xset +fp ~/.local/share/fonts/
xset fp rehash

The font path refresh provided by the xset commands should be done after every X11-start. So it is a good idea to place lines like

sleep 5 # to ensure this is done after a complete X11 start
xset +fp ~/.local/share/fonts/
xset fp rehash

In your X11 startup scripts or into an autostart entry.

Obviously you can as well place TTF files of other Monospaced fonts into the ~/.local/share/fonts folder, redo the mkfontscale/mkfontdir index and do a xset fp rehash again.

Here is a list of 44 Monospaced Fonts on Google Fonts where you can download TTF versions of them. I usually use only Regular or Medium and Bold versions of the fonts. Please note, that not all fonts work correctly using this approach. It seems as well that OTF fonts can't be used by this procedure. Fonts which seems to work are for instance Source Code Pro, Courier Prime, Chivo Mono, Ubuntu Mono or Fira Mono and Fira Code.

Clone this wiki locally