From bf92c9b59c0bcc1d4a2ac1761dfd3fd913987987 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 13 Jan 2024 14:10:23 -0500 Subject: [PATCH] Fix text matrix computation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we were doing: Trm = CTM × Tm × Tsm instead of: Trm = Tsm × Tm × CTM --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a77fe2d..2db60c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1190,14 +1190,15 @@ fn show_text(gs: &mut GraphicsState, s: &[u8], output.begin_word()?; for (c, length) in font.char_codes(s) { + // 5.3.3 Text Space Details let tsm = Transform2D::row_major(ts.horizontal_scaling, 0., 0., 1.0, 0., ts.rise); - let trm = ts.tm.pre_transform(&gs.ctm); - let trm = trm.post_transform(&tsm); + // Trm = Tsm × Tm × CTM + let trm = tsm.post_transform(&ts.tm.post_transform(&gs.ctm)); //dlog!("ctm: {:?} tm {:?}", gs.ctm, tm); //dlog!("current pos: {:?}", position); // 5.9 Extraction of Text Content