Enhanced TextEdit Spacing Control #7638
CatMeowByte
started this conversation in
GUI
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I initially aimed for pixel-perfect text rendering in Godot until I encountered an issue with the TextEdit (and its children) control and its handling of spacing.
Consider the following image:

This represents the default, unaltered setup of the CodeEdit node, displaying my 8x4 font with full block Unicode characters (█). My expectation was for the characters to occupy the entire character space without any additional spacing. However, it's noticeable that Godot defaults to providing spacing on the top and right sides (excluding the line), including a space on the right within the line highlight. This spacing is in contrast to the minimap, which touches the border of the layout.
The caret height matches the font height, but the line highlight reveals a 2-pixel vertical padding on each line.
Eliminating the spacing as demonstrated below:

Successfully removes the vertical padding for each line, resulting in characters that seamlessly touch each other. However, this adjustment has the unintended effect of reducing the caret's height by 2 pixels, making it smaller than the characters themselves. Moreover, the outer spacing on the left of the line highlight, and on the top and right of the entire TextEdit, remains unaltered and seemingly non-editable.
My objective is to achieve a result resembling this:

This entails eliminating any border spacing, vertical line spacing, and ensuring that the caret maintains its full height. I aim for the lines to touch the sides just like the minimap. I acknowledge that most fonts are not designed with vertical spacing, hence my suggestion to retain a non-zero default value for balanced viewing, allowing users to modify the spacing as desired.
Beta Was this translation helpful? Give feedback.
All reactions