-
-
Notifications
You must be signed in to change notification settings - Fork 845
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
text: Allow specifying multiple device fonts for text fields #19274
Conversation
3bb449a
to
ec5b2f7
Compare
f8daf5e
to
1645906
Compare
1645906
to
c4c3aec
Compare
.first() | ||
{ | ||
// Specifying multiple font names is supported only for device fonts. | ||
let font_names: Vec<&str> = font_name.split(",").collect(); |
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.
Would this work if you iterated on the split without collecting into a Vec?
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 could do that, sure, but then I'm using the vec to get the fallback font name and IMO it's clearer when I do font_names.first()
compared to not collecting into a vec and doing something else.
That matches the behavior of Flash Player and Ruffle Desktop.
When device fonts are used, you can specify a list of font names for a text field, in which case the first one available will be used. No glyph fallback mechanism between fonts on the list is applied. This is true for both CSS and pure TextFormats.
This test verifies the behavior of styling with a list of fonts.
When device fonts are used, you can specify a list of font names for a text field, in which case the first one available will be used. No glyph fallback mechanism between fonts on the list is applied.
This is true for both CSS and pure
TextFormat
s.Additionally some refactors are included.