1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 22:06:08 +08:00

Replace copy-constructor/method with extension method

This commit is contained in:
smoogipoo 2019-02-20 19:32:30 +09:00
parent dbfa95b9e7
commit 4db5531e4b
40 changed files with 66 additions and 68 deletions

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.UI
private void load() private void load()
{ {
if (JudgementText != null) if (JudgementText != null)
JudgementText.Font = OsuFont.GetFont(JudgementText.Font, size: 25); JudgementText.Font = JudgementText.Font.With(size: 25);
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps.Drawables
public float TextSize public float TextSize
{ {
get => statusText.Font.Size; get => statusText.Font.Size;
set => statusText.Font = OsuFont.GetFont(statusText.Font, size: value); set => statusText.Font = statusText.Font.With(size: value);
} }
public MarginPadding TextPadding public MarginPadding TextPadding

View File

@ -11,18 +11,10 @@ namespace osu.Game.Graphics
public static FontUsage Default => GetFont(); 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) 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) switch (typeface)
{ {
@ -37,10 +29,10 @@ namespace osu.Game.Graphics
return null; return null;
} }
private static string getWeightString(Typeface typeface, FontWeight weight) public static string GetWeightString(Typeface typeface, FontWeight weight)
=> getWeightString(getFamilyString(typeface), 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(); 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 public enum Typeface
{ {
Exo, Exo,

View File

@ -82,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface
public BreadcrumbTabItem(T value) : base(value) 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 }; Text.Margin = new MarginPadding { Vertical = 8 };
Padding = new MarginPadding { Right = padding + item_chevron_size }; Padding = new MarginPadding { Right = padding + item_chevron_size };
Add(Chevron = new SpriteIcon Add(Chevron = new SpriteIcon

View File

@ -199,7 +199,7 @@ namespace osu.Game.Graphics.UserInterface
public float TextSize public float TextSize
{ {
get => spriteText.Font.Size; 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); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos);

View File

@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds() 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(); protected override void OnActivated() => fadeActive();

View File

@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds() 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] [BackgroundDependencyLoader]

View File

@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface
public PercentageCounter() public PercentageCounter()
{ {
DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true); DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(fixedWidth: true);
Current.Value = DisplayedCount = 1.0f; Current.Value = DisplayedCount = 1.0f;
} }

View File

@ -65,7 +65,7 @@ namespace osu.Game.Graphics.UserInterface
public float TextSize public float TextSize
{ {
get => DisplayedCountSpriteText.Font.Size; get => DisplayedCountSpriteText.Font.Size;
set => DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: value); set => DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(size: value);
} }
public Color4 AccentColour public Color4 AccentColour

View File

@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface
/// <param name="leading">How many leading zeroes the counter will have.</param> /// <param name="leading">How many leading zeroes the counter will have.</param>
public ScoreCounter(uint leading = 0) public ScoreCounter(uint leading = 0)
{ {
DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true); DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(fixedWidth: true);
LeadingZeroes = leading; LeadingZeroes = leading;
} }

View File

@ -294,7 +294,7 @@ namespace osu.Game.Online.Leaderboards
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Font = OsuFont.GetFont(font, fixedWidth: true), Font = font.With(fixedWidth: true),
Text = text, Text = text,
Colour = glowColour, Colour = glowColour,
Shadow = false, Shadow = false,
@ -305,7 +305,7 @@ namespace osu.Game.Online.Leaderboards
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Font = OsuFont.GetFont(font, fixedWidth: true), Font = font.With(fixedWidth: true),
Text = text, Text = text,
Colour = textColour, Colour = textColour,
Shadow = false, Shadow = false,

View File

@ -14,7 +14,7 @@ namespace osu.Game.Online.Leaderboards
{ {
AddIcon(FontAwesome.fa_exclamation_circle, cp => 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 }; cp.Padding = new MarginPadding { Right = 10 };
}); });

View File

@ -3,7 +3,6 @@
using System; using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
namespace osu.Game.Online.Leaderboards namespace osu.Game.Online.Leaderboards
@ -13,7 +12,7 @@ namespace osu.Game.Online.Leaderboards
protected const float TEXT_SIZE = 22; protected const float TEXT_SIZE = 22;
protected Placeholder() 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; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;

View File

