Scale font line and tab advance by the font scale factor - #7760
Open
Goober5000 wants to merge 1 commit into
Open
Scale font line and tab advance by the font scale factor#7760Goober5000 wants to merge 1 commit into
Goober5000 wants to merge 1 commit into
Conversation
Goober5000
force-pushed
the
fix/fred_label_line_spacing
branch
2 times, most recently
from
September 3, 2026 05:40
d6b7928 to
f855a88
Compare
Multi-line and tabbed strings drawn with a scaleMultiplier != 1 overlapped or misaligned because the font code advanced newlines and tabs by the unscaled font height/tab width -- most visible in FRED's viewport labels now that they honor an adjustable font scale. Scale the newline and tab advance in both the rendering and measurement paths of each backend: the NVG path (gr_string and NVGFont::getStringSize) and the VFNT path (gr_string_old and VFNTFont::getStringSize), which also gains tab handling. The tab width is hoisted onto the shared FSFont base so both backends share it. While here, pass the FSFont wrapper to gr_string_old instead of a bag of scalars, make its font pointer const, and consolidate the get_char_width_old externs into a single declaration in font_internal.h. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Goober5000
force-pushed
the
fix/fred_label_line_spacing
branch
from
September 3, 2026 05:55
f855a88 to
f3817c8
Compare
wookieejedi
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multi-line and tabbed strings drawn with a scaleMultiplier != 1 overlapped or misaligned because the font code advanced newlines and tabs by the unscaled font height/tab width -- most visible in FRED's viewport labels now that they honor an adjustable font scale.
Scale the newline and tab advance in both the rendering and measurement paths of each backend: the NVG path (gr_string and NVGFont::getStringSize) and the VFNT path (gr_string_old and VFNTFont::getStringSize), which also gains tab handling. The tab width is hoisted onto the shared FSFont base so both backends share it.
While here, pass the FSFont wrapper to gr_string_old instead of a bag of scalars, make its font pointer const, and consolidate the get_char_width_old externs into a single declaration in font_internal.h.
Fixes an engine bug that #7745 uncovered. Tested in FRED and QtFRED with both VFNT and NVG fonts at different scaling settings.