Fix: font style setting follows the font intrinsic style - #830
Open
nborodikhin wants to merge 1 commit into
Open
Fix: font style setting follows the font intrinsic style#830nborodikhin wants to merge 1 commit into
nborodikhin wants to merge 1 commit into
Conversation
nborodikhin
marked this pull request as ready for review
September 6, 2026 19:45
1 task
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.
Description
The issue:
TTF font bears a property what style it is - regular, bold, italic, bold italic. NextUI has a setting to choose the font style (Normal/Bold) which is applied to the system font.
The issue is that due to the the SDL_ttf implementation, there are several possibilities, two if which are wrong. Check the following table which demonstrates the issue on Rounded Mplus 1c font (default NextUI font):
font drawn Regular
Correct
font drawn Bold (synthetic)
Inconsistent stroke width, digit metrics
font drawn Bold
Incorrect - normal expected
font drawn Bold
Correct
From the table it is clear that:
Matching font style setting to the font is important even when system font is bold - third-party apps may use their own fonts but rely on the font style to match NextUI's look-and-fell.
#749 which added the font style setting made it sticky. As a result, when user selected a font with a different font face weight, they get either a non-optimal "synthetic bold" look or a wrong bold look on a normal setting.
This change implements a better approach: on font selection, font style resets to match the selected font face. This way on a font change it always produces the correct combination.
Brief history of the default NextUI font
There was no option to control the style of the font, it was dictated by the font file (same as Normal today).
Change
GFX_getSystemFontFaceStyle()to detect the intrinsic font style before NextUI applies the configured styleCFG_setFontStyle()to Normal or Bold from the SDL_ttf Bold bitTesting