Debian Set Custom Font in Tty

Table of Contents

Preface

Here's how to setup a custom keymap for your TTY, as well as rebinding the caps key to CTRL.

Custom keymap TTY

The ConsoleData package contains a dozens of different keymaps. I'm copying the US Qwery kmap to a plain text file. From there we can modify which keycodes do which things.

sudo apt install -y console-common console-data
zcat /usr/share/keymaps/i386/qwerty/us.kmap.gz > us.kmap

I used the showkey command to display the keycode for each key I press. This is how I know which keycode coorlates to the caps key, ctrl key, etc. Wait 10 seconds without pressing a key to have the program terminate.

Here's what the output of showkey looks like. I pressed the "caps" key and then the "menu" key.

keycode 58 press
keycode 58 release
keycode 127 press
keycode 127 release

Edit the us.kmap file we created earlier. I used vim to quickly search the keycode for the CAPS key. I then changed the value of keycode 58 from "Caps" to "Control"

# Original caps key
keycode 58 = Caps

# Modified
keycode 58 = Control

Keycode 127 was for the menukey on my keyboard. It wasn't listed in the us.kmap file. I added a new line to the bottom of it which seemed to work perfectly.

keycode 127 = Control

Finally we can load the keymap using this command. I added it as a cronjob to apply after reboot.

loadkey us.kmap

Custom font TTY

Edit /etc/default/console-setup and modify the following variables:

FONTFACE="TerminessTTF Nerd Font Mono"
FONTSIZE="24x12"

The font will be loaded upon reboot.