FontEditor: Sanitize RTL and control glyphs in Clipboard metadata
Fixes display issues in ClipboardHistory.
This commit is contained in:
parent
0a4640e892
commit
144d32d537
Notes:
sideshowbarker
2024-07-18 03:33:40 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/144d32d5374 Pull-request: https://github.com/SerenityOS/serenity/pull/10175
1 changed files with 7 additions and 9 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Reference in a new issue