Deprecated: Creation of dynamic property c2c_AddAdminCSS::$admin_options_name is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$config is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$disable_contextual_help is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$disable_update_check is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$hook_prefix is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$form_name is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$menu_name is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$name is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$nonce_field is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$settings_page is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$show_admin is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$textdomain is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$textdomain_subdir is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 106 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$author_prefix is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 109 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$id_base is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 110 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$options_page is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 111 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$plugin_basename is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 112 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$plugin_file is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 113 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$plugin_path is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 114 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$u_id_base is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 115 Deprecated: Creation of dynamic property c2c_AddAdminCSS::$version is deprecated in /var/www/html/wp-content/plugins/add-admin-css/c2c-plugin.php on line 116 kitty and Nerd Fonts… bringing Egyptian Hieroglyphs to your terminal… – erwin.co
Categories
Linux

kitty and Nerd Fonts… bringing Egyptian Hieroglyphs to your terminal…

TL/DR: Just download Nerd Symbols Only Font and Config Kitty

If you haven't tried the kitty terminal emulator, it's an awesome one. Even if I was still tortured to use Mac OS X, I think I would use Kitty of iTerm. You'll find that it's noticeably faster than gnome-terminal or vscode's built in terminal. (konsole is pretty snappy though)

Kitty has tons of features, however the process to discover and configure those features is a bit more complicated than other terminals that I've used.

For me, the most confusing aspect of kitty was understanding how to setup fonts. I never wanted to learn how kitty deals with fonts. I just wanted a kitty font config that works. If that's all you want, skip to kitty config.

First, Kitty requires that fonts have a fixed spacing of 100 defined. To check if a font can be used by Kitty, and the exact name you should enter to configure it, you'll want to use:

kitty list-fonts

If you're looking for a good font to use, I suggest you take a look at the open source Fira Code font, since it has nice ligatures for programming...

Fira Code example "ligatures" o visually simplify display of == --> ++ and :=

If you you have a budget to invest in a programming font, I think the MonoLisa font is even more attractive. To get a monospaced font to show up in Kitty if it's not showing up on it's own, you'll need to edit ~/.config/fontconfig/fonts.conf and add a section to "scan" for the font "family" and set "spacing" for that family to 100.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>

<match target="scan">
    <test name="family">
        <string>MonoLisa-Regular</string>
    </test>
    <edit name="spacing">
        <int>100</int>
    </edit>
</match>

</fontconfig>

Once you edit fontconfig/fonts.conf you'll need to rebuild the font cache and restart kitty to see the new font.

sudo fc-cache -fr

If kitty list-fonts still can't find the font that you're looking for, several steps possible steps to resolve are discussed on the kitty issue tracker.

Most terminals need you to setup "patched fonts" if you want to use "powerline" symbols... If you're looking to rice your command line, powerlevel10k, vim-devicons, and vim-airline can will use many of these "patched font" symbols.

img
vim-airline using patched fonts...
Powerlevel10k Extravagant Style
powerlevel10k zsh theme using patched fonts
vim-devicons overall screenshot
vim-devicons with patched fonts

If you want to use the "fontconfig" method for your whole configuration, you might be able to add something like the following ~/.config/fontconfig/fonts.conf so that symbols from the Symbols Nerd Font will be preferred, but I was not able to get this method to work, so I went with the kitty symbol_map method.

 <alias>
  <family>monospace</family>
  <prefer>
   <family>MonoLisa</family>
   <family>Symbols Nerd Font</family>
   <family>Noto Color Emoji</family>
   <family>Noto Sans Symbols2</family>
  </prefer>
 </alias>

Yes, you list all of them them [symbol_map] and yes you can have multiple ones. However, I recommend against doing that, there is rarely a need for it, since nerd fonts will automatically be used if found in most cases.

kovidgoyal, author of kitty

For me though, "auto detection" of nerd fonts never worked. The most evident example was each time I would run:

vim ~/.vimrc

The stylized "V" from vim-devicons would show a very rarely used Chinese character...

image
Editing .vimrc, the stylized V is shown for me as: 金 + 弦, which doesn't exist in most chinese dictionaries...
image
Editing .vimrc, the correct stylized "V" icon from vim-devicons

