From 274168202902cf1502527bcaf8ef8e75e063fd82 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 29 Mar 2021 02:54:02 +0200 Subject: [PATCH] fixed generic stash font line height for static sprite fonts --- MLEM.Extended/Font/GenericStashFont.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MLEM.Extended/Font/GenericStashFont.cs b/MLEM.Extended/Font/GenericStashFont.cs index aa52ee3..2ba376d 100644 --- a/MLEM.Extended/Font/GenericStashFont.cs +++ b/MLEM.Extended/Font/GenericStashFont.cs @@ -29,8 +29,9 @@ namespace MLEM.Extended.Font { /// An italic version of the font public GenericStashFont(SpriteFontBase font, SpriteFontBase bold = null, SpriteFontBase italic = null) { this.Font = font; - // SpriteFontBase provides no line height, so we measure the height of a new line - this.LineHeight = font.MeasureString("\n").Y; + // SpriteFontBase provides no line height, so we measure the height of a new line for most fonts + // 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.Italic = italic != null ? new GenericStashFont(italic) : this; }