diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs index d176041015..2564dbf335 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/OsuLegacySkinTransformer.cs @@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy if (!this.HasFont(LegacyFont.HitCircle)) return null; - return new LegacySpriteText(LegacyFont.HitCircle) + return new LegacySpriteText(LegacyFont.HitCircle, new Vector2(OsuHitObject.OBJECT_RADIUS * 2)) { // stable applies a blanket 0.8x scale to hitcircle fonts Scale = new Vector2(0.8f), diff --git a/osu.Game/Skinning/LegacySpriteText.cs b/osu.Game/Skinning/LegacySpriteText.cs index d6af52855b..f021a99102 100644 --- a/osu.Game/Skinning/LegacySpriteText.cs +++ b/osu.Game/Skinning/LegacySpriteText.cs @@ -13,6 +13,7 @@ namespace osu.Game.Skinning public sealed partial class LegacySpriteText : OsuSpriteText { private readonly LegacyFont font; + private readonly Vector2? maxSize; private LegacyGlyphStore glyphStore = null!; @@ -20,9 +21,11 @@ namespace osu.Game.Skinning protected override char[] FixedWidthExcludeCharacters => new[] { ',', '.', '%', 'x' }; - public LegacySpriteText(LegacyFont font) + public LegacySpriteText(LegacyFont font, Vector2? maxSize = null) { this.font = font; + this.maxSize = maxSize; + Shadow = false; UseFullGlyphHeight = false; } @@ -33,7 +36,7 @@ namespace osu.Game.Skinning Font = new FontUsage(skin.GetFontPrefix(font), 1, fixedWidth: true); Spacing = new Vector2(-skin.GetFontOverlap(font), 0); - glyphStore = new LegacyGlyphStore(skin); + glyphStore = new LegacyGlyphStore(skin, maxSize); } protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore); @@ -41,10 +44,12 @@ namespace osu.Game.Skinning private class LegacyGlyphStore : ITexturedGlyphLookupStore { private readonly ISkin skin; + private readonly Vector2? maxSize; - public LegacyGlyphStore(ISkin skin) + public LegacyGlyphStore(ISkin skin, Vector2? maxSize) { this.skin = skin; + this.maxSize = maxSize; } public ITexturedCharacterGlyph? Get(string fontName, char character) @@ -56,6 +61,9 @@ namespace osu.Game.Skinning if (texture == null) return null; + if (maxSize != null) + texture = texture.WithMaximumSize(maxSize.Value); + return new TexturedCharacterGlyph(new CharacterGlyph(character, 0, 0, texture.Width, texture.Height, null), texture, 1f / texture.ScaleAdjust); }