Tech Memorandums

Kannada in the Terminal

Its 2020 and I am consumed by needing to have Kannada in the terminal. The reason is that I have to deal with a bunch of AWS profiles and regions and I need to have context as my commands work the same way in dev as they do in prod.

So I whip up a quick prompt_segment. The important bit is:

region_map=('cci' 'ಕೊಂ' 'tyk' 'ಟೈ')
local prompt_text="%{%B${AWS_CHAR}%1G%} %{${region_map[${AWS_PROFILE}]}%1G%}%b·${AWS_DEFAULT_REGION/-*-/}"

Stripping away the %{%} glitch syntax, it is is essentially ${region_map[${AWS_PROFILE}]. However, kitty does not show this at all. This is what it looks like.


Hmmm. cat'ing the emacs HELLO file shows that Kannada is being rendered like in 2001. Hindi seems much better, so I try that.


In the prompt it looks small. The ॐ looks like it is half height. It it is better than कों, which looks very weird.

AWS prompt

This might be something in the terminal. Kitty has very extensive font configuration capabilities. I first try,

adjust_line_height  150%
adjust_column_width 0

Everything is taller but the glyph remains unchanged.

line height

I decide to see if there is something in the font parameters that I can use. I try kitty + list-fonts and I don’t see any Indic fonts there at all. Kitty can only deal with monospaced fonts. So I look for just monospaced fonts

% fc-list :lang=kn spacing=100 family
Lohit Kannada
Noto Serif Kannada
Noto Sans Kannada
Noto Sans Kannada UI

The character that was not rendered in kitty shows up just fine in Emacs

             position: 412 of 1994 (21%), column: 19
            character: ಕ (displayed as ಕ) (codepoint 3221, #o6225, #xc95)
              charset: unicode (Unicode (ISO10646))
code point in charset: 0x0C95
               script: kannada
               syntax: w 	which means: word
             category: .:Base, L:Left-to-right (strong)
             to input: type "C-x 8 RET c95" or "C-x 8 RET KANNADA LETTER KA"
          buffer code: #xE0 #xB2 #x95
            file code: #xE0 #xB2 #x95 (encoded by coding system utf-8-unix)
              display: composed to form "ಕೊಂ" (see below)

Composed with the following character(s) "ೊಂ" using this font:
  xfthb:-GOOG-Noto Sans Kannada UI-normal-normal-normal-*-20-*-*-*-*-0-iso10646-1
by these glyphs:
  [0 2 3221 240 11 0 12 19 -1 nil]
  [0 2 3274 63 15 -4 15 13 -2 nil]
  [0 2 3202 6 11 0 11 12 -2 nil]

Character code properties: customize what to show
  general-category: Lo (Letter, Other)
  decomposition: (3221) ('ಕ')


Why don’t these fonts show up in kitty’s list-fonts? They are being used (in some cases, like when rendering the HELLO file).

Why are some glyphs like क half height but others like ट not?


Kitty shrinks glyphs with their ink box wider than the advance width #297 Small sized nerdfont symbols #1463