edbee-lib
edbee-lib copied to clipboard
Font size forced to 10 in margin causes display problems
The editor is forcing the line numbers to be drawn at 10 point in whatever font the editor is using, causing abnormalities when you use other font sizes.
Here's what the issue looks like using Consolas 7pt:
And here's a different consequence of the forced font size with Consolas 20pt:
Seems like the line numbers should be whatever font size the editor is using. Doing this would also eliminate the need for the blank space offset above the line number in each line.
The code related to forcing the font size can be found at lines 139 and 141 of: https://github.com/edbee/edbee-lib/blob/bc402fa67dd124290bf1e0c7e067b915a1ec927f/edbee-lib/edbee/views/components/textmargincomponent.cpp
It might be stupid to suggest this but will setting the same font size for the line numbers as for the main text always be appropriate? I guess that the editor text content could contain letters/glyphs with ascending and descending features but normal (in the West) numbers do not so I suppose that should be a safe choice...
I agree! I Will change it so it uses the font-size from the selected theme.
I can't really say I like the rendering when I use the same font-size as the editor itself:
I'm considering scaling down the font-size with a factor will improve the situation (for example 80%)
Sublime uses the same font-size but greys out the line number so it doesn't jump out as much - that seems to work well.
I'm working on it. Currently having an issue that the font/theme isn't known at the moment the margin-component is constructed.
I think graying out the margin color of the number on the sidebar is good options. (Guess I will implement that with opacity so it works for all colors)
Yeah, this can be theme-neutral, but I'd recommend taking the luminosity taking into account - from our experience you want to use 2 colours, one for a light background and one for a dark background. We use the formula from W3 for this, here's a Lua implementation.
That is to say if the opacity trick works, then that'll be just fine - we don't have that option.
It seems while the highlighting area takes effect on a font size change right away, re-rendering the line numbers with the new font size only happens when you visually bring up edbee again. It's noticeable when you go from 20pt to 7pt.
How doe you set the font-size? Currently the margin only updates the font size if the config is changed.. (And the config emits a signal TextEditorConfig::configChanged)