X Tutup
Skip to content

Fix vertical alignment of Inspector category titles#110303

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
Crab-Cafe:master
Sep 17, 2025
Merged

Fix vertical alignment of Inspector category titles#110303
Repiteo merged 1 commit intogodotengine:masterfrom
Crab-Cafe:master

Conversation

@Unbansheee
Copy link
Contributor

@Unbansheee Unbansheee commented Sep 7, 2025

Fixes #110302

Before:
Godot_v4 5-beta7_mono_win64_pCvQXk6NKg

After:
godot windows editor x86_64_HFoWMlcpEI

@Unbansheee Unbansheee requested a review from a team September 7, 2025 10:37
@Unbansheee
Copy link
Contributor Author

Further investigation shows that this may be a platform specific issue. This doesn't seem to be a problem on other platforms, and while this PR fixes it on Windows, it causes a regression for other platforms.
Will investigate further tomorrow

Comment on lines 1681 to 1684
float font_height = font->get_height(font_size);
float text_pos_y = get_size().height - (font_height / 2) + v_margin_offset;
Point2 text_pos = Point2(ofs, text_pos_y).round();
draw_string(font, text_pos, label, HORIZONTAL_ALIGNMENT_LEFT, w, font_size, theme_cache.font_color);
Copy link
Member

@bruvzg bruvzg Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref<TextLine> tl;
tl.instantiate();
tl->add_string(label, font, font_size);
tl->set_width(w);
tl->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT);
float text_pos_y = (get_size().height - tl->get_size().height) / 2 + v_margin_offset;
Point2 text_pos = Point2(ofs, text_pos_y).round();
tl->draw(get_canvas_item(), text_pos, theme_cache.font_color);

Using real text metrics should always work, regardless of fonts and system font fallbacks in use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this works, at least on my end. Will need someone else to validate. I have integrated this into the PR

@AThousandShips AThousandShips added this to the 4.6 milestone Sep 8, 2025
Unbansheee added a commit to Crab-Cafe/godot that referenced this pull request Sep 9, 2025
# Conflicts:
#	editor/inspector/editor_inspector.cpp
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally on Linux, it works as expected.

Default settings at various editor scales

75% 100% 125%
image image image
150% 175% 200%
image image image

Custom settings

Inter, no hinting Adwaita Mono, full hinting Comic Neue, no hinting, size 17
image image image

@Calinou
Copy link
Member

Calinou commented Sep 10, 2025

Remember to squash commits into a single commit so this can be merged.

@Calinou Calinou added the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Sep 10, 2025
@fstxz
Copy link
Contributor

fstxz commented Sep 12, 2025

I tested this again, works as expected now.

@Repiteo Repiteo merged commit adb2ec0 into godotengine:master Sep 17, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Sep 17, 2025

Thanks! Congratulations on your first merged contribution! 🎉

ProfessorOctopus pushed a commit to ProfessorOctopus/godot that referenced this pull request Sep 17, 2025
Fix vertical alignment of Inspector category titles
@akien-mga akien-mga removed the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inspector Category text is not vertically centered

9 participants

X Tutup