diff --git a/osu.Game/Overlays/Mods/ModSelectColumn.cs b/osu.Game/Overlays/Mods/ModSelectColumn.cs index b2c5a054e1..61b29ef65b 100644 --- a/osu.Game/Overlays/Mods/ModSelectColumn.cs +++ b/osu.Game/Overlays/Mods/ModSelectColumn.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -8,9 +9,11 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; +using System.Linq; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; using osuTK; using osuTK.Graphics; @@ -181,17 +184,15 @@ namespace osu.Game.Overlays.Mods { headerText.Clear(); - int wordIndex = 0; + ITextPart part = headerText.AddText(text); + part.DrawablePartsRecreated += applySemiBoldToFirstWord; + applySemiBoldToFirstWord(part.Drawables); - ITextPart part = headerText.AddText(text, t => + void applySemiBoldToFirstWord(IEnumerable d) { - if (wordIndex == 0) - t.Font = t.Font.With(weight: FontWeight.SemiBold); - wordIndex += 1; - }); - - // Reset the index so that if the parts are refreshed (e.g. through changes in localisation) the correct word is re-emboldened. - part.DrawablePartsRecreated += _ => wordIndex = 0; + if (d.FirstOrDefault() is OsuSpriteText firstWord) + firstWord.Font = firstWord.Font.With(weight: FontWeight.SemiBold); + } } [BackgroundDependencyLoader]