From 252d06888fd19a982d41106ba6351dc64707cd7b Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 28 Nov 2021 11:30:57 +0100 Subject: [PATCH] consistently use the default font's line height --- MLEM/Font/GenericFont.cs | 6 +++--- MLEM/Formatting/TokenizedString.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MLEM/Font/GenericFont.cs b/MLEM/Font/GenericFont.cs index e0f634f..97e23aa 100644 --- a/MLEM/Font/GenericFont.cs +++ b/MLEM/Font/GenericFont.cs @@ -142,10 +142,10 @@ namespace MLEM.Font { switch (text[i]) { case '\n': xOffset = 0; - size.Y += font.LineHeight; + size.Y += this.LineHeight; break; case OneEmSpace: - xOffset += font.LineHeight; + xOffset += this.LineHeight; break; case Nbsp: xOffset += font.MeasureChar(' '); @@ -170,7 +170,7 @@ namespace MLEM.Font { size.X = xOffset; } // include the last line's height too! - size.Y += (fontFunction?.Invoke(text.Length - 1) ?? this).LineHeight; + size.Y += this.LineHeight; return size; } diff --git a/MLEM/Formatting/TokenizedString.cs b/MLEM/Formatting/TokenizedString.cs index 9382f0f..0b2bf88 100644 --- a/MLEM/Formatting/TokenizedString.cs +++ b/MLEM/Formatting/TokenizedString.cs @@ -194,7 +194,7 @@ namespace MLEM.Formatting { if (l < token.SplitDisplayString.Length - 1) { innerOffset.X = token.InnerOffsets[l] = this.GetInnerOffsetX(font, t, l + 1, alignment); - innerOffset.Y += tokenFont.LineHeight; + innerOffset.Y += font.LineHeight; } else { innerOffset.X += size.X; } @@ -239,7 +239,7 @@ namespace MLEM.Formatting { if (index <= 0) return token.GetFont(font); } - return font; + return null; } }