1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:05:37 +08:00

Merge pull request #26536 from peppy/cache-fonts

Fix gameplay counter textures not being cached ahead of time
This commit is contained in:
Bartłomiej Dach 2024-01-15 13:11:40 +01:00 committed by GitHub
commit cd9b6656ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -137,6 +137,12 @@ namespace osu.Game.Screens.Play.HUD
Spacing = new Vector2(-2f, 0f);
Font = new FontUsage(font_name, 1);
glyphStore = new GlyphStore(font_name, textures, getLookup);
// cache common lookups ahead of time.
foreach (char c in new[] { '.', '%', 'x' })
glyphStore.Get(font_name, c);
for (int i = 0; i < 10; i++)
glyphStore.Get(font_name, (char)('0' + i));
}
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);

View File

@ -50,6 +50,12 @@ namespace osu.Game.Skinning
Spacing = new Vector2(-skin.GetFontOverlap(font), 0);
glyphStore = new LegacyGlyphStore(fontPrefix, skin, MaxSizePerGlyph);
// cache common lookups ahead of time.
foreach (char c in FixedWidthExcludeCharacters)
glyphStore.Get(fontPrefix, c);
for (int i = 0; i < 10; i++)
glyphStore.Get(fontPrefix, (char)('0' + i));
}
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);