LibPDF: Scale delta_x by horizontal_scaling in Renderer::show_text()

While PDFFont::draw_string() already returns a position scaled by
horizontal_scaling, the division by text_rendering_matrix.x_scale()
(which also contains the scaling factor) undid it. Reapply it.

Fixes the horizontal layout of the line
"should be the same on all lines: super" in Tests/LibPDF/text.pdf.
This commit is contained in:
Nico Weber 2024-01-16 17:37:51 -05:00 committed by Andreas Kling
parent 470d1d8dcf
commit abda5e66f6
Notes: sideshowbarker 2024-07-17 20:33:50 +09:00

View file

@ -1019,7 +1019,7 @@ PDFErrorOr<void> Renderer::show_text(ByteString const& string)
// Update text matrix
auto delta_x = end_position.x() - start_position.x();
m_text_rendering_matrix_is_dirty = true;
m_text_matrix.translate(delta_x / text_rendering_matrix.x_scale(), 0.0f);
m_text_matrix.translate(delta_x / text_rendering_matrix.x_scale() * text_state().horizontal_scaling, 0.0f);
return {};
}