mirror of https://github.com/ppy/osu
Allow legacy text to display fixed width correctly
This commit is contained in:
parent
408183fdf9
commit
cdb649476b
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue