summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2021-11-24 07:16:57 -0500
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-11-24 16:05:40 +0330
commit781bc67a96065cceacf2bb34d14c7f0b782ab50d (patch)
treea65c3dd21b087e6aec2429e79a0d71187a99bc52 /Userland/Libraries/LibGfx
parent78724fdd33dad520da7570a8189104edb22d752b (diff)
downloadserenity-781bc67a96065cceacf2bb34d14c7f0b782ab50d.zip
LibGfx: Correct BitmapFont row indexing when un/masking fonts
Now indexes by total bytes per glyph to account for changes made to row's pointer type in 3ca00c8. Fixes glyphs not showing and saving correctly in FontEditor.
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r--Userland/Libraries/LibGfx/BitmapFont.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGfx/BitmapFont.cpp b/Userland/Libraries/LibGfx/BitmapFont.cpp
index c7db009236..d7d55e0dd6 100644
--- a/Userland/Libraries/LibGfx/BitmapFont.cpp
+++ b/Userland/Libraries/LibGfx/BitmapFont.cpp
@@ -76,7 +76,7 @@ NonnullRefPtr<BitmapFont> BitmapFont::unmasked_character_set() const
auto index = glyph_index(code_point);
if (index.has_value()) {
memcpy(&new_widths[code_point], &m_glyph_widths[index.value()], 1);
- memcpy(&new_rows[code_point * glyph_height()], &m_rows[index.value() * glyph_height()], bytes_per_glyph);
+ memcpy(&new_rows[code_point * bytes_per_glyph], &m_rows[index.value() * bytes_per_glyph], bytes_per_glyph);
}
}
return adopt_ref(*new BitmapFont(m_name, m_family, new_rows, new_widths, m_fixed_width, m_glyph_width, m_glyph_height, m_glyph_spacing, s_max_range_mask_size, new_range_mask, m_baseline, m_mean_line, m_presentation_size, m_weight, m_slope, true));
@@ -107,7 +107,7 @@ NonnullRefPtr<BitmapFont> BitmapFont::masked_character_set() const
continue;
}
memcpy(&new_widths[i - j * 256], &m_glyph_widths[i], 1);
- memcpy(&new_rows[(i - j * 256) * glyph_height()], &m_rows[i * glyph_height()], bytes_per_glyph);
+ memcpy(&new_rows[(i - j * 256) * bytes_per_glyph], &m_rows[i * bytes_per_glyph], bytes_per_glyph);
}
return adopt_ref(*new BitmapFont(m_name, m_family, new_rows, new_widths, m_fixed_width, m_glyph_width, m_glyph_height, m_glyph_spacing, new_range_mask_size, new_range_mask, m_baseline, m_mean_line, m_presentation_size, m_weight, m_slope, true));
}