-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Make font hinting user-configurable. #78830
base: master
Are you sure you want to change the base?
Conversation
a4455d6
to
8c756a9
Compare
This could do with some temporary migration for the default fonts otherwise noone keeping their config on update will get the changes unless I'm misunderstanding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I like this change, but I have one or two suggestions.
9568aae
to
8c756a9
Compare
8c756a9
to
192d0f0
Compare
I've changed it so that |
* Configure default hinting for Terminus and Roboto to better values. * Document font options in docs/FONT_OPTIONS.md * Fix the slight blurriness of Terminus on ImGui which was caused by not hinting in bitmap mode.
29d0299
to
48d6286
Compare
default: | ||
// This should never be reached. | ||
json.member( "hinting", "Default" ); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This default case need not be rare. The default hinter is great for most fonts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a font is default it should have a std::nullopt hinting so it should get assigned before the switch statement.
if( hinting == "Default" ) { | ||
return std::nullopt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should return zero, not std::nullopt
as if it were uninitialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 isn't a valid ImGuiFreeTypeBuilderFlags value unfortunately, and I don't really want to store a raw integer. Would it be acceptable to modify ImGui to add a default 0 value to ImGuiFreeTypeBuilderFlags?
I expanded the documentation and made some other small tweaks. I sent them to you in CLIDragon#2. |
Sent you another tweak in CLIDragon#3. |
Summary
Interface "Make font-hinting user-configurable"
Purpose of change
Fixes the slight blurriness of Terminus on ImGui windows which was caused by not hinting in bitmap mode.
fixes #73120
Describe the solution
The font is loaded through the same
fontdata.json
file that was always used.I'm not really happy with the clarity of the error messages, but I am not sure how to make them clearer. I don't think it's possible to use
JsonWithPath.throw_error()
because if it occurs before the first typeface is loaded the game will crash before load.Describe alternatives you've considered
None.
Testing
Loaded the game. Checked that error messages were displayed appropriately for incorrect sizes.
Additional context
Current
Previous