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

FontEditor+LibGfx: Allow user to specify if a specific glyph is present

This replaces the glyph width spinbox in the font editor with a
checkbox when editing fixed width fonts that indicates if the
currently selected character's glyph is present in the edited font
(For variable width fonts a non zero width implies presence)

This commit also changes the background color of glyphs in the glyph
map based on the presence of each specific glyph in the font.
This commit is contained in:
Idan Horowitz 2021-04-18 21:12:52 +03:00 committed by Andreas Kling
parent 08d1b16a8d
commit 18ae37439a
5 changed files with 33 additions and 8 deletions

View file

@ -107,7 +107,7 @@ void GlyphMapWidget::paint_event(GUI::PaintEvent& event)
painter.add_clip_rect(event.rect());
painter.set_font(font());
painter.fill_rect(widget_inner_rect(), palette().base());
painter.fill_rect(widget_inner_rect(), palette().inactive_window_title());
for (int glyph = 0; glyph < m_glyph_count; ++glyph) {
Gfx::IntRect outer_rect = get_outer_rect(glyph);
@ -119,7 +119,8 @@ void GlyphMapWidget::paint_event(GUI::PaintEvent& event)
if (glyph == m_selected_glyph) {
painter.fill_rect(outer_rect, is_focused() ? palette().selection() : palette().inactive_selection());
painter.draw_glyph(inner_rect.location(), glyph, is_focused() ? palette().selection_text() : palette().inactive_selection_text());
} else {
} else if (m_font->contains_glyph(glyph)) {
painter.fill_rect(outer_rect, palette().base());
painter.draw_glyph(inner_rect.location(), glyph, palette().base_text());
}
}