Support XeTeX OpenType vertical shaping and PDF writing mode
This commit is contained in:
1 parent
23ec506fa3
commit
e2af618e65
9 files changed
+481
-44
No files matched your search
@@ -586,10 +586,15 @@ impl DisplayList {
|
||||
let horizontal = scale * extend;
|
||||
// Place the transformed outline in page units before
|
||||
// stroking. The font matrix must not distort the stroke.
|
||||
let transform = (embolden > 0.).then_some([horizontal, scale * slant, -scale]);
|
||||
let vertical = font.is_vertical().then(|| {
|
||||
font.vertical_paint_matrix(face, *glyph, *size as f64 / 65536.)
|
||||
});
|
||||
let transform = (embolden > 0.).then(|| {
|
||||
vertical.unwrap_or([horizontal, 0., scale * slant, -scale, 0., 0.])
|
||||
});
|
||||
let path_size = if transform.is_some() { *size } else { 0 };
|
||||
let path = opentype_paths.entry((font.id, *glyph, path_size))
|
||||
.or_insert_with(|| crate::opentype::outline(face, *glyph, transform));
|
||||
.or_insert_with(|| crate::opentype::outline_matrix(face, *glyph, transform));
|
||||
if !path.is_empty() {
|
||||
use std::fmt::Write as _;
|
||||
write!(
|
||||
@@ -598,7 +603,9 @@ impl DisplayList {
|
||||
escape(&font.name), escape(text),
|
||||
).unwrap();
|
||||
if transform.is_none() {
|
||||
if slant == 0. {
|
||||
if let Some([a, b, c, d, e, f]) = vertical {
|
||||
write!(out, " matrix({a:.9} {b:.9} {c:.9} {d:.9} {e:.9} {f:.9})").unwrap();
|
||||
} else if slant == 0. {
|
||||
write!(out, " scale({horizontal:.9} -{scale:.9})").unwrap();
|
||||
} else {
|
||||
let shear = scale * slant;
|
||||
|
||||
Reference in new issue
Block a user