From 238b2eee5f4b02246b6ee2d54c985ebc6e99d701 Mon Sep 17 00:00:00 2001 From: Benjamin Popp Date: Tue, 11 Jun 2019 23:00:14 -0500 Subject: [PATCH] Bugfix --- src/HexManiac.WPF/Implementations/FormatDrawer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/HexManiac.WPF/Implementations/FormatDrawer.cs b/src/HexManiac.WPF/Implementations/FormatDrawer.cs index c340ac59..77cac8bf 100644 --- a/src/HexManiac.WPF/Implementations/FormatDrawer.cs +++ b/src/HexManiac.WPF/Implementations/FormatDrawer.cs @@ -152,7 +152,11 @@ namespace HavenSoft.HexManiac.WPF.Implementations { var advanceWidths = new List(text.Length); double totalWidth = 0; for (int i = 0; i < text.Length; i++) { - ushort glyphIndex = typeface.CharacterToGlyphMap[text[i]]; + if (!typeface.CharacterToGlyphMap.TryGetValue(text[i], out ushort glyphIndex)) { + text = text.Substring(0, i) + text.Substring(i + 1); + i--; + continue; + } glyphIndexes.Add(glyphIndex); double width = typeface.AdvanceWidths[glyphIndex] * size; advanceWidths.Add(width);