From 75aaebccc2aedc97767b9d208142c586eaf33544 Mon Sep 17 00:00:00 2001 From: meli <57847713+ff-meli@users.noreply.github.com> Date: Wed, 22 Apr 2020 15:01:57 -0700 Subject: [PATCH] switch italics to payloads instead of raw bytes - this is actually messier until the rest of chat there is moved to SeString, but this at least removes some random raw hex. Once more string support is in, the rest can probably be ported as well --- Dalamud/Game/ChatHandlers.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dalamud/Game/ChatHandlers.cs b/Dalamud/Game/ChatHandlers.cs index e10047ff5..aa4811b50 100644 --- a/Dalamud/Game/ChatHandlers.cs +++ b/Dalamud/Game/ChatHandlers.cs @@ -224,8 +224,16 @@ namespace Dalamud.Game { } private static string MakeItalics(string text) { - return Encoding.UTF8.GetString(new byte[] {0x02, 0x1A, 0x02, 0x02, 0x03}) + text + - Encoding.UTF8.GetString(new byte[] {0x02, 0x1A, 0x02, 0x01, 0x03}); + // TODO: when the above code is switched to SeString, this can be a straight insertion of the + // italics payloads only, and be a lot cleaner + var italicString = new SeString(new List(new Payload[] + { + EmphasisItalicPayload.ItalicsOn, + new TextPayload(text), + EmphasisItalicPayload.ItalicsOff + })); + + return Encoding.UTF8.GetString(italicString.Encode()); } } }