-
Notifications
You must be signed in to change notification settings - Fork 398
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
Implement a FontUsage class, replacing simple font names #2043
Conversation
I'm not sure we want to complicate this by having events and mutability. How about making |
Good point, I'll change it to something simpler as soon as I find the time |
After discussing with @peppy , it seems we want to have the following sort of structure, similar to that of OsuColour:
For this to work |
Sure! But this would mean (with a
to
|
You could make |
Good idea! Maybe I should do the same for That way, it's still easy to change these properties but they're both contained in the new struct so the approach ( |
Something I forgot about in this...
there is a possibility of the text size being reset/ignored if the line with "Font = ..." is executed after the Might just revert this change to completely work around the issue. |
I think it's fine.
renders the width initialiser completely redundant. You might as get rid of every helper property if you're worried. |
While it is true that there are other properties that are somewhat redundant, I think there is a difference here: When you see an initializer like the one you posted, it seems obvious that one of these properties overrides the other (a Size includes a width and a height). In addition, with what smoogi mentioned above (using pre-defined |
Keeping the comment directly above in mind, how should I handle this now? There are a lot (~55) simple |
I think it's fine to update these existing usages, yes. Do note that you will need to make |
Quick note that with the family being null, italics and font weight don't work. This is due to how the fallback font is "selected". I am not sure if it's viable to change the whole texture routine to fix this... especially performance-wise |
# Conflicts: # osu.Framework.Tests/Visual/TestCaseScreen.cs # osu.Framework/Graphics/Sprites/SpriteText.cs # osu.Framework/Testing/Drawables/TestCaseButton.cs
I've adjusted this PR with what I see are required changes to get things working nicely. Of note:
I want to keep the obsolete members in for a month or two or so, just to give people enough time to migrate away from it (it's a pretty intrusive change). I believe this PR is ready now, @peppy requesting review. |
The assumption for font names here is either just the font family name, or
family-[weight]["Italic"]
(both weight and "Italic" being optional).While old methods of setting font attributes will still work, they are now marked as
[Obsoleted]
. You should useFont = new FontUsage(size: 200)
going forward. For convenience, you can adjust existing fonts like so: