mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:57:36 +00:00
FontEditor: Update the glyph map when changing a glyph's width.
This commit is contained in:
parent
f5c295ecc5
commit
b980c32662
2 changed files with 3 additions and 4 deletions
|
@ -108,6 +108,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_
|
||||||
width_spinbox->on_change = [this, update_demo] (int value) {
|
width_spinbox->on_change = [this, update_demo] (int value) {
|
||||||
m_edited_font->set_glyph_width(m_glyph_map_widget->selected_glyph(), value);
|
m_edited_font->set_glyph_width(m_glyph_map_widget->selected_glyph(), value);
|
||||||
m_glyph_editor_widget->update();
|
m_glyph_editor_widget->update();
|
||||||
|
m_glyph_map_widget->update_glyph(m_glyph_map_widget->selected_glyph());
|
||||||
update_demo();
|
update_demo();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,12 @@ Rect GlyphMapWidget::get_outer_rect(byte glyph) const
|
||||||
{
|
{
|
||||||
int row = glyph / columns();
|
int row = glyph / columns();
|
||||||
int column = glyph % columns();
|
int column = glyph % columns();
|
||||||
return {
|
return Rect {
|
||||||
column * (font().max_glyph_width() + m_horizontal_spacing) + 1,
|
column * (font().max_glyph_width() + m_horizontal_spacing) + 1,
|
||||||
row * (font().glyph_height() + m_vertical_spacing) + 1,
|
row * (font().glyph_height() + m_vertical_spacing) + 1,
|
||||||
font().max_glyph_width() + m_horizontal_spacing,
|
font().max_glyph_width() + m_horizontal_spacing,
|
||||||
font().glyph_height() + m_horizontal_spacing
|
font().glyph_height() + m_horizontal_spacing
|
||||||
};
|
}.translated(frame_thickness(), frame_thickness());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlyphMapWidget::update_glyph(byte glyph)
|
void GlyphMapWidget::update_glyph(byte glyph)
|
||||||
|
@ -62,8 +62,6 @@ void GlyphMapWidget::paint_event(GPaintEvent& event)
|
||||||
painter.set_font(font());
|
painter.set_font(font());
|
||||||
painter.fill_rect(frame_inner_rect(), Color::White);
|
painter.fill_rect(frame_inner_rect(), Color::White);
|
||||||
|
|
||||||
painter.translate(frame_thickness(), frame_thickness());
|
|
||||||
|
|
||||||
byte glyph = 0;
|
byte glyph = 0;
|
||||||
|
|
||||||
for (int row = 0; row < rows(); ++row) {
|
for (int row = 0; row < rows(); ++row) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue