1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:43:00 +08:00

Update to use virtual methods instead of reconstructing TextBuilder

This commit is contained in:
Dean Herbert 2020-10-19 14:59:03 +09:00
parent cdb649476b
commit 39cf27637e

View File

@ -5,7 +5,6 @@ using System.Threading.Tasks;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Text;
using osu.Game.Graphics.Sprites;
using osuTK;
namespace osu.Game.Skinning
{
@ -13,6 +12,10 @@ namespace osu.Game.Skinning
{
private readonly LegacyGlyphStore glyphStore;
protected override char FixedWidthReferenceCharacter => '5';
protected override char[] FixedWidthExcludeCharacters => new[] { ',', '.', '%', 'x' };
public LegacySpriteText(ISkin skin, string font = "score")
{
Shadow = false;
@ -22,8 +25,7 @@ namespace osu.Game.Skinning
glyphStore = new LegacyGlyphStore(skin);
}
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) =>
new TextBuilder(glyphStore, Font, MaxWidth, UseFullGlyphHeight, Vector2.Zero, Spacing, CharactersBacking, neverFixedWidthCharacters: new[] { ',', '.', '%', 'x' }, fixedWidthCalculationCharacter: '5');
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);
private class LegacyGlyphStore : ITexturedGlyphLookupStore
{