mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Add legacy font lookup support for comma/percent
This commit is contained in:
parent
254eba9008
commit
4f6dd15869
@ -34,7 +34,9 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public ITexturedCharacterGlyph Get(string fontName, char character)
|
public ITexturedCharacterGlyph Get(string fontName, char character)
|
||||||
{
|
{
|
||||||
var texture = skin.GetTexture($"{fontName}-{character}");
|
var lookup = getLookupName(character);
|
||||||
|
|
||||||
|
var texture = skin.GetTexture($"{fontName}-{lookup}");
|
||||||
|
|
||||||
if (texture == null)
|
if (texture == null)
|
||||||
return null;
|
return null;
|
||||||
@ -42,6 +44,24 @@ namespace osu.Game.Skinning
|
|||||||
return new TexturedCharacterGlyph(new CharacterGlyph(character, 0, 0, texture.Width, null), texture, 1f / texture.ScaleAdjust);
|
return new TexturedCharacterGlyph(new CharacterGlyph(character, 0, 0, texture.Width, null), texture, 1f / texture.ScaleAdjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string getLookupName(char character)
|
||||||
|
{
|
||||||
|
switch (character)
|
||||||
|
{
|
||||||
|
case ',':
|
||||||
|
return "comma";
|
||||||
|
|
||||||
|
case '.':
|
||||||
|
return "dot";
|
||||||
|
|
||||||
|
case '%':
|
||||||
|
return "percent";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return character.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Task<ITexturedCharacterGlyph> GetAsync(string fontName, char character) => Task.Run(() => Get(fontName, character));
|
public Task<ITexturedCharacterGlyph> GetAsync(string fontName, char character) => Task.Run(() => Get(fontName, character));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user