The "quick and dirty" way to get every symbol you want to load is the use the patched Nerd fonts, for example the Fira_Code_vX.X.zip patched Nerd Fonts.

However, with Kitty, the preferred way to get each font to show up is actually NOT to use patched fonts, instead to use kitty's "symbol_map" function.

Map the specified unicode codepoints to a particular font. Useful if you need special rendering for some symbols, such as for Powerline. Avoids the need for patched fonts. Each unicode code point is specified in the form U+<code point in hexadecimal>. You can specify multiple code points, separated by commas and ranges separated by hyphens. symbol_map itself can be specified multiple times. Syntax is:

symbol_map U+E0A0-U+E0A3,U+E0C0-U+E0C7 PowerlineSymbols
symbol_map codepoints Font Family Name

If you run kitty with, you'll get a list of each character code that's not found on the terminal you launched kitty from.

kitty --debug-font-fallback

For example, on the Right I'm using xterm to edit ~/.config/kitty/kitty.conf and on the left is my kitty instance... Here you can see pretty clearly the "DejaVu Sans Mono" font is providing the U+2605 (★) and U+21b6 (↶)

I would prefer to get all of the Nerd Fonts from the Nerd Fonts package.

First, make sure you download the "Symbols Nerd Font" (symbols only) font package, you can find it at:

src/glyphs/Symbols-2048-em Nerd Font Complete.ttf

Once you have the Symbols-2048-em Nerd Font Complete.ttf, copy it to ~/.local/share/fonts and then run sudo fc-cache -fr to reload the font cache.

Next, you'll want to add something like this to your kitty config:

font_family FiraCode
# or #
font_family MonoLisa

###########################################################
# Symbols Nerd Font complete symbol_map
# easily troubleshoot missing/incorrect characters with:
#   kitty --debug-font-fallback
###########################################################

# "Nerd Fonts - Pomicons"
symbol_map  U+E000-U+E00D Symbols Nerd Font

# "Nerd Fonts - Powerline"
symbol_map U+e0a0-U+e0a2,U+e0b0-U+e0b3 Symbols Nerd Font

# "Nerd Fonts - Powerline Extra"
symbol_map U+e0a3-U+e0a3,U+e0b4-U+e0c8,U+e0cc-U+e0d2,U+e0d4-U+e0d4 Symbols Nerd Font

# "Nerd Fonts - Symbols original"
symbol_map U+e5fa-U+e62b Symbols Nerd Font

# "Nerd Fonts - Devicons"
symbol_map U+e700-U+e7c5 Symbols Nerd Font

# "Nerd Fonts - Font awesome"
symbol_map U+f000-U+f2e0 Symbols Nerd Font

# "Nerd Fonts - Font awesome extension"
symbol_map U+e200-U+e2a9 Symbols Nerd Font

# "Nerd Fonts - Octicons"
symbol_map U+f400-U+f4a8,U+2665-U+2665,U+26A1-U+26A1,U+f27c-U+f27c Symbols Nerd Font

# "Nerd Fonts - Font Linux"
symbol_map U+F300-U+F313 Symbols Nerd Font

#  Nerd Fonts - Font Power Symbols"
symbol_map U+23fb-U+23fe,U+2b58-U+2b58 Symbols Nerd Font

#  "Nerd Fonts - Material Design Icons"
symbol_map U+f500-U+fd46 Symbols Nerd Font

# "Nerd Fonts - Weather Icons"
symbol_map U+e300-U+e3eb Symbols Nerd Font

# Misc Code Point Fixes
symbol_map U+21B5,U+25B8,U+2605,U+2630,U+2632,U+2714,U+E0A3,U+E615,U+E62B Symbols Nerd Font

The list of code point ranges above comes directly from the nerd-fonts test script, with the exception of the "Misc Code Point Fixes" that I added myself through trial and error with --debug-font-fallback.

You can test that you've got all fonts configured properly by running the "test-fonts.sh" script provided by nerd-fonts.

https://github.com/ryanoasis/nerd-fonts/blob/master/bin/scripts/test-fonts.sh

Be sure to run kitty with kitty --debug-font-fallback then run this script in your kitty window, and if you've set everything up correctly, you should not see any of the symbol missing or symbol fallback notices that were shown in the screenshot above. Once properly configured you'll get:

