0

I am trying to understand how terminals work. I am looking at the implementation of Netbeans Terminal plugin. I realize it may not be the ideal candidate but my CPP skills are quite limited. So I figured I'd begin with something I know.

Netbeans Terminal seems assume that a character is one block wide, or atleast that a characters width is in multiples of a block width. (A block here is a just a rectangle with a fixed width & height). If I am not completely wrong Gnome Terminal & Konsole work on similar lines. Needless to say this screws with some fonts, specifically Indic fonts, the fonts of my interest. While, the reason Netbeans was implemented this way could be implementation specific, the real question I am after is why are Terminals implemented in this way in general.

I don't know where to begin, so any reading resources you could suggest would help me a great deal. I did read through TTY demystified, but that doesn't delve in character rendering details.

9
  • 2
    The most basic reason is for alignment purposes. Many terminal clients allow variable width fonts but that results in alignment problems with many commands (producing tables). Jan 31, 2017 at 5:44
  • 1
    Limited graphics hardware of yesterdecade seems like the obvious answer. Jan 31, 2017 at 5:49
  • TY, those two appear to be a secondary reasons. If they were primary reasons, wouldn't Gnome & KDE have developed much more advanced terminals using GTK or QT with full support for Unicode like office tools or Dolphin ? Don't get me wrong both Terminal & Konsole support Unicode, they just don't render them properly enough to be readable. Jan 31, 2017 at 6:04
  • @ShaggyInjun Programs expect fixed width columns, for the reason Julie Pelletier mentioned above. Jan 31, 2017 at 7:57
  • Historical compatibility is what we were hinting at. Jan 31, 2017 at 7:58

1 Answer 1

4

Netbeans Terminal plugin is not a terminal, it is a terminal emulator, and it emulates how a terminal works, and looks. Terminals are character-based, not graphical, so they use fixed width characters, not rendered fonts. Some terminal emulators do have the ability to allow you to use variable width fonts, usually only a select set of what the system actually has, however. For the Indic fonts, that can be a problem, and some emulator may allow their use, but I don't know which, if any. Typically the terminal emulator is used for computer control and programming work, these days, and for that the fixed width works best anyway, so there's very little motivation to change things.

You may have noticed that most text editors also use monospaced fonts as well. Yes, they can often be configured to use variable spaced fonts, but not the default. Word processors, OTOH, default to rendered fonts, because that's usually what the user wants to print with anyway. The GUI of your OS uses the nice ones too, because that's easier to read for people. Even your browser is probably showing rendered fonts. But anything that's marked as code is still turned into monospaced font.

Because programming is so much easier to do when you see fixed-width characters that clearly line up, and people have gotten used to that, environments where coding is usually done will default to monospaced fonts as well. For example, if you have any developer type extensions in your browser, they likely show all their content in monospaced fonts. If you right-click on this page and select "View Source" the browser will open a page/window/tab with the source in monospaced font.

As an extra note, even today most real terminals still cannot display anything but a single font, monospaced of course, and often not even able to adjust the size of that.

3
  • You'll have to pardon me for not awarding you the points. I have a disagreement with the way people get treated in this paradise of coercion. Feb 1, 2017 at 2:11
  • @ShaggyInjun. That's totally your call. I'm here to get help when I need it and give help when I can. Points won't make my life better or my bills smaller. Just happy to help.
    – Chindraba
    Feb 1, 2017 at 2:38
  • 1
    Namaste, my brother-self.
    – Chindraba
    Feb 1, 2017 at 4:12

Not the answer you're looking for? Browse other questions tagged .