From abda5e66f6bcbe940337920a4c219099245ec394 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 16 Jan 2024 17:37:51 -0500 Subject: [PATCH] LibPDF: Scale delta_x by horizontal_scaling in Renderer::show_text() While PDFFont::draw_string() already returns a position scaled by horizontal_scaling, the division by text_rendering_matrix.x_scale() (which also contains the scaling factor) undid it. Reapply it. Fixes the horizontal layout of the line "should be the same on all lines: super" in Tests/LibPDF/text.pdf. --- Userland/Libraries/LibPDF/Renderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index d756fa71804..955b8cc7ac7 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -1019,7 +1019,7 @@ PDFErrorOr Renderer::show_text(ByteString const& string) // Update text matrix auto delta_x = end_position.x() - start_position.x(); m_text_rendering_matrix_is_dirty = true; - m_text_matrix.translate(delta_x / text_rendering_matrix.x_scale(), 0.0f); + m_text_matrix.translate(delta_x / text_rendering_matrix.x_scale() * text_state().horizontal_scaling, 0.0f); return {}; }