Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Editor line spacing too large even at zero #76385

Open
amonroejj opened this issue Apr 23, 2023 · 9 comments · May be fixed by #76596
Open

Code Editor line spacing too large even at zero #76385

amonroejj opened this issue Apr 23, 2023 · 9 comments · May be fixed by #76596

Comments

@amonroejj
Copy link

Godot version

4.0.2.stable

System information

Windows 10, NVIDIA GeForce GTX 1060 516.94

Issue description

Godot 3.x: line spacing 2 (can get even tighter at 1 or 0!)
image

Godot 4.x: line spacing 0 (not dense enough, and cannot get any tighter!)
image

Steps to reproduce

image

Minimal reproduction project

N/A

@Chaosus
Copy link
Member

Chaosus commented Apr 24, 2023

It may be depended on fonts used by the editor. In 3.x default font was Hack, in 4.x (as far as I remember) it used Jetbrains Mono.

@Chaosus Chaosus added this to the 4.1 milestone Apr 24, 2023
@Rindbee
Copy link
Contributor

Rindbee commented Apr 24, 2023

It may also be due to #74528 that the value change did not take effect.

@Calinou
Copy link
Member

Calinou commented Apr 24, 2023

It may be depended on fonts used by the editor. In 3.x default font was Hack, in 4.x (as far as I remember) it used Jetbrains Mono.

@amonroejj is using a custom font in the screenshots, although they didn't specify which font it is (nor the font size used). The editor is at 75% scale though.

@amonroejj
Copy link
Author

amonroejj commented Apr 24, 2023

Font is ProFontWindows.ttf from https://tobiasjung.name/profont/ . Code font size is 12. interface/editor/display_scale is 100%. interface/editor/main_font_size is 12.

Screenshots were taken on the same machine at the same time.

@Calinou
Copy link
Member

Calinou commented Apr 25, 2023

@amonroejj Did you try restarting the editor after changing the setting?

I guess the way line spacing is calculated has changed in 4.0 due to the TextServer refactoring. We could allow setting the line spacing editor setting as low as -4 to resolve this.

cc @bruvzg

@amonroejj
Copy link
Author

@Calinou Yes, the increased line spacing persists over relaunch & reboot.

@amonroejj
Copy link
Author

amonroejj commented Apr 30, 2023

One offshoot of this is that the hotspot of the I-beam mouse cursor seems not to be centered vertically, so mouse click doesn't put the cursor where expected.

image

With the mouse pointer in this position, the expectation would be to put the cursor in the fourth line of visible text, but as seen in the screenshot, the actual result is that the cursor goes to the third line of visible text.

@Rindbee
Copy link
Contributor

Rindbee commented May 8, 2023

One offshoot of this is that the hotspot of the I-beam mouse cursor seems not to be centered vertically, so mouse click doesn't put the cursor where expected.

With the mouse pointer in this position, the expectation would be to put the cursor in the fourth line of visible text, but as seen in the screenshot, the actual result is that the cursor goes to the third line of visible text.

Seems to be a bug in TextEdit. The mouse click to select the line is not only related to get_line_height(), but also related to the height of caret (or font_size).

0

@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 23, 2023
@YuriSizov YuriSizov modified the milestones: 4.2, 4.x Nov 14, 2023
@amonroejj
Copy link
Author

Something I just noticed regarding line spacing is that that the Output pane (green highlight) perfectly copes with tight line spacing while the code editor (yellow highlight) does not:

image

I'm not familiar enough with the internals of the editor to know whether different classes are used between these two controls in the GUI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants