This mostly for the GUI developers.
This is about the issue of font spacing in qterminal
What I did(method of trouble shooting):
I got debug working for the qterminal, and then set the default font to
values 8,9,10,11,12,13 (in line 56 of QUnixTerminalImpl.cpp) and watched what the values were of
- _fontWidth (line 171 in TerminalView.cpp)
- fw ( about line 172 in TerminalView.cpp)
- _fontHeight ( line 164 in TerminalView.cpp)
and saw this result
Font size _fontWidth fw _fontHeight
8 7 6 13
9 8 7 15
10 8 8 17
11 9 9 18
12 10 10 19
13 11 10 22
See that _fontWidth anf fw are different for some values.
My conclution:
I think the method used is wrong because:
line 171 of TerminalView is
_fontWidth = qRound((double)fm.width(REPCHAR)/(double)strlen(REPCHAR));
where REPCHAR is "abcdefgh ... xyzABCD...1234 ... +? etc" all the chars available.
With this aproach _fontWidth is an integer which is used as a pixel spacing for each letter on the screen and for the curser position. But this is wrong. What should be done is _fontWidth should be a double and the calculation for the pixel location should be done using doubles until it is absoluty needed to have an integer for the pixel location. This will reduce the error.
I have seen the same problem with my student (doing pixel graphics) many times :-)
It is the thought of converting between engineering space (or math space) and pixel space ( Do it after all calculations are finished.).
Since this is a fairly major change I hope Jacob or Michael can take it from here.
If you need more info just ask.
Douglas Stewart
--
DAS
https://linuxcounter.net/user/206392.html