diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2021-09-21 17:43:29 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-22 21:35:42 +0200 |
commit | 144d32d5374989417ccabd9ccfb88ff9cf1856d2 (patch) | |
tree | a876eca795bbe15b7ddbc0b7b4c9eb2dcb50d519 /Userland | |
parent | 0a4640e89226f7278c9bc58caae7086da374668d (diff) | |
download | serenity-144d32d5374989417ccabd9ccfb88ff9cf1856d2.zip |
FontEditor: Sanitize RTL and control glyphs in Clipboard metadata
Fixes display issues in ClipboardHistory.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/FontEditor/GlyphEditorWidget.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Userland/Applications/FontEditor/GlyphEditorWidget.cpp b/Userland/Applications/FontEditor/GlyphEditorWidget.cpp index 9274cf6f8b..0471d6582c 100644 --- a/Userland/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Userland/Applications/FontEditor/GlyphEditorWidget.cpp @@ -6,6 +6,7 @@ #include "GlyphEditorWidget.h" #include <AK/StringBuilder.h> +#include <AK/UnicodeUtils.h> #include <LibGUI/Clipboard.h> #include <LibGUI/Painter.h> #include <LibGfx/BitmapFont.h> @@ -65,15 +66,12 @@ void GlyphEditorWidget::copy_glyph() } StringBuilder glyph_builder; - if (m_glyph < 128) { - if (m_glyph == 10) - glyph_builder.append("LF"); - else - glyph_builder.append(m_glyph); - } else { - glyph_builder.append(128 | 64 | (m_glyph / 64)); - glyph_builder.append(128 | (m_glyph % 64)); - } + if (AK::UnicodeUtils::is_unicode_control_code_point(m_glyph)) + glyph_builder.append(AK::UnicodeUtils::get_unicode_control_code_point_alias(m_glyph).value()); + else if (Gfx::get_char_bidi_class(m_glyph) == Gfx::BidirectionalClass::STRONG_RTL) + glyph_builder.append_code_point(0xFFFD); + else + glyph_builder.append_code_point(m_glyph); HashMap<String, String> metadata; metadata.set("char", glyph_builder.to_string()); |