Skip to content

Commit

Permalink
Fix text matrix computation
Browse files Browse the repository at this point in the history
Previously we were doing:

 Trm = CTM × Tm × Tsm

instead of:

 Trm = Tsm × Tm × CTM
  • Loading branch information
jrmuizel committed Jan 13, 2024
1 parent 7f079a7 commit bf92c9b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bf92c9b

Please sign in to comment.