1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

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

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Text;
using osu.Game.Graphics.Sprites;
using osuTK;
namespace osu.Game.Skinning
{
@ -17,11 +18,12 @@ namespace osu.Game.Skinning
Shadow = false;
UseFullGlyphHeight = false;
Font = new FontUsage(font, 1);
Font = new FontUsage(font, 1, fixedWidth: true);
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
{