From 051aa8f028d8235c648331899e72d6cddd971b92 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 13 Jun 2022 04:43:14 +0300 Subject: [PATCH 1/3] Mark family strings as verbatim --- osu.Game/Graphics/OsuFont.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index edb484021c..080d952cbd 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -54,16 +54,16 @@ namespace osu.Game.Graphics switch (typeface) { case Typeface.Venera: - return "Venera"; + return @"Venera"; case Typeface.Torus: - return "Torus"; + return @"Torus"; case Typeface.TorusAlternate: - return "Torus-Alternate"; + return @"Torus-Alternate"; case Typeface.Inter: - return "Inter"; + return @"Inter"; } return null; From 79713556608b60d4e5b80fb23ad3322245dbfe69 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 13 Jun 2022 04:44:28 +0300 Subject: [PATCH 2/3] Fix torus "medium" weight not mapped to "regular" when using `With` --- osu.Game/Graphics/OsuFont.cs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 080d952cbd..44303b8527 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -35,7 +35,10 @@ namespace osu.Game.Graphics /// Whether all characters should be spaced the same distance apart. /// The . public static FontUsage GetFont(Typeface typeface = Typeface.Torus, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false) - => new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), getItalics(italics), fixedWidth); + { + string familyString = GetFamilyString(typeface); + return new FontUsage(familyString, size, GetWeightString(familyString, weight), getItalics(italics), fixedWidth); + } private static bool getItalics(in bool italicsRequested) { @@ -72,25 +75,17 @@ namespace osu.Game.Graphics /// /// Retrieves the string representation of a . /// - /// The . - /// The . - /// The string representation of in the specified . - public static string GetWeightString(Typeface typeface, FontWeight weight) + /// The font family. + /// The font weight. + /// The string representation of in the specified . + public static string GetWeightString(string family, FontWeight weight) { - if (typeface == Typeface.Torus && weight == FontWeight.Medium) + if (family == @"Torus" && weight == FontWeight.Medium) // torus doesn't have a medium; fallback to regular. weight = FontWeight.Regular; - return GetWeightString(GetFamilyString(typeface), weight); + return weight.ToString(); } - - /// - /// Retrieves the string representation of a . - /// - /// The family string. - /// The . - /// The string representation of in the specified . - public static string GetWeightString(string family, FontWeight weight) => weight.ToString(); } public static class OsuFontExtensions From 3aec0fe9b6c07348e71c4b929fe0d0e09a764c66 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Mon, 13 Jun 2022 04:45:07 +0300 Subject: [PATCH 3/3] Fix torus alternate not mapping "medium" weight to "regular" --- osu.Game/Graphics/OsuFont.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 44303b8527..0cd3097af5 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -80,7 +80,7 @@ namespace osu.Game.Graphics /// The string representation of in the specified . public static string GetWeightString(string family, FontWeight weight) { - if (family == @"Torus" && weight == FontWeight.Medium) + if ((family == @"Torus" || family == @"Torus-Alternate") && weight == FontWeight.Medium) // torus doesn't have a medium; fallback to regular. weight = FontWeight.Regular;