fix: nk_font_config oversampling 3x horizontaly by default#973
Open
sleeptightAnsiC wants to merge 2 commits into
Open
fix: nk_font_config oversampling 3x horizontaly by default#973sleeptightAnsiC wants to merge 2 commits into
sleeptightAnsiC wants to merge 2 commits into
Conversation
d33b79a to
bcc8da8
Compare
sleeptightAnsiC
commented
Jul 1, 2026
Comment on lines
+1185
to
+1186
| config = nk_font_config(0); | ||
| config.oversample_h = 3; |
Contributor
Author
There was a problem hiding this comment.
I felt tempted to remove it even from here, but after testing a bit, it appears that some rawfb demos indeed look worse without it. Again, that probably just happens to work and there is most likely a better way to achieve it, but I don't want to cause any unnecessary breakage.
sleeptightAnsiC
commented
Jul 2, 2026
Comment on lines
+1176
to
+1182
| /* FIXME(sleeptightAnsiC): This "fallback" exists for compatibility | ||
| * with code that creates empty atlas and immediately bakes it. | ||
| * Several demos do this, but it doesn't make sense for API to allow it. | ||
| * It was never documented anywhere and it's more of a hack than feature. | ||
| * App/backend should call nk_font_atlas_add_default() on it's own | ||
| * with whatever config it wants, and treat it like any other font. | ||
| * Worth to consider this for removal during next major release... */ |
Contributor
Author
There was a problem hiding this comment.
FIXME comment is pretty much unrelated to PR, but since I already invested some time into understanding this code, I thought I would simply put it here. I can split it into another commit, if it's a big deal. EDIT: I just moved this to another commit.
See linked issue for additional information. According to the commit that introduced this, it was supposed to: _"oversample the default font to make it look better_" but it was oversampling every single font, potentially making it blurry. This fix preserves old behavior for code that may still expect it, but nk_font_config will now use oversample_h=1 by default. Some demos achieve sharp font by scaling their pixel_size and in this case there won't be any difference, but if someone used badly behaving font and didn't notice it only worked because of oversampling, that font may now appear differently (this is unlikely but still possible). Fixes: Immediate-Mode-UI#855 Refs: Immediate-Mode-UI@1d7f024
split into another commit in case the previous one will need to be reverted
bcc8da8 to
e7a8bef
Compare
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.
See linked issue for additional information.
According to the commit that introduced this, it was supposed to: "oversample the default font to make it look better" but it was oversampling every single font, potentially making it blurry. This fix preserves old behavior for code that may still expect it, but nk_font_config will now use oversample_h=1 by default. Some demos achieve sharp font by scaling their pixel_size and in this case there won't be any difference, but if someone used badly behaving font and didn't notice it only worked because of oversampling, that font may now appear differently (this is unlikely but still possible).
Fixes: #855
Refs: 1d7f024
DO NOT SQUASH