mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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
Notes:
sideshowbarker
2024-07-17 04:32:07 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/470d1d8dcf Pull-request: https://github.com/SerenityOS/serenity/pull/22819 Reviewed-by: https://github.com/AtkinsSJ
@ -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…
Reference in New Issue
Block a user