diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-03 02:20:30 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-03 02:20:30 +0100 |
commit | d8a172609c8b5ae327f1dfe8ecb76e87e31a04d1 (patch) | |
tree | 7c3107eea86526a2ae675bab256772f90249e0b8 | |
parent | e97fea31697e01ca3f598d8e89a6fe054cd21e5d (diff) | |
download | serenity-d8a172609c8b5ae327f1dfe8ecb76e87e31a04d1.zip |
FontEditor: Add a grid to the glyph editor widget.
-rw-r--r-- | FontEditor/FontEditor.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/FontEditor/FontEditor.cpp b/FontEditor/FontEditor.cpp index 57dc476678..774129dac6 100644 --- a/FontEditor/FontEditor.cpp +++ b/FontEditor/FontEditor.cpp @@ -150,10 +150,17 @@ void GlyphEditorWidget::paint_event(GPaintEvent&) auto& bitmap = font().glyph_bitmap(m_glyph); + for (int y = 0; y < font().glyph_height(); ++y) + painter.draw_line({ 0, y * m_scale }, { font().glyph_width() * m_scale - 1, y * m_scale }, Color::Black); + + for (int x = 0; x < font().glyph_width(); ++x) + painter.draw_line({ x * m_scale, 0 }, { x * m_scale, font().glyph_height() * m_scale - 1 }, Color::Black); + for (int y = 0; y < font().glyph_height(); ++y) { for (int x = 0; x < font().glyph_width(); ++x) { Rect rect { x * m_scale, y * m_scale, m_scale, m_scale }; - painter.fill_rect(rect, bitmap.bit_at(x, y) ? Color::Black : Color::White); + if (bitmap.bit_at(x, y)) + painter.fill_rect(rect, Color::Black); } } } |