mlterm
mlterm copied to clipboard
Proportional font width is set to widest character, not median width
When using a proportional font, like Times New Roman, the character cell size is set to the maximum width for that font - generally the letter "W". It would be more useful to use the median width for some representative text, or alternatively (or addionally) to allow a percentage of the maximum width to be specified. As it is, unless you are going to use a screen full of the letter "W", there is a lot of unused real-estate on the right hand side when using proportional fonts.
The screenshot shows 80 of the same character:
xterm suffers from the same problem.
Please try to configure ~/.mlterm/aafont as follows. DEFAULT=[FONT NAME]:100
- [FONT NAME] -> Specify a proportional font you want to use.
- :100 -> Percentage. If it is greater than 100, the font width gets bigger.
The problem is not the character cell size, but the window size, which is around 50% larger than it needs to be for the kind of text I have on the terminal. Squashing up the individual character cell just makes things look ugly.
Sorry for late reply. Does screen_width_ratio option help you?
I think the problem here is a derde selecting a proportional font in a terminal.
The only reason I consider using mlterm is that it makes something of an honest attempt to use proportional fonts.
The problem is not the character cell size, but the window size, which is around 50% larger than it needs to be for the kind of text I have on the terminal. Squashing up the individual character cell just makes things look ugly.
As @arakiken said, a screen_width_ratio
< 100 should mimimize the issue.
There is no perfect solution here:
- if set too high, space will be lost on lines with many narrow characters as you noticed
- if set too low, lines with many wide characters will display truncated
You will have to find out the best compromise for your particular font I guess. Using the configuration GUI makes that easy: go to the Font
tab, change the value at Screen size ratio against font size:
, press the Apply
button to try it out, and repeat until satisfied.
What maybe would be helpful is a way to increase and decrease the ratio quickly using the keyboard, a la https://github.com/arakiken/mlterm/issues/38#issuecomment-1030631600.
Note that somehow with 100 the font width is not set to the width of the widest character: with the Input
font (which I wholeheartedly recommend for programming), a full line of m
characters is already too wide, which is quite fine anyway, as it will rarely if ever happen in a programming context.
I hope mlterm
does not assume that W
is always the widest character, so maybe some proportional fonts "lie" about which one is? Or is there indeed some median width value that some fonts do not set properly?
I doubt a "representative text" can be found as initially suggested which would fit prose, programming in different languages, and the many other uses I cannot think of.
When using a proportional font, like Times New Roman, the character cell size is set to the maximum width for that font - generally the letter "W". [...] xterm suffers from the same problem.
To my knowledge xterm is much worse and use the same character cell width for all characters even for a proportional font.
xterm's forcePackedFont
seems to allow choosing between the minimum and maximum width, but that width still does not vary between narrow and wide characters.
At least I could not get xterm to display anything not ugly with proportional fonts, just like many other terminal emulators that only forgot to forbid them.
I would be very glad to be proven wrong, as far as I know mlterm is the only general-purpose terminal emulator which displays proportional fonts correctly (GNU Emacs's internal one supposedly works fine too).
Hmmm ... The core of the problem is the definition of the Terminal width in terms of characters and then count instead of pixels until the width is reached the actual characters. Text editors do it this way: column edge marker of 80 characters is reached with 80 spaces or with less W's and more of dots. If you support proportional fonts you shouldn't use a terminal way of thinking about its width ,,, Just leave the idea of characters and specify it in pixels ... as any other app which handle proportional fonts do. Any workaround like scaling factor won't work properly anyway, especially for tables formed using Tabs as you need to place the Tabs by pixels and at positions of space character columns, else they don't appear one under the other like it is currently the case.