Allow legacy text to display fixed width correctly

This commit is contained in:
Dean Herbert 2020-10-19 14:33:53 +09:00
parent 408183fdf9
commit cdb649476b
1 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,7 @@
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Text; using osu.Framework.Text;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osuTK;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
@ -17,11 +18,12 @@ public LegacySpriteText(ISkin skin, string font = "score")
Shadow = false; Shadow = false;
UseFullGlyphHeight = false; UseFullGlyphHeight = false;
Font = new FontUsage(font, 1); Font = new FontUsage(font, 1, fixedWidth: true);
glyphStore = new LegacyGlyphStore(skin); glyphStore = new LegacyGlyphStore(skin);
} }
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore); protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) =>
new TextBuilder(glyphStore, Font, MaxWidth, UseFullGlyphHeight, Vector2.Zero, Spacing, CharactersBacking, neverFixedWidthCharacters: new[] { ',', '.', '%', 'x' }, fixedWidthCalculationCharacter: '5');
private class LegacyGlyphStore : ITexturedGlyphLookupStore private class LegacyGlyphStore : ITexturedGlyphLookupStore
{ {