Right-side text limit working erratically while changing the font

2 views (last 30 days)
Let me try to explain a slight problem that I am facing.
In this figure, you can see that I have font “Monospaced” with font size 14. The right-hand text limit is place at 75th column. As you can see from the code, the line terminates at 75th position and then goes to the next line.
Now, if I change the font to say, “Comic Sans”, keeping the same font, the ‘right-hand text’ limiting line moves to a new position. But strangely, the text terminates not at the position where the line is shown, but in the same place where initially the ‘right-hand text limit’ was there.
I checked it for other fonts also, but still the problem persists. Any idea of what is happening?
Using Matlab R2021b.
Thanks in advance.

Accepted Answer

DGM
DGM on 4 Jul 2022
I played around with this in R2019b. Bear in mind that there are two relevant prefs here. The RH text limit is just an indicator line. It doesn't specify where the text gets wrapped. That's actually set under Editor>Language instead. They can be set independently for some reason.
Assuming that they are set to the same width, I wouldn't expect the RH text limit line to be in a useful location if you use a variable-width font. Because the characters are not fixed-width, a line containing 75 characters does not have a fixed length in pixels. Odds are that whatever guess it uses will be wrong.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!