Note that there may still be a few messages, but generally all characters will now load correctly.
Small excerpt of the "test-fonts.sh" script once kitty is properly configured

If you're experimenting with MonoLisa, here are some settings that I found looked great.

font_family      MonoLisa
font_bold        MonoLisa-Bold
italic_font      MonoLisa-Light
adjust_baseline -4
font_size        14

Without the "adjust_baseline -4", the MonoLisa font was not aligned when I tried.

One last nugget of wisdom here, the "codepoints.net" site is the best unicode character lookup site I've ever seen. You can type the codepoint directly in the URL, and the layout is clean and free of ads.

https://codepoints.net/U+21B5





https://codepoints.net/U+E0A3
https://codepoints.net/U+E615
https://codepoints.net/U+E62B

Did you know there are Unicode codepoints for Egyptian Hieroglyphs?
Now you can put heiroglyphs in your terminal!"

Egyptian Hieroglyphs in markdown document displayed via kitty terminal
# Egyptian Hieroglyphs are Back!

  𓀀 𓀁 𓀂 𓀃 𓀄 𓀅 𓀆 𓀇 𓀈	𓀉 𓀊 𓀋 𓀌 𓀍 𓀎 𓀏 𓀐 𓀑
    𓀒 𓀓 𓀔 𓀕 𓀖 𓀗 𓀘 𓀙 𓀚	𓀛 𓀜 𓀝 𓀞 𓀟 𓀠 𓀡 𓀢 𓀣
    𓀤 𓀥 𓀦 𓀧 𓀨 𓀩 𓀪 𓀫 𓀬	𓀭 𓀮 𓀯 𓀰 𓀱 𓀲 𓀳 𓀴 𓀵
    𓀶 𓀷 𓀸 𓀹 𓀺 𓀻 𓀼 𓀽 𓀾	𓀿 𓁀 𓁁 𓁂 𓁃 𓁄 𓁅 𓁆 𓁇
    𓁈 𓁉 𓁊 𓁋 𓁌 𓁍 𓁎 𓁏 𓁐	𓁑 𓁒 𓁓 𓁔 𓁕 𓁖 𓁗 𓁘 𓁙
    𓁚 𓁛 𓁜 𓁝 𓁞 𓁟 𓁠 𓁡 𓁢	𓁣 𓁤 𓁥 𓁦 𓁧 𓁨 𓁩 𓁪 𓁫
    𓁬 𓁭 𓁮 𓁯 𓁰 𓁱 𓁲 𓁳 𓁴	𓁵 𓁶 𓁷 𓁸 𓁹 𓁺 𓁻 𓁼 𓁽
    𓁾 𓁿 𓂀 𓂁 𓂂 𓂃 𓂄 𓂅 𓂆	𓂇 𓂈 𓂉 𓂊 𓂋 𓂌 𓂍 𓂎 𓂏
    𓂐 𓂑 𓂒 𓂓 𓂔 𓂕 𓂖 𓂗 𓂘	𓂙 𓂚 𓂛 𓂜 𓂝 𓂞 𓂟 𓂠 𓂡
    𓂢 𓂣 𓂤 𓂥 𓂦 𓂧 𓂨 𓂩 𓂪	𓂫 𓂬 𓂭 𓂮 𓂯 𓂰 𓂱 𓂲 𓂳
    𓂴 𓂵 𓂶 𓂷 𓂸 𓂹 𓂺 𓂻 𓂼	𓂽 𓂾 𓂿 𓃀 𓃁 𓃂 𓃃 𓃄 𓃅
    𓃆 𓃇 𓃈 𓃉 𓃊 𓃋 𓃌 𓃍 𓃎	𓃏 𓃐 𓃑 𓃒 𓃓 𓃔 𓃕 𓃖 𓃗
    𓃘 𓃙 𓃚 𓃛 𓃜 𓃝 𓃞 𓃟 𓃠	𓃡 𓃢 𓃣 𓃤 𓃥 𓃦 𓃧 𓃨 𓃩
    𓃪 𓃫 𓃬 𓃭 𓃮 𓃯 𓃰 𓃱 𓃲	𓃳 𓃴 𓃵 𓃶 𓃷 𓃸 𓃹 𓃺 𓃻
    𓃼 𓃽 𓃾 𓃿

Leave a Reply

Your email address will not be published. Required fields are marked *