Is there a monospaced font where all characters are the same width?

I’m editing a file in gedit, and there is a semigraphic schematic of a keyboard. Some characters being a bit wider than others ruins the whole picture.

That’s how it should look like:

That’s how it looks like because of Tab and AltGr symbols:

In standard font there are even more problematic characters.

Is there a font that fixes them all? Or any other solution to force-shrink them?

1 Like

I suggest you try a few monospace fonts to find one that works.
You could also report a bug against the font that has this problem.

Aren’t actually the two characters right after Tab and AltGr causing the shift?

1 Like

Yes, it’s these two. On standard font even more characters are of the wrong width.

Maybe if you could paste the schematic keyboard as text (preformatted by pressing the </> button, or by hitting Ctrl-E after the text is selected), we could take a look.

1 Like

This is a cool project ! I have some use for this as I am trying to collate all my most used application’s keyboard shortcuts into a easily visual representation.

This gives me some ideas !

Yes, sure!

// ┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┲━━━━━━━━━┓
// │ Ё ``│ ! ˝ │ @   │ №   │ $   │ %   │ ^ ¯ │ &   │ * ₴ │ (   │ )   │ _ — │ Ъ + ┃ ⌫       ┃
// │ ё ` │ 1 ´ │ 2 ¨ │ 3 # │ 4 ¢ │ 5 € │ 6 ˘ │ 7   │ 8 ₽ │ 9 [ │ 0 ] │ - – │ ъ = ┃Backspace┃
// ┢━━━━━┷━┱───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┺━┳━━━━━━━┫
// ┃       ┃ Я Ѣ │ Ж Ѵ │ Ф Ѳ │ П   │ Г Ґ │ й Ј │ Л Љ │ У Ў │ Ы Ї │ Ю : │ Ш { │ Щ } ┃ Enter ┃
// ┃ Tab ↹ ┃ я ѣ │ ж ѵ │ ф ѳ │ п   │ г ґ │ й ј │ л љ │ у ў │ ы ї │ ю ; │ ш « │ щ » ┃   ⏎   ┃
// ┣━━━━━━━┻┱────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┺┓      ┃
// ┃ ⌫ Back ┃ А   │ Р   │ С   │ Т Ћ │ Д Ђ │ Ч Џ │ Н Њ │ Е Є │ И І │ О   │ Ь " │ Э | ┃      ┃
// ┃  space ┃ а   │ р   │ с   │ т ћ │ д ђ │ ч џ │ н њ │ е є │ и і │ о   │ ь ' │ э \ ┃      ┃
// ┣━━━━━━━━┻━┱───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┲━━━┷━━━━━┻━━━━━━┫
// ┃          ┃ З Ѕ │ Х   │ Ц   │ В   │ Б Ѓ │ К Ќ │ М   │ ;   │ :   │ ? Ӏ ┃                ┃
// ┃  Shift ⇧ ┃ з ѕ │ х   │ ц   │ в   │ б ѓ │ к ќ │ м   │ , < │ . > │ / ӏ ┃     Shift ⇧    ┃
// ┣━━━━━━━┳━━┻━━━━┳┷━━━━━┷┱────┴─────┴─────┴─────┴─────┴─────┴┲━━━━┷━━┳━━┻━━━━┳━━━━━━━┳━━━┛
// ┃       ┃       ┃       ┃                                   ┃       ┃       ┃       ┃
// ┃ Ctrl  ┃ Meta  ┃  Alt  ┃                Space              ┃AltGr ⇮┃ Menu  ┃ Ctrl  ┃
// ┗━━━━━━━┻━━━━━━━┻━━━━━━━┹───────────────────────────────────┺━━━━━━━┻━━━━━━━┻━━━━━━━┛

It also is in every Linux installation in /usr/share/X11/xkb/symbols/ru

Edit: It also looks great on this forum. What font does it use?

I have tested this on a non-Linux machine, with Courier New, and while looking better, still not perfect.

The way to get this fixed is to raise a bug report against the font.
Which font is not working?

Yes, indeed, this one in the code block is looking good indeed.

@barryascott , would you know which font is being used as preformatted text here on Discourse?

There is something strange happening here.

If I paste the text into the terminal, it looks great. See screenshot below. Font is Monospace.

In the Text Editor, however, the same Monospace font is set up, yet there is the shift.

2 Likes

It will depend on how your browser is configured.
Suggest you use your browsers web page inspection debug tool to find out.

1 Like

It looks great in KDE Konsole too.

I think the issue isn’t with the font itself, but rather with how the text editor manages character rendering. In this case, text editor is optimized to enhance readability. However, terminal emulators do not apply these optimizations.

For example, consider the character : In the terminal, multiple instances of this character can appear crushed together.
image

However, text editor adjusts the spacing to make each character distinct and easier to read.
image

A workaround is to select a font that renders symbols in a smaller size to accommodate special characters more effectively. I recommend testing through some monospaced fonts here:

Programming Fonts - Bront DejaVu

From the preview, Bront DejaVu seems to handle these characters well.

Of course it does. :eureka:

Obviously, this is it. Other text editors have the same issue, whereas any CLI editor is working well.

I guess we can conclude that this is not an issue with some fixed fonts.