From 02526cbbb34e5bde7ef5074b5c0cbece8a2c1b53 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Tue, 10 Feb 2015 16:06:25 +0300 Subject: [PATCH] fix underlining --- src/dlangui/graphics/fonts.d | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dlangui/graphics/fonts.d b/src/dlangui/graphics/fonts.d index 553ba2b3..cf06bb52 100644 --- a/src/dlangui/graphics/fonts.d +++ b/src/dlangui/graphics/fonts.d @@ -377,6 +377,9 @@ class Font : RefCountedObject { dchar ch = text[i]; uint color = i < charProps.length ? charProps[i].color : charProps[$ - 1].color; customizedTextFlags = (i < charProps.length ? charProps[i].textFlags : charProps[$ - 1].textFlags) | textFlags; + // turn off underline after hot key + if (!(customizedTextFlags & TextFlag.Underline)) + underline = false; if (ch == '&' && (textFlags & (TextFlag.UnderlineHotKeys | TextFlag.HotKeys | TextFlag.UnderlineHotKeysWhenAltPressed))) { if (textFlags & (TextFlag.UnderlineHotKeys | TextFlag.UnderlineHotKeysWhenAltPressed)) underline = true; // turn ON underline for hot key @@ -393,9 +396,9 @@ class Font : RefCountedObject { // draw underline if (xx2 > xx) buf.fillRect(Rect(x + xx, underlineY, x + xx2, underlineY + underlineHeight), color); - // turn off underline after hot key - if (!(customizedTextFlags & TextFlag.Underline)) - underline = false; + // turn off underline after hot key + if (!(customizedTextFlags & TextFlag.Underline)) + underline = false; } if (ch == ' ' || ch == '\t')