Ver código fonte

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.
Matthew Olsson 3 anos atrás
pai
commit
4d509ff365
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      Userland/Libraries/LibPDF/Renderer.cpp

+ 1 - 1
Userland/Libraries/LibPDF/Renderer.cpp

@@ -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;