From cdd1bc64f69a1a78789c95c8c23943d2b8a7fa87 Mon Sep 17 00:00:00 2001 From: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> Date: Fri, 18 Mar 2022 09:51:20 -0400 Subject: [PATCH] FontEditor: Set width on copy only if source glyph is present Fixes empty glyphs copying as present in fixed-width fonts. --- Userland/Applications/FontEditor/FontEditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Applications/FontEditor/FontEditor.cpp b/Userland/Applications/FontEditor/FontEditor.cpp index b69057b8be..d121f1d25d 100644 --- a/Userland/Applications/FontEditor/FontEditor.cpp +++ b/Userland/Applications/FontEditor/FontEditor.cpp @@ -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));