From df5451a889b561d54e774e27d418d35253738537 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 10 Jan 2024 09:45:23 -0500 Subject: [PATCH] LibPDF: Mark text rendering matrix dirty after changing it in text_begin A certain PDF was drawing some text used `9 0 0 9 474.54 700.6801 Tm` to set the text matrix to a matrix that scaled by 9 in one text object. Then, after ending that text object, it had the following new text object which contained nothing that invalidated the text matrix: ``` BT /F1 7 Tf /DeviceRGB CS 0 0 0 SC 10 TL 86.37849 21.908 Td (Authorized licensed use limited to: ...) Tj ET ``` `BT` did reset it as required, but since we didn't mark the matrix as dirty, we never recomputed it and drew the additional text scaled up 9x. --- 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 0c22f9171b..88f1b3e0f9 100644 --- a/Userland/Libraries/LibPDF/Renderer.cpp +++ b/Userland/Libraries/LibPDF/Renderer.cpp @@ -416,6 +416,7 @@ RENDERER_HANDLER(text_begin) { m_text_matrix = Gfx::AffineTransform(); m_text_line_matrix = Gfx::AffineTransform(); + m_text_rendering_matrix_is_dirty = true; return {}; }