@ -3,7 +3,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osuTK.Graphics; using osuTK.Graphics;
@ -14,7 +13,7 @@ namespace osu.Game.Overlays.AccountCreation
private readonly List<Drawable> errorDrawables = new List<Drawable>(); private readonly List<Drawable> errorDrawables = new List<Drawable>();
public ErrorTextFlowContainer() public ErrorTextFlowContainer()
: base(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12)) : base(cp => cp.Font = cp.Font.With(size: 12))
{ {
} }

View File

@ -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!"); 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("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 "); passwordDescription.AddText("At least ");
characterCheckText = passwordDescription.AddText("8 characters long"); characterCheckText = passwordDescription.AddText("8 characters long");

View File

@ -89,7 +89,7 @@ namespace osu.Game.Overlays.AccountCreation
Font = OsuFont.GetFont(size: 28, weight: FontWeight.Light), Font = OsuFont.GetFont(size: 28, weight: FontWeight.Light),
Text = "Warning! 注意!", 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, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y AutoSizeAxes = Axes.Y
@ -105,7 +105,7 @@ namespace osu.Game.Overlays.AccountCreation
Text = "I understand. This account isn't for me.", Text = "I understand. This account isn't for me.",
Action = () => this.Push(new ScreenEntry()) 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 }, Margin = new MarginPadding { Top = 20 },
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,

View File

@ -122,7 +122,7 @@ namespace osu.Game.Overlays.BeatmapSet
new OsuSpriteText new OsuSpriteText
{ {
Text = second, Text = second,
Font = OsuFont.GetFont(secondFont, size: 13) Font = secondFont.With(size: 13)
}, },
}; };
} }

View File

@ -156,7 +156,7 @@ namespace osu.Game.Overlays.BeatmapSet
this.FadeIn(transition_duration); this.FadeIn(transition_duration);
textFlow.Clear(); 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));
} }
} }

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
public float TextSize public float TextSize
{ {
get => text.Font.Size; get => text.Font.Size;
set => text.Font = OsuFont.GetFont(text.Font, size: value); set => text.Font = text.Font.With(size: value);
} }
public ClickableUsername() public ClickableUsername()

View File

@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Chat
t.Colour = OsuColour.FromHex(message.Sender.Colour); 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, AutoSizeAxes = Axes.Y,

View File

@ -20,8 +20,8 @@ namespace osu.Game.Overlays.Chat.Tabs
Icon.Alpha = 0; Icon.Alpha = 0;
Text.Font = OsuFont.GetFont(Text.Font, size: 45); Text.Font = Text.Font.With(size: 45);
TextBold.Font = OsuFont.GetFont(Text.Font, size: 45); TextBold.Font = Text.Font.With(size: 45);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -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, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
@ -180,7 +180,7 @@ namespace osu.Game.Overlays.Dialog
Padding = new MarginPadding(15), Padding = new MarginPadding(15),
TextAnchor = Anchor.TopCentre, 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, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,

View File

@ -105,7 +105,7 @@ namespace osu.Game.Overlays.MedalSplash
{ {
s.Anchor = Anchor.TopCentre; s.Anchor = Anchor.TopCentre;
s.Origin = Anchor.TopCentre; s.Origin = Anchor.TopCentre;
s.Font = OsuFont.GetFont(s.Font, size: 16); s.Font = s.Font.With(size: 16);
}); });
medalContainer.OnLoadComplete = d => medalContainer.OnLoadComplete = d =>

View File

@ -274,7 +274,7 @@ namespace osu.Game.Overlays.Mods
}, },
new OsuTextFlowContainer(text => new OsuTextFlowContainer(text =>
{ {
text.Font = OsuFont.GetFont(text.Font, size: 18); text.Font = text.Font.With(size: 18);
text.Shadow = true; text.Shadow = true;
}) })
{ {

View File

@ -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), Colour = OsuColour.Gray(128),
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,

View File

@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Profile
Y = cover_height, Y = cover_height,
Colour = OsuColour.Gray(34), 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, X = UserProfileOverlay.CONTENT_X_MARGIN,
Y = cover_height + 20, Y = cover_height + 20,
@ -349,7 +349,7 @@ namespace osu.Game.Overlays.Profile
colourBar.Show(); 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; void lightText(SpriteText t) => t.Alpha = 0.8f;
OsuSpriteText createScoreText(string text) => new OsuSpriteText OsuSpriteText createScoreText(string text) => new OsuSpriteText

View File

@ -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, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,

View File

@ -3,7 +3,6 @@
using osuTK.Graphics; using osuTK.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.SearchableList namespace osu.Game.Overlays.SearchableList
@ -22,7 +21,7 @@ namespace osu.Game.Overlays.SearchableList
{ {
public HeaderTabItem(T value) : base(value) public HeaderTabItem(T value) : base(value)
{ {
Text.Font = OsuFont.GetFont(Text.Font, size: 16); Text.Font = Text.Font.With(size: 16);
} }
} }
} }

