summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2021-11-20 03:00:58 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-20 12:56:35 +0100
commit8d80d1346dc4d8dca9d8045071c8bacaafe78f06 (patch)
treeac947223fbcdf189003023c939f6e0847dd332c7 /Userland
parent7180813cd452d496f7f06543923b8a4e110e3d8d (diff)
downloadserenity-8d80d1346dc4d8dca9d8045071c8bacaafe78f06.zip
FontEditor: Add ability to copy the selected code point
This makes it easier to preview the current glyph, if it is not easily typable.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/FontEditor/FontEditor.cpp8
-rw-r--r--Userland/Applications/FontEditor/FontEditorWindow.gml18
2 files changed, 26 insertions, 0 deletions
diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp
index 5aa52c189f..0b0bceb810 100644
--- a/Userland/Applications/FontEditor/FontEditor.cpp
+++ b/Userland/Applications/FontEditor/FontEditor.cpp
@@ -116,6 +116,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
auto& rotate_90_button = *find_descendant_of_type_named<GUI::Button>("rotate_90");
auto& flip_vertical_button = *find_descendant_of_type_named<GUI::Button>("flip_vertical");
auto& flip_horizontal_button = *find_descendant_of_type_named<GUI::Button>("flip_horizontal");
+ auto& copy_code_point_button = *find_descendant_of_type_named<GUI::Button>("copy_code_point");
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
m_glyph_editor_container = *find_descendant_of_type_named<GUI::Widget>("glyph_editor_container");
m_left_column_container = *find_descendant_of_type_named<GUI::Widget>("left_column_container");
@@ -347,6 +348,13 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
};
flip_horizontal_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-horizontal.png").release_value_but_fixme_should_propagate_errors());
+ copy_code_point_button.on_click = [&](auto) {
+ StringBuilder glyph_builder;
+ glyph_builder.append_code_point(m_glyph_editor_widget->glyph());
+ GUI::Clipboard::the().set_plain_text(glyph_builder.build());
+ };
+ copy_code_point_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors());
+
GUI::Clipboard::the().on_change = [&](const String& data_type) {
m_paste_action->set_enabled(data_type == "glyph/x-fonteditor");
};
diff --git a/Userland/Applications/FontEditor/FontEditorWindow.gml b/Userland/Applications/FontEditor/FontEditorWindow.gml
index 3a5c24b17a..a3cf68b1ae 100644
--- a/Userland/Applications/FontEditor/FontEditorWindow.gml
+++ b/Userland/Applications/FontEditor/FontEditorWindow.gml
@@ -80,6 +80,13 @@
button_style: "Coolbar"
focus_policy: "TabFocus"
}
+ }
+
+ @GUI::Widget {
+ shrink_to_fit: true
+
+ layout: @GUI::HorizontalBoxLayout {
+ }
@GUI::Button {
name: "rotate_90"
@@ -88,6 +95,17 @@
button_style: "Coolbar"
focus_policy: "TabFocus"
}
+
+ @GUI::Widget {
+ }
+
+ @GUI::Button {
+ name: "copy_code_point"
+ fixed_width: 22
+ tooltip: "Copy this codepoint (not glyph)"
+ button_style: "Coolbar"
+ focus_policy: "TabFocus"
+ }
}
}
}