summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Olsson <matthewcolsson@gmail.com>2022-03-24 11:14:31 -0700
committerAndreas Kling <kling@serenityos.org>2022-03-31 18:10:45 +0200
commit8224ca61506b806e3ea983c554731307497d6ff7 (patch)
tree25e5db7a5cf8c5be10c556dfd44365c6fa0bd6a1
parent34efc668d28213fc8e29bcc93839033623b88b7f (diff)
downloadserenity-8224ca61506b806e3ea983c554731307497d6ff7.zip
LibPDF: Fix more bad Renderer text positioning calculations
-rw-r--r--Userland/Libraries/LibPDF/Renderer.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp
index 01b0034636..ed280c4afb 100644
--- a/Userland/Libraries/LibPDF/Renderer.cpp
+++ b/Userland/Libraries/LibPDF/Renderer.cpp
@@ -387,10 +387,8 @@ RENDERER_HANDLER(text_set_rise)
RENDERER_HANDLER(text_next_line_offset)
{
Gfx::AffineTransform transform(1.0f, 0.0f, 0.0f, 1.0f, args[0].to_float(), args[1].to_float());
- transform.multiply(m_text_line_matrix);
- m_text_matrix = transform;
- m_text_line_matrix = transform;
- m_text_rendering_matrix_is_dirty = true;
+ m_text_line_matrix.multiply(transform);
+ m_text_matrix = m_text_line_matrix;
return {};
}
@@ -668,7 +666,7 @@ void Renderer::show_text(String const& string, float shift)
// Update text matrix
auto delta_x = glyph_position.x() - original_position.x();
m_text_rendering_matrix_is_dirty = true;
- m_text_matrix = Gfx::AffineTransform(1, 0, 0, 1, delta_x, 0).multiply(m_text_matrix);
+ m_text_matrix.translate(delta_x / text_rendering_matrix.x_scale(), 0.0f);
}
PDFErrorOr<NonnullRefPtr<ColorSpace>> Renderer::get_color_space(Value const& value)