mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibGfx: Insert pixel and ttf fonts into Typeface structure
This adds a new structure 'Typeface' to the FontDatabase that represents all fonts of the same family and variant. It can contain a list of BitmapFonts with varying size but of the same family and weight or a pointer to a single TTF font for all sizes of this Typeface.
This commit is contained in:
parent
2c4e13f14a
commit
179dba652e
13 changed files with 248 additions and 32 deletions
|
@ -67,7 +67,7 @@ void GlyphEditorWidget::paint_event(GUI::PaintEvent& event)
|
|||
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());
|
||||
|
||||
auto bitmap = font().glyph_bitmap(m_glyph);
|
||||
auto bitmap = font().glyph(m_glyph).glyph_bitmap();
|
||||
|
||||
for (int y = 0; y < font().glyph_height(); ++y) {
|
||||
for (int x = 0; x < font().max_glyph_width(); ++x) {
|
||||
|
@ -101,7 +101,7 @@ void GlyphEditorWidget::draw_at_mouse(const GUI::MouseEvent& event)
|
|||
return;
|
||||
int x = (event.x() - 1) / m_scale;
|
||||
int y = (event.y() - 1) / m_scale;
|
||||
auto bitmap = font().glyph_bitmap(m_glyph);
|
||||
auto bitmap = font().glyph(m_glyph).glyph_bitmap();
|
||||
if (x < 0 || x >= bitmap.width())
|
||||
return;
|
||||
if (y < 0 || y >= bitmap.height())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue