-
Notifications
You must be signed in to change notification settings - Fork 690
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
font(coretext): add config to adjust strength of font-thicken
.
#4531
Conversation
This is achieved by rendering to an alpha-only context rather than a normal single-channel context, and adjusting the brightness at which coretext thinks it's drawing the glyph, which affects how it applies font smoothing (which is what `font-thicken` enables).
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.
One question/comment. I'm happy to do that work myself later.
/// just the *lightest* thickening available. | ||
/// | ||
/// CoreText only. | ||
thicken_strength: u8 = 255, |
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.
My only thought here is should we use a f32 here instead of a u8. It feels like this would be more user-friendly to configure for a range of "min" to "max". And it also looks like the Apple API is a CGFloat
anyways.
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.
I considered it but it felt like false precision to me-- I'm not particularly bothered about it either way though so I'm fine with changing it to a float if you want.
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.
I can see the argument, but the argument types match and the difference between subtle changes should not be noticeable enough.
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.
I take it back, this causes hashing issues and I don't want to deal with it lol.
This is achieved by rendering to an alpha-only context rather than a normal single-channel context, and adjusting the brightness at which CoreText thinks it's drawing the glyph, which affects how it applies font smoothing (which is what
font-thicken
enables).