LibPDF: Fix "incorrect" matrix multiplication in Renderer

Incorrect is in quotes because the spec (both 1.7 and 2.0) specify this
multiplication as it was originally! However, flipping the order of
operations here makes the text in all of my test cases render in the
correct position.

The CTM is a transformation matrix between the text coordinate system
and the device coordinate system. However, being on the right-side of
the multiplication means that the CTM scale parameters don't have any
influence on the translation component of the left-side matrix. This
oddity is what originally led to me just trying this change to see if
it worked.
This commit is contained in:
Matthew Olsson 2022-03-06 14:27:04 -07:00 committed by Andreas Kling
parent 6f1cfcf217
commit 4d509ff365
Notes: sideshowbarker 2024-07-17 17:50:33 +09:00

View file

@ -694,8 +694,8 @@ Gfx::AffineTransform const& Renderer::calculate_text_rendering_matrix()
1.0f,
0.0f,
text_state().rise);
m_text_rendering_matrix.multiply(m_text_matrix);
m_text_rendering_matrix.multiply(state().ctm);
m_text_rendering_matrix.multiply(m_text_matrix);
m_text_rendering_matrix_is_dirty = false;
}
return m_text_rendering_matrix;