diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs
index b3d6777670..5874bac7f6 100644
--- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs
+++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs
@@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
-using osu.Game.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
@@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.UI
private void load()
{
if (JudgementText != null)
- JudgementText.Font = OsuFont.GetFont(JudgementText.Font, size: 25);
+ JudgementText.Font = JudgementText.Font.With(size: 25);
}
protected override void LoadComplete()
diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs
index bdfcf051d4..72b5f69eee 100644
--- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs
+++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs
@@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps.Drawables
public float TextSize
{
get => statusText.Font.Size;
- set => statusText.Font = OsuFont.GetFont(statusText.Font, size: value);
+ set => statusText.Font = statusText.Font.With(size: value);
}
public MarginPadding TextPadding
diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs
index c3db33f8d4..54c6ca48a0 100644
--- a/osu.Game/Graphics/OsuFont.cs
+++ b/osu.Game/Graphics/OsuFont.cs
@@ -11,18 +11,10 @@ namespace osu.Game.Graphics
public static FontUsage Default => GetFont();
- public static FontUsage GetFont(FontUsage usage, Typeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null)
- {
- string familyString = typeface != null ? getFamilyString(typeface.Value) : usage.Family;
- string weightString = weight != null ? getWeightString(familyString, weight.Value) : usage.Weight;
-
- return new FontUsage(usage, familyString, size, weightString, italics, fixedWidth);
- }
-
public static FontUsage GetFont(Typeface typeface = Typeface.Exo, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false)
- => new FontUsage(getFamilyString(typeface), size, getWeightString(typeface, weight), italics, fixedWidth);
+ => new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), italics, fixedWidth);
- private static string getFamilyString(Typeface typeface)
+ public static string GetFamilyString(Typeface typeface)
{
switch (typeface)
{
@@ -37,10 +29,10 @@ namespace osu.Game.Graphics
return null;
}
- private static string getWeightString(Typeface typeface, FontWeight weight)
- => getWeightString(getFamilyString(typeface), weight);
+ public static string GetWeightString(Typeface typeface, FontWeight weight)
+ => GetWeightString(GetFamilyString(typeface), weight);
- private static string getWeightString(string family, FontWeight weight)
+ public static string GetWeightString(string family, FontWeight weight)
{
string weightString = weight.ToString();
@@ -52,6 +44,17 @@ namespace osu.Game.Graphics
}
}
+ public static class OsuFontExtensions
+ {
+ public static FontUsage With(this FontUsage usage, Typeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null)
+ {
+ string familyString = typeface != null ? OsuFont.GetFamilyString(typeface.Value) : usage.Family;
+ string weightString = weight != null ? OsuFont.GetWeightString(familyString, weight.Value) : usage.Weight;
+
+ return usage.With(familyString, size, weightString, italics, fixedWidth);
+ }
+ }
+
public enum Typeface
{
Exo,
diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
index b7a4254642..b25976ea6a 100644
--- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
+++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
@@ -82,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface
public BreadcrumbTabItem(T value) : base(value)
{
- Text.Font = OsuFont.GetFont(Text.Font, size: 18);
+ Text.Font = Text.Font.With(size: 18);
Text.Margin = new MarginPadding { Vertical = 8 };
Padding = new MarginPadding { Right = padding + item_chevron_size };
Add(Chevron = new SpriteIcon
diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs
index 665c3b9146..ddfbccb0a2 100644
--- a/osu.Game/Graphics/UserInterface/DialogButton.cs
+++ b/osu.Game/Graphics/UserInterface/DialogButton.cs
@@ -199,7 +199,7 @@ namespace osu.Game.Graphics.UserInterface
public float TextSize
{
get => spriteText.Font.Size;
- set => spriteText.Font = OsuFont.GetFont(spriteText.Font, size: value);
+ set => spriteText.Font = spriteText.Font.With(size: value);
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos);
diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs
index a0e956b2e5..042b55073f 100644
--- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs
+++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs
@@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds()
};
- Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Medium), true);
+ Active.BindValueChanged(val => Text.Font = Text.Font.With(weight: val ? FontWeight.Bold : FontWeight.Medium), true);
}
protected override void OnActivated() => fadeActive();
diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs
index 816d735c16..40365bd57c 100644
--- a/osu.Game/Graphics/UserInterface/PageTabControl.cs
+++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs
@@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds()
};
- Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Medium), true);
+ Active.BindValueChanged(val => Text.Font = Text.Font.With(weight: val ? FontWeight.Bold : FontWeight.Medium), true);
}
[BackgroundDependencyLoader]
diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs
index 8c2849bd7b..8ea5525ac7 100644
--- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs
+++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs
@@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface
public PercentageCounter()
{
- DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true);
+ DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(fixedWidth: true);
Current.Value = DisplayedCount = 1.0f;
}
diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs
index f0730a7dc2..eef7d3b77a 100644
--- a/osu.Game/Graphics/UserInterface/RollingCounter.cs
+++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs
@@ -65,7 +65,7 @@ namespace osu.Game.Graphics.UserInterface
public float TextSize
{
get => DisplayedCountSpriteText.Font.Size;
- set => DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: value);
+ set => DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(size: value);
}
public Color4 AccentColour
diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs
index 0c1cb570ea..3cc9167d5b 100644
--- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs
+++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs
@@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface
/// How many leading zeroes the counter will have.
public ScoreCounter(uint leading = 0)
{
- DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true);
+ DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(fixedWidth: true);
LeadingZeroes = leading;
}
diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs
index fb362fbd0c..73c01dfde7 100644
--- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs
+++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs
@@ -294,7 +294,7 @@ namespace osu.Game.Online.Leaderboards
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Font = OsuFont.GetFont(font, fixedWidth: true),
+ Font = font.With(fixedWidth: true),
Text = text,
Colour = glowColour,
Shadow = false,
@@ -305,7 +305,7 @@ namespace osu.Game.Online.Leaderboards
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Font = OsuFont.GetFont(font, fixedWidth: true),
+ Font = font.With(fixedWidth: true),
Text = text,
Colour = textColour,
Shadow = false,
diff --git a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs b/osu.Game/Online/Leaderboards/MessagePlaceholder.cs
index 86d59d2809..d4256e4a9d 100644
--- a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs
+++ b/osu.Game/Online/Leaderboards/MessagePlaceholder.cs
@@ -14,7 +14,7 @@ namespace osu.Game.Online.Leaderboards
{
AddIcon(FontAwesome.fa_exclamation_circle, cp =>
{
- cp.Font = OsuFont.GetFont(cp.Font, size: TEXT_SIZE);
+ cp.Font = cp.Font.With(size: TEXT_SIZE);
cp.Padding = new MarginPadding { Right = 10 };
});
diff --git a/osu.Game/Online/Leaderboards/Placeholder.cs b/osu.Game/Online/Leaderboards/Placeholder.cs
index 675e224bee..d38110a9d0 100644
--- a/osu.Game/Online/Leaderboards/Placeholder.cs
+++ b/osu.Game/Online/Leaderboards/Placeholder.cs
@@ -3,7 +3,6 @@
using System;
using osu.Framework.Graphics;
-using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Online.Leaderboards
@@ -13,7 +12,7 @@ namespace osu.Game.Online.Leaderboards
protected const float TEXT_SIZE = 22;
protected Placeholder()
- : base(cp => cp.Font = OsuFont.GetFont(cp.Font, size: TEXT_SIZE))
+ : base(cp => cp.Font = cp.Font.With(size: TEXT_SIZE))
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
diff --git a/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs b/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs
index 11c256130f..87ff4dd398 100644
--- a/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs
+++ b/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using osu.Framework.Graphics;
-using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osuTK.Graphics;
@@ -14,7 +13,7 @@ namespace osu.Game.Overlays.AccountCreation
private readonly List errorDrawables = new List();
public ErrorTextFlowContainer()
- : base(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12))
+ : base(cp => cp.Font = cp.Font.With(size: 12))
{
}
diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs
index 2400403ec8..86c972c303 100644
--- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs
+++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs
@@ -129,7 +129,7 @@ namespace osu.Game.Overlays.AccountCreation
usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!");
emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever.");
- emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = OsuFont.GetFont(cp.Font, weight: FontWeight.Bold));
+ emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(weight: FontWeight.Bold));
passwordDescription.AddText("At least ");
characterCheckText = passwordDescription.AddText("8 characters long");
diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs
index d1336f0a0e..4e2cc1ea00 100644
--- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs
+++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs
@@ -89,7 +89,7 @@ namespace osu.Game.Overlays.AccountCreation
Font = OsuFont.GetFont(size: 28, weight: FontWeight.Light),
Text = "Warning! 注意!",
},
- multiAccountExplanationText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12))
+ multiAccountExplanationText = new OsuTextFlowContainer(cp => cp.Font = cp.Font.With(size: 12))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
@@ -105,7 +105,7 @@ namespace osu.Game.Overlays.AccountCreation
Text = "I understand. This account isn't for me.",
Action = () => this.Push(new ScreenEntry())
},
- furtherAssistance = new LinkFlowContainer(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12))
+ furtherAssistance = new LinkFlowContainer(cp => cp.Font = cp.Font.With(size: 12))
{
Margin = new MarginPadding { Top = 20 },
Anchor = Anchor.TopCentre,
diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs
index 1038609693..8a75cfea50 100644
--- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs
+++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs
@@ -122,7 +122,7 @@ namespace osu.Game.Overlays.BeatmapSet
new OsuSpriteText
{
Text = second,
- Font = OsuFont.GetFont(secondFont, size: 13)
+ Font = secondFont.With(size: 13)
},
};
}
diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs
index afff1f3270..b6793d2609 100644
--- a/osu.Game/Overlays/BeatmapSet/Info.cs
+++ b/osu.Game/Overlays/BeatmapSet/Info.cs
@@ -156,7 +156,7 @@ namespace osu.Game.Overlays.BeatmapSet
this.FadeIn(transition_duration);
textFlow.Clear();
- textFlow.AddText(value, s => s.Font = OsuFont.GetFont(s.Font, size: 14));
+ textFlow.AddText(value, s => s.Font = s.Font.With(size: 14));
}
}
diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs
index e88a3f3dfc..7933bfd9b6 100644
--- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs
+++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs
@@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
public float TextSize
{
get => text.Font.Size;
- set => text.Font = OsuFont.GetFont(text.Font, size: value);
+ set => text.Font = text.Font.With(size: value);
}
public ClickableUsername()
diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs
index 77934d6730..a679f33e3a 100644
--- a/osu.Game/Overlays/Chat/ChatLine.cs
+++ b/osu.Game/Overlays/Chat/ChatLine.cs
@@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Chat
t.Colour = OsuColour.FromHex(message.Sender.Colour);
}
- t.Font = OsuFont.GetFont(t.Font, size: TextSize);
+ t.Font = t.Font.With(size: TextSize);
})
{
AutoSizeAxes = Axes.Y,
diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs
index 158e191433..6ac6133fd0 100644
--- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs
+++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs
@@ -20,8 +20,8 @@ namespace osu.Game.Overlays.Chat.Tabs
Icon.Alpha = 0;
- Text.Font = OsuFont.GetFont(Text.Font, size: 45);
- TextBold.Font = OsuFont.GetFont(Text.Font, size: 45);
+ Text.Font = Text.Font.With(size: 45);
+ TextBold.Font = Text.Font.With(size: 45);
}
[BackgroundDependencyLoader]
diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs
index a766e6efb7..781d1a5b7e 100644
--- a/osu.Game/Overlays/Dialog/PopupDialog.cs
+++ b/osu.Game/Overlays/Dialog/PopupDialog.cs
@@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Dialog
},
},
},
- header = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 25))
+ header = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 25))
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
@@ -180,7 +180,7 @@ namespace osu.Game.Overlays.Dialog
Padding = new MarginPadding(15),
TextAnchor = Anchor.TopCentre,
},
- body = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 18))
+ body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs
index 0ff29ba93e..2dedef8fb2 100644
--- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs
+++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs
@@ -105,7 +105,7 @@ namespace osu.Game.Overlays.MedalSplash
{
s.Anchor = Anchor.TopCentre;
s.Origin = Anchor.TopCentre;
- s.Font = OsuFont.GetFont(s.Font, size: 16);
+ s.Font = s.Font.With(size: 16);
});
medalContainer.OnLoadComplete = d =>
diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs
index b219610e59..8fdac6d1ad 100644
--- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs
+++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs
@@ -274,7 +274,7 @@ namespace osu.Game.Overlays.Mods
},
new OsuTextFlowContainer(text =>
{
- text.Font = OsuFont.GetFont(text.Font, size: 18);
+ text.Font = text.Font.With(size: 18);
text.Shadow = true;
})
{
diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs
index 933e296656..91dab14a62 100644
--- a/osu.Game/Overlays/Notifications/SimpleNotification.cs
+++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs
@@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Notifications
}
});
- Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 14))
+ Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14))
{
Colour = OsuColour.Gray(128),
AutoSizeAxes = Axes.Y,
diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs
index cf1ff3aec3..c488adf4d7 100644
--- a/osu.Game/Overlays/Profile/ProfileHeader.cs
+++ b/osu.Game/Overlays/Profile/ProfileHeader.cs
@@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Profile
Y = cover_height,
Colour = OsuColour.Gray(34),
},
- infoTextLeft = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 14))
+ infoTextLeft = new LinkFlowContainer(t => t.Font = t.Font.With(size: 14))
{
X = UserProfileOverlay.CONTENT_X_MARGIN,
Y = cover_height + 20,
@@ -349,7 +349,7 @@ namespace osu.Game.Overlays.Profile
colourBar.Show();
}
- void boldItalic(SpriteText t) => t.Font = OsuFont.GetFont(t.Font, weight: FontWeight.Bold, italics: true);
+ void boldItalic(SpriteText t) => t.Font = t.Font.With(weight: FontWeight.Bold, italics: true);
void lightText(SpriteText t) => t.Alpha = 0.8f;
OsuSpriteText createScoreText(string text) => new OsuSpriteText
diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs
index 5504ccee90..31f1f1af60 100644
--- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs
+++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs
@@ -119,7 +119,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
}
}
},
- new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 19))
+ new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 19))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
diff --git a/osu.Game/Overlays/SearchableList/HeaderTabControl.cs b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs
index f6334c2637..39348a9ad7 100644
--- a/osu.Game/Overlays/SearchableList/HeaderTabControl.cs
+++ b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs
@@ -3,7 +3,6 @@
using osuTK.Graphics;
using osu.Framework.Graphics.UserInterface;
-using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.SearchableList
@@ -22,7 +21,7 @@ namespace osu.Game.Overlays.SearchableList
{
public HeaderTabItem(T value) : base(value)
{
- Text.Font = OsuFont.GetFont(Text.Font, size: 16);
+ Text.Font = Text.Font.With(size: 16);
}
}
}
diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs
index 753fb5c132..27e1cc791a 100644
--- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs
+++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs
@@ -110,8 +110,8 @@ namespace osu.Game.Screens.Edit.Components.Menus
{
public TextContainer()
{
- NormalText.Font = OsuFont.GetFont(NormalText.Font, size: 14);
- BoldText.Font = OsuFont.GetFont(BoldText.Font, size: 14);
+ NormalText.Font = NormalText.Font.With(size: 14);
+ BoldText.Font = BoldText.Font.With(size: 14);
NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL };
}
}
diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs
index 12c33d1f87..55b2d29a87 100644
--- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs
+++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs
@@ -118,7 +118,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
},
new Drawable[]
{
- new TextFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14))
+ new TextFlowContainer(s => s.Font = s.Font.With(size: 14))
{
Padding = new MarginPadding { Horizontal = 15 },
Text = "beat snap divisor",
diff --git a/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs
index 04dfcbefeb..50d524d1f5 100644
--- a/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs
+++ b/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs
@@ -39,7 +39,7 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
public float LabelTextSize
{
get => label.Font.Size;
- set => label.Font = OsuFont.GetFont(label.Font, size: value);
+ set => label.Font = label.Font.With(size: value);
}
public string PlaceholderText
diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs
index c887c18a46..68a6e6525b 100644
--- a/osu.Game/Screens/Menu/Disclaimer.cs
+++ b/osu.Game/Screens/Menu/Disclaimer.cs
@@ -64,10 +64,10 @@ namespace osu.Game.Screens.Menu
}
};
- textFlow.AddText("This is an ", t => t.Font = OsuFont.GetFont(t.Font, size: 30, weight: FontWeight.Light));
- textFlow.AddText("early development build", t => t.Font = OsuFont.GetFont(t.Font, size: 30, weight: FontWeight.SemiBold));
+ textFlow.AddText("This is an ", t => t.Font = t.Font.With(size: 30, weight: FontWeight.Light));
+ textFlow.AddText("early development build", t => t.Font = t.Font.With(size: 30, weight: FontWeight.SemiBold));
- textFlow.AddParagraph("Things may not work as expected", t => t.Font = OsuFont.GetFont(t.Font, size: 20));
+ textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20));
textFlow.NewParagraph();
Action format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold);
@@ -90,7 +90,7 @@ namespace osu.Game.Screens.Menu
supporterDrawables.Add(heart = textFlow.AddIcon(FontAwesome.fa_heart, t =>
{
t.Padding = new MarginPadding { Left = 5 };
- t.Font = OsuFont.GetFont(t.Font, size: 12);
+ t.Font = t.Font.With(size: 12);
t.Colour = colours.Pink;
t.Origin = Anchor.Centre;
}).First());
diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs
index d25aacd049..6162b17362 100644
--- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs
+++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs
@@ -58,7 +58,7 @@ namespace osu.Game.Screens.Multi.Components
if (beatmap == null)
textFlow.AddText("No beatmap selected", s =>
{
- s.Font = OsuFont.GetFont(s.Font, size: TextSize);
+ s.Font = s.Font.With(size: TextSize);
s.Colour = colours.PinkLight;
});
else
diff --git a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs
index b0eec396f8..fea2822e1a 100644
--- a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs
+++ b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs
@@ -40,7 +40,7 @@ namespace osu.Game.Screens.Multi.Components
Children = new Drawable[]
{
new BeatmapTitle(),
- beatmapAuthor = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14))
+ beatmapAuthor = new LinkFlowContainer(s => s.Font = s.Font.With(size: 14))
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs
index 1f25568d63..6aa63423d1 100644
--- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs
+++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs
@@ -96,7 +96,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
{
hostText.AddText("hosted by ");
hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile",
- s => s.Font = OsuFont.GetFont(Typeface.Exo, weight: FontWeight.Bold, italics: true));
+ s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));
flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
}
}, true);
diff --git a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs
index 6896e3edac..d765ffe8a8 100644
--- a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs
+++ b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs
@@ -55,7 +55,7 @@ namespace osu.Game.Screens.Multi.Match.Components
linkContainer.AddText("hosted by");
linkContainer.NewLine();
linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile",
- s => s.Font = OsuFont.GetFont(Typeface.Exo, weight: FontWeight.Bold, italics: true));
+ s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));
}
}
}
diff --git a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs
index 423b897813..40a549cb94 100644
--- a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs
+++ b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs
@@ -80,7 +80,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
Action gray = s => s.Colour = colours.GrayC;
Action white = s =>
{
- s.Font = OsuFont.GetFont(s.Font, size: s.Font.Size * 1.4f);
+ s.Font = s.Font.With(size: s.Font.Size * 1.4f);
s.Colour = colours.GrayF;
};
@@ -91,7 +91,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
rankText.AddText($"#{index + 1} ", s =>
{
- s.Font = OsuFont.GetFont(s.Font, Typeface.Exo, weight: FontWeight.Bold);
+ s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold);
s.Colour = colours.YellowDark;
});
diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs
index 0b27d8e69e..13b4b0b2fc 100644
--- a/osu.Game/Screens/Play/HUD/ComboCounter.cs
+++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs
@@ -5,7 +5,6 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
-using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Play.HUD
@@ -101,8 +100,8 @@ namespace osu.Game.Screens.Play.HUD
{
textSize = value;
- DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: TextSize);
- PopOutCount.Font = OsuFont.GetFont(PopOutCount.Font, size: TextSize);
+ DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(size: TextSize);
+ PopOutCount.Font = PopOutCount.Font.With(size: TextSize);
}
}
diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs
index f593f4a47e..09b5b7ea49 100644
--- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs
+++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs
@@ -391,7 +391,7 @@ namespace osu.Game.Screens.Ranking.Pages
public SlowScoreCounter(uint leading = 0) : base(leading)
{
DisplayedCountSpriteText.Shadow = false;
- DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, Typeface.Venera, weight: FontWeight.Light);
+ DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(Typeface.Venera, weight: FontWeight.Light);
UseCommaSeparator = true;
}
}
diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs
index a0baf64a37..c0a004ede3 100644
--- a/osu.Game/Screens/Select/BeatmapDetails.cs
+++ b/osu.Game/Screens/Select/BeatmapDetails.cs
@@ -346,7 +346,7 @@ namespace osu.Game.Screens.Select
private void setTextAsync(string text)
{
- LoadComponentAsync(new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14))
+ LoadComponentAsync(new OsuTextFlowContainer(s => s.Font = s.Font.With(size: 14))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,