mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
FontEditor: Add ability to copy the selected code point
This makes it easier to preview the current glyph, if it is not easily typable.
This commit is contained in:
parent
7180813cd4
commit
8d80d1346d
2 changed files with 26 additions and 0 deletions
|
@ -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");
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue