ANSI Terminal layering characters one on top of another

  1. It is impossible to draw characters one over another in terminal. It is simply against the basic principle of terminal where each cell contains 1 cahracter.

  2. If your terminal supports unicode, there are special unicode characters called combining characters, one of which is overline. Its code is U+0305. So, using this, you can draw an overline on another character.

Here is a sample C code that does it

 #include <stdio.h>
 #include <wchar.h>
 #include <locale.h>
 int main() {
     setlocale(LC_CTYPE, "");
     for (wchar_t ch = 'a'; ch <= 'z'; ++ch) {
         wprintf(L"%lc\u0305 ", ch);
    }
 }

should yield something like that

a̅ b̅ c̅ d̅ e̅ f̅ g̅ h̅ i̅ j̅ k̅ l̅ m̅ n̅ o̅ p̅ q̅ r̅ s̅ t̅ u̅ v̅ w̅ x̅ y̅ z̅

Thats about as close as it gets to what you want.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top