From f23f5dcd62da40d83fd20cb60d951b27ea227460 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Sun, 14 Jan 2024 21:17:12 -0500 Subject: [PATCH] LibPDF: Mark text rendering matrix dirty for Td operator 0000342.pdf page 5 contains this snippet: ``` /T1_1 10.976 Tf 0 -31.643 TD (This)Tj 1 0 0 1 54 745.563 Tm 22.181 -31.643 Td [(vehicle)-270.926(uses)... ``` The `Tm` marked the text rendering matrix as dirty at the start, but it then calls calculate_text_rendering_matrix() almost in the next line, which recalculates the text rendering matrix and caches the new matrix. The `Td` used to not mark it as dirty, and we'd draw "vehicle" with an incorrect matrix. --- Userland/Libraries/LibPDF/Renderer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Userland/Libraries/LibPDF/Renderer.cpp b/Userland/Libraries/LibPDF/Renderer.cpp index 244f3cd94a9..a0fadd8d3b0 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -503,6 +503,7 @@ 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()); m_text_line_matrix.multiply(transform); m_text_matrix = m_text_line_matrix; + m_text_rendering_matrix_is_dirty = true; return {}; }