diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2021-11-29 09:59:25 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-30 10:51:51 +0100 |
commit | c1744822a17601afcd19702d46cf901ec407da05 (patch) | |
tree | 78aeeaa6815ce224fa04f48ad3bba75f865e2d0e /Userland/Applications/FontEditor/GlyphEditorWidget.cpp | |
parent | 281805696bba168defa0cce79ad15673727ec032 (diff) | |
download | serenity-c1744822a17601afcd19702d46cf901ec407da05.zip |
FontEditor: Account for glyph width when pasting
Fixes glyphs not expanding up to their maximum width if necessary
when pasting larger glyphs into smaller ones.
Diffstat (limited to 'Userland/Applications/FontEditor/GlyphEditorWidget.cpp')
-rw-r--r-- | Userland/Applications/FontEditor/GlyphEditorWidget.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Applications/FontEditor/GlyphEditorWidget.cpp b/Userland/Applications/FontEditor/GlyphEditorWidget.cpp index a59298bdef..8c8c935f69 100644 --- a/Userland/Applications/FontEditor/GlyphEditorWidget.cpp +++ b/Userland/Applications/FontEditor/GlyphEditorWidget.cpp @@ -115,8 +115,10 @@ void GlyphEditorWidget::paste_glyph() } auto bitmap = font().raw_glyph(m_glyph).glyph_bitmap(); - for (int x = 0; x < min(bitmap.width(), buffer_width); x++) { - for (int y = 0; y < min(bitmap.height(), buffer_height); y++) { + if (bitmap.width() < buffer_width) + font().set_glyph_width(m_glyph, min(buffer_width, font().max_glyph_width())); + for (int x = 0; x < min(buffer_width, font().max_glyph_width()); x++) { + for (int y = 0; y < min(buffer_height, font().glyph_height()); y++) { bitmap.set_bit_at(x, y, bits[x][y]); } } |