mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Update to use virtual methods instead of reconstructing TextBuilder
This commit is contained in:
parent
cdb649476b
commit
39cf27637e
@ -5,7 +5,6 @@ using System.Threading.Tasks;
|
|||||||
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
|
||||||
{
|
{
|
||||||
@ -13,6 +12,10 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
private readonly LegacyGlyphStore glyphStore;
|
private readonly LegacyGlyphStore glyphStore;
|
||||||
|
|
||||||
|
protected override char FixedWidthReferenceCharacter => '5';
|
||||||
|
|
||||||
|
protected override char[] FixedWidthExcludeCharacters => new[] { ',', '.', '%', 'x' };
|
||||||
|
|
||||||
public LegacySpriteText(ISkin skin, string font = "score")
|
public LegacySpriteText(ISkin skin, string font = "score")
|
||||||
{
|
{
|
||||||
Shadow = false;
|
Shadow = false;
|
||||||
@ -22,8 +25,7 @@ namespace osu.Game.Skinning
|
|||||||
glyphStore = new LegacyGlyphStore(skin);
|
glyphStore = new LegacyGlyphStore(skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) =>
|
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);
|
||||||
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
Block a user