View File

@ -110,8 +110,8 @@ namespace osu.Game.Screens.Edit.Components.Menus
{ {
public TextContainer() public TextContainer()
{ {
NormalText.Font = OsuFont.GetFont(NormalText.Font, size: 14); NormalText.Font = NormalText.Font.With(size: 14);
BoldText.Font = OsuFont.GetFont(BoldText.Font, size: 14); BoldText.Font = BoldText.Font.With(size: 14);
NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL }; NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL };
} }
} }

View File

@ -118,7 +118,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
}, },
new Drawable[] 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 }, Padding = new MarginPadding { Horizontal = 15 },
Text = "beat snap divisor", Text = "beat snap divisor",

View File

@ -39,7 +39,7 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
public float LabelTextSize public float LabelTextSize
{ {
get => label.Font.Size; get => label.Font.Size;
set => label.Font = OsuFont.GetFont(label.Font, size: value); set => label.Font = label.Font.With(size: value);
} }
public string PlaceholderText public string PlaceholderText

View File

@ -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("This is an ", t => t.Font = t.Font.With(size: 30, weight: FontWeight.Light));
textFlow.AddText("early development build", t => t.Font = OsuFont.GetFont(t.Font, size: 30, weight: FontWeight.SemiBold)); 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(); textFlow.NewParagraph();
Action<SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold); Action<SpriteText> 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 => supporterDrawables.Add(heart = textFlow.AddIcon(FontAwesome.fa_heart, t =>
{ {
t.Padding = new MarginPadding { Left = 5 }; 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.Colour = colours.Pink;
t.Origin = Anchor.Centre; t.Origin = Anchor.Centre;
}).First()); }).First());

View File

@ -58,7 +58,7 @@ namespace osu.Game.Screens.Multi.Components
if (beatmap == null) if (beatmap == null)
textFlow.AddText("No beatmap selected", s => 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; s.Colour = colours.PinkLight;
}); });
else else

View File

@ -40,7 +40,7 @@ namespace osu.Game.Screens.Multi.Components
Children = new Drawable[] Children = new Drawable[]
{ {
new BeatmapTitle(), 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, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,

View File

@ -96,7 +96,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
{ {
hostText.AddText("hosted by "); hostText.AddText("hosted by ");
hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", 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 }; flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
} }
}, true); }, true);

View File

@ -55,7 +55,7 @@ namespace osu.Game.Screens.Multi.Match.Components
linkContainer.AddText("hosted by"); linkContainer.AddText("hosted by");
linkContainer.NewLine(); linkContainer.NewLine();
linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile", 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));
} }
} }
} }

View File

@ -80,7 +80,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
Action<SpriteText> gray = s => s.Colour = colours.GrayC; Action<SpriteText> gray = s => s.Colour = colours.GrayC;
Action<SpriteText> white = s => Action<SpriteText> 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; s.Colour = colours.GrayF;
}; };
@ -91,7 +91,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages
rankText.AddText($"#{index + 1} ", s => 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; s.Colour = colours.YellowDark;
}); });

View File

@ -5,7 +5,6 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
@ -101,8 +100,8 @@ namespace osu.Game.Screens.Play.HUD
{ {
textSize = value; textSize = value;
DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: TextSize); DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(size: TextSize);
PopOutCount.Font = OsuFont.GetFont(PopOutCount.Font, size: TextSize); PopOutCount.Font = PopOutCount.Font.With(size: TextSize);
} }
} }

View File

@ -391,7 +391,7 @@ namespace osu.Game.Screens.Ranking.Pages
public SlowScoreCounter(uint leading = 0) : base(leading) public SlowScoreCounter(uint leading = 0) : base(leading)
{ {
DisplayedCountSpriteText.Shadow = false; 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; UseCommaSeparator = true;
} }
} }

View File

@ -346,7 +346,7 @@ namespace osu.Game.Screens.Select
private void setTextAsync(string text) 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, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,