1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

FontEditor: Support flipping and rotating

This is especially useful for highly symmetric scripts like this:
https://www.unicode.org/charts/PDF/U1400.pdf
This commit is contained in:
Ben Wiederhake 2021-11-20 02:38:24 +01:00 committed by Andreas Kling
parent 1dfb3ff4eb
commit 7180813cd4
4 changed files with 138 additions and 2 deletions

View file

@ -113,6 +113,9 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
auto& toolbar = *find_descendant_of_type_named<GUI::Toolbar>("toolbar");
auto& glyph_map_container = *find_descendant_of_type_named<GUI::Widget>("glyph_map_container");
auto& move_glyph_button = *find_descendant_of_type_named<GUI::Button>("move_glyph_button");
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");
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");
@ -329,6 +332,21 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::BitmapFont>&&
};
move_glyph_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/selection-move.png").release_value_but_fixme_should_propagate_errors());
rotate_90_button.on_click = [&](auto) {
m_glyph_editor_widget->rotate_90();
};
rotate_90_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-cw.png").release_value_but_fixme_should_propagate_errors());
flip_vertical_button.on_click = [&](auto) {
m_glyph_editor_widget->flip_vertically();
};
flip_vertical_button.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-flip-vertical.png").release_value_but_fixme_should_propagate_errors());
flip_horizontal_button.on_click = [&](auto) {
m_glyph_editor_widget->flip_horizontally();
};
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());
GUI::Clipboard::the().on_change = [&](const String& data_type) {
m_paste_action->set_enabled(data_type == "glyph/x-fonteditor");
};