mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 06:28:35 +01:00
fixed generic stash font line height for static sprite fonts
This commit is contained in:
parent
e6243b831c
commit
2741682029
1 changed files with 3 additions and 2 deletions
|
@ -29,8 +29,9 @@ namespace MLEM.Extended.Font {
|
||||||
/// <param name="italic">An italic version of the font</param>
|
/// <param name="italic">An italic version of the font</param>
|
||||||
public GenericStashFont(SpriteFontBase font, SpriteFontBase bold = null, SpriteFontBase italic = null) {
|
public GenericStashFont(SpriteFontBase font, SpriteFontBase bold = null, SpriteFontBase italic = null) {
|
||||||
this.Font = font;
|
this.Font = font;
|
||||||
// SpriteFontBase provides no line height, so we measure the height of a new line
|
// SpriteFontBase provides no line height, so we measure the height of a new line for most fonts
|
||||||
this.LineHeight = font.MeasureString("\n").Y;
|
// This doesn't work with static sprite fonts, but their size is always the one we calculate here
|
||||||
|
this.LineHeight = font is StaticSpriteFont s ? s.FontSize + s.LineSpacing : font.MeasureString("\n").Y;
|
||||||
this.Bold = bold != null ? new GenericStashFont(bold) : this;
|
this.Bold = bold != null ? new GenericStashFont(bold) : this;
|
||||||
this.Italic = italic != null ? new GenericStashFont(italic) : this;
|
this.Italic = italic != null ? new GenericStashFont(italic) : this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue