FontEditor: Set width on copy only if source glyph is present

Fixes empty glyphs copying as present in fixed-width fonts.
This commit is contained in:
thankyouverycool 2022-03-18 09:51:20 -04:00 committed by Andreas Kling
parent 212817ea20
commit cdd1bc64f6
Notes: sideshowbarker 2024-07-17 17:01:46 +09:00

View file

@ -905,7 +905,7 @@ void FontEditorWidget::paste_glyphs()
for (size_t i = 0; i < range_bound_glyph_count; ++i) {
auto copyable_width = edited_font().is_fixed_width()
? edited_font().glyph_fixed_width()
? data[bytes_per_copied_glyph * glyph_count + i] ? edited_font().glyph_fixed_width() : 0
: min(edited_font().max_glyph_width(), data[bytes_per_copied_glyph * glyph_count + i]);
memcpy(&rows[i * bytes_per_glyph], &data[i * bytes_per_copied_glyph], copyable_bytes_per_glyph);
memset(&widths[i], copyable_width, sizeof(u8));