mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
LibPDF: Fix order of parameter, text, and current transform matrix
PDF spec 1.7 5.3.3 Text Space Details gives the correct multiplication order: parameters * textmatrix * ctm. We used to do text * ctm * parameters (AffineTransform::multiply() does left-multiplication). This only matters if `text_state().rise` is non-zero. In practice, it's almost always zero, in which case the paramter matrix is a diagonal matrix that commutes. Fixes the horizontal offset of "super" in Tests/LibPDF/text.pdf.
This commit is contained in:
parent
6c65c18c40
commit
470d1d8dcf
1 changed files with 5 additions and 3 deletions
|
@ -1308,15 +1308,17 @@ Gfx::AffineTransform const& Renderer::calculate_text_rendering_matrix() const
|
|||
{
|
||||
if (m_text_rendering_matrix_is_dirty) {
|
||||
// PDF 1.7, 5.3.3. Text Space Details
|
||||
m_text_rendering_matrix = Gfx::AffineTransform(
|
||||
Gfx::AffineTransform parameter_matrix {
|
||||
text_state().horizontal_scaling,
|
||||
0.0f,
|
||||
0.0f,
|
||||
1.0f,
|
||||
0.0f,
|
||||
text_state().rise);
|
||||
m_text_rendering_matrix.multiply(state().ctm);
|
||||
text_state().rise
|
||||
};
|
||||
m_text_rendering_matrix = state().ctm;
|
||||
m_text_rendering_matrix.multiply(m_text_matrix);
|
||||
m_text_rendering_matrix.multiply(parameter_matrix);
|
||||
m_text_rendering_matrix_is_dirty = false;
|
||||
}
|
||||
return m_text_rendering_matrix;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue