mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Add size limitation for hit object numbers
This commit is contained in:
parent
ab5226832a
commit
922f6f36f2
@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
if (!this.HasFont(LegacyFont.HitCircle))
|
if (!this.HasFont(LegacyFont.HitCircle))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new LegacySpriteText(LegacyFont.HitCircle)
|
return new LegacySpriteText(LegacyFont.HitCircle, new Vector2(OsuHitObject.OBJECT_RADIUS * 2))
|
||||||
{
|
{
|
||||||
// stable applies a blanket 0.8x scale to hitcircle fonts
|
// stable applies a blanket 0.8x scale to hitcircle fonts
|
||||||
Scale = new Vector2(0.8f),
|
Scale = new Vector2(0.8f),
|
||||||
|
@ -13,6 +13,7 @@ namespace osu.Game.Skinning
|
|||||||
public sealed partial class LegacySpriteText : OsuSpriteText
|
public sealed partial class LegacySpriteText : OsuSpriteText
|
||||||
{
|
{
|
||||||
private readonly LegacyFont font;
|
private readonly LegacyFont font;
|
||||||
|
private readonly Vector2? maxSize;
|
||||||
|
|
||||||
private LegacyGlyphStore glyphStore = null!;
|
private LegacyGlyphStore glyphStore = null!;
|
||||||
|
|
||||||
@ -20,9 +21,11 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
protected override char[] FixedWidthExcludeCharacters => new[] { ',', '.', '%', 'x' };
|
protected override char[] FixedWidthExcludeCharacters => new[] { ',', '.', '%', 'x' };
|
||||||
|
|
||||||
public LegacySpriteText(LegacyFont font)
|
public LegacySpriteText(LegacyFont font, Vector2? maxSize = null)
|
||||||
{
|
{
|
||||||
this.font = font;
|
this.font = font;
|
||||||
|
this.maxSize = maxSize;
|
||||||
|
|
||||||
Shadow = false;
|
Shadow = false;
|
||||||
UseFullGlyphHeight = false;
|
UseFullGlyphHeight = false;
|
||||||
}
|
}
|
||||||
@ -33,7 +36,7 @@ namespace osu.Game.Skinning
|
|||||||
Font = new FontUsage(skin.GetFontPrefix(font), 1, fixedWidth: true);
|
Font = new FontUsage(skin.GetFontPrefix(font), 1, fixedWidth: true);
|
||||||
Spacing = new Vector2(-skin.GetFontOverlap(font), 0);
|
Spacing = new Vector2(-skin.GetFontOverlap(font), 0);
|
||||||
|
|
||||||
glyphStore = new LegacyGlyphStore(skin);
|
glyphStore = new LegacyGlyphStore(skin, maxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);
|
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);
|
||||||
@ -41,10 +44,12 @@ namespace osu.Game.Skinning
|
|||||||
private class LegacyGlyphStore : ITexturedGlyphLookupStore
|
private class LegacyGlyphStore : ITexturedGlyphLookupStore
|
||||||
{
|
{
|
||||||
private readonly ISkin skin;
|
private readonly ISkin skin;
|
||||||
|
private readonly Vector2? maxSize;
|
||||||
|
|
||||||
public LegacyGlyphStore(ISkin skin)
|
public LegacyGlyphStore(ISkin skin, Vector2? maxSize)
|
||||||
{
|
{
|
||||||
this.skin = skin;
|
this.skin = skin;
|
||||||
|
this.maxSize = maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITexturedCharacterGlyph? Get(string fontName, char character)
|
public ITexturedCharacterGlyph? Get(string fontName, char character)
|
||||||
@ -56,6 +61,9 @@ namespace osu.Game.Skinning
|
|||||||
if (texture == null)
|
if (texture == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (maxSize != null)
|
||||||
|
texture = texture.WithMaximumSize(maxSize.Value);
|
||||||
|
|
||||||
return new TexturedCharacterGlyph(new CharacterGlyph(character, 0, 0, texture.Width, texture.Height, null), texture, 1f / texture.ScaleAdjust);
|
return new TexturedCharacterGlyph(new CharacterGlyph(character, 0, 0, texture.Width, texture.Height, null), texture, 1f / texture.ScaleAdjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user