mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-29 23:58:34 +01:00
copy SpriteFont in GenericSpriteFont so that we don't modify the passed fonts' default character
This commit is contained in:
parent
aa064812fc
commit
bd43c14a33
1 changed files with 11 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
@ -68,10 +69,16 @@ namespace MLEM.Font {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SpriteFont SetDefaults(SpriteFont font) {
|
private static SpriteFont SetDefaults(SpriteFont font) {
|
||||||
// so that missing character behavior is in line with MG.Extended's
|
// we copy the font here to set the default character to a space
|
||||||
// bitmap fonts, we draw nothing as the default character
|
return new SpriteFont(
|
||||||
font.DefaultCharacter = ' ';
|
font.Texture,
|
||||||
return font;
|
font.Glyphs.Select(g => g.BoundsInTexture).ToList(),
|
||||||
|
font.Glyphs.Select(g => g.Cropping).ToList(),
|
||||||
|
font.Characters.ToList(),
|
||||||
|
font.LineSpacing,
|
||||||
|
font.Spacing,
|
||||||
|
font.Glyphs.Select(g => new Vector3(g.LeftSideBearing, g.Width, g.RightSideBearing)).ToList(),
|
||||||
|
' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue