Implement XeTeX OpenType slant and transformed PDF text positioning
This commit is contained in:
1 parent
330ecdd03c
commit
45ea5d4297
6 files changed
+152
-44
No files matched your search
@@ -409,9 +409,14 @@ impl SourceMap {
|
||||
let scale = |value: i64| value * size / font.size;
|
||||
let ascent = scale(font.ascent);
|
||||
let descent = scale(font.descent);
|
||||
let [_, slant] = font.paint_transform();
|
||||
let top_offset = slant * ascent as f64;
|
||||
let bottom_offset = -slant * descent as f64;
|
||||
let left = top_offset.min(bottom_offset).floor() as i64;
|
||||
let right = top_offset.max(bottom_offset).ceil() as i64;
|
||||
Some((PaintKind::OpenTypeGlyph { font: font.id.index(), glyph: *glyph }, Bounds {
|
||||
x: x + advance.min(&0), y: y - ascent,
|
||||
width: advance.abs(), height: ascent + descent,
|
||||
x: x + advance.min(&0) + left, y: y - ascent,
|
||||
width: advance.abs() + right - left, height: ascent + descent,
|
||||
}))
|
||||
}
|
||||
DisplayItem::Rule {
|
||||
|
||||
Reference in new issue
Block a user