It would be nice if we had the ability to choose the line height of the editor so that text becomes more readable in some fonts. So I come up with a set of changes that add a new option in the configurations UI to let the user specify a line height multiplier. In the renderer, when setting m_fontHeight, I also multiply it by the chosen value. I am happy with the results (see screenshots). There's a problem, though: selection gets inconsistent. I know that we let Qt draw the selected text background by passing a list of FormatRanges to it specifying decorations for the selected text. For selected parts that are not text (e.g, when there's whole lines selected), we draw the selection background by ourselves. Qt's text rendering doesn't know of the new height so it doesn't render the selected background in whe whole height, but katepart does so it renders the selection background in the whole height. I've come up with some ideas: Make Qt's text rendering aware of the new height (I don't think this is going to happen as I searched a lot but couldn't find how to do it) or draw the text background ourselves, but this involves calculations like the selected range, where the characters are, etc, that I don't feel versed enough in kate's code to do that. So my solution was, when rendering the selected background, use the original font height instead of the multiplied one. It doesn't look very pretty but at least is consistent. It would be nice if someone helped me fixed the selection in these cases, but, I am happy enough with the results to use it in my day-to-day life. Reproducible: Always Steps to Reproduce: Open Kate Go to Settings->Configure Kate->Editing Actual Results: No option to change the line height Expected Results: Option to configure the line height or the line height multiplier Please see patches/screenshots
Created attachment 84107 [details] Patch that adds a multiplier to line height
Created attachment 84108 [details] Text without a line height multiplier
Created attachment 84109 [details] Text with 1,1 line height multiplier
Created attachment 84110 [details] Comparison of 1.0, 1.1 and 1.2 multipliers
Created attachment 84111 [details] Settings window
Created attachment 84112 [details] Ugly text selection.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/338
Git commit 795a8d568057552b4350f2f73a11443125399ca0 by Christoph Cullmann, on behalf of Waqar Ahmed. Committed on 22/03/2022 at 18:16. Pushed by waqar into branch 'master'. Add support for custom line height M +3 -0 src/dialogs/katedialogs.cpp M +35 -9 src/dialogs/textareaappearanceconfigwidget.ui M +55 -1 src/render/katerenderer.cpp M +4 -0 src/render/katerenderer.h M +12 -0 src/utils/kateconfig.cpp M +9 -0 src/utils/kateconfig.h M +8 -6 src/view/kateview.cpp https://invent.kde.org/frameworks/ktexteditor/commit/795a8d568057552b4350f2f73a11443125399ca0