FontEditor: Draw the baseline in the glyph editor widget

This commit is contained in:
Tibor Nagy 2020-09-20 21:45:21 +02:00 committed by Andreas Kling
parent f0fdbb1d83
commit cba5a69f07
Notes: sideshowbarker 2024-07-19 02:19:06 +09:00
2 changed files with 5 additions and 2 deletions

View file

@ -304,6 +304,7 @@ FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Gfx::Font>&& edite
baseline_spinbox.on_change = [this, update_demo](int value) {
m_edited_font->set_baseline(value);
m_glyph_editor_widget->update();
update_demo();
};

View file

@ -58,8 +58,10 @@ void GlyphEditorWidget::paint_event(GUI::PaintEvent& event)
painter.translate(frame_thickness(), frame_thickness());
painter.translate(-1, -1);
for (int y = 1; y < font().glyph_height(); ++y)
painter.draw_line({ 0, y * m_scale }, { font().max_glyph_width() * m_scale, y * m_scale }, palette().threed_shadow2());
for (int y = 1; y < font().glyph_height(); ++y) {
bool bold_line = (y - 1) == font().baseline();
painter.draw_line({ 0, y * m_scale }, { font().max_glyph_width() * m_scale, y * m_scale }, palette().threed_shadow2(), bold_line ? 2 : 1);
}
for (int x = 1; x < font().max_glyph_width(); ++x)
painter.draw_line({ x * m_scale, 0 }, { x * m_scale, font().glyph_height() * m_scale }, palette().threed_shadow2());