From 7165dbce5c6686110d480a7b0520eb2c4f87aadc Mon Sep 17 00:00:00 2001 From: Itamar Date: Sat, 24 Sep 2022 16:33:56 +0300 Subject: [PATCH] LibGfx: Fix affine transformations in TrueType composite glyphs This fixes an issue where, when looping over the components of a composite glyph, we used to mutate the affine transformation of the glyph itself when computing the transformations of its components. (AffineTransform::multiply() is non-const). --- Userland/Libraries/LibGfx/Font/TrueType/Glyf.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/Font/TrueType/Glyf.h b/Userland/Libraries/LibGfx/Font/TrueType/Glyf.h index 153334680b..04cf16fa19 100644 --- a/Userland/Libraries/LibGfx/Font/TrueType/Glyf.h +++ b/Userland/Libraries/LibGfx/Font/TrueType/Glyf.h @@ -105,7 +105,7 @@ public: RefPtr rasterize_simple(i16 ascender, i16 descender, float x_scale, float y_scale) const; template - void rasterize_composite_loop(Rasterizer& rasterizer, Gfx::AffineTransform& transform, GlyphCb glyph_callback) const + void rasterize_composite_loop(Rasterizer& rasterizer, Gfx::AffineTransform const& transform, GlyphCb glyph_callback) const { ComponentIterator component_iterator(m_slice); @@ -115,7 +115,8 @@ public: break; } auto item = opt_item.value(); - auto affine_here = transform.multiply(item.affine); + Gfx::AffineTransform affine_here { transform }; + affine_here.multiply(item.affine); Glyph glyph = glyph_callback(item.glyph_id); if (glyph.m_type == Type::Simple) {