Shape and render explicit OpenType fonts in native Unicode jobs
This commit is contained in:
1 parent
3caf1eced2
commit
70822cbd94
33 files changed
+1255
-80
No files matched your search
@@ -115,6 +115,7 @@ pub enum PaintKind {
|
||||
#[serde(default, skip_serializing_if = "crate::native_font::unexpanded")]
|
||||
expansion: i32,
|
||||
},
|
||||
OpenTypeGlyph { font: u32, glyph: u16 },
|
||||
Rule,
|
||||
PdfImage { page: usize },
|
||||
}
|
||||
@@ -401,6 +402,14 @@ impl SourceMap {
|
||||
},
|
||||
))
|
||||
}
|
||||
DisplayItem::OpenTypeGlyph { x, y, size, advance, font, glyph, .. } => {
|
||||
let scale = |value: i64| value * size / font.size;
|
||||
let ascent = scale(font.ascent);
|
||||
let descent = scale(font.descent);
|
||||
Some((PaintKind::OpenTypeGlyph { font: font.id.index(), glyph: *glyph }, Bounds {
|
||||
x: *x, y: y - ascent, width: *advance, height: ascent + descent,
|
||||
}))
|
||||
}
|
||||
DisplayItem::Rule {
|
||||
x,
|
||||
y,
|
||||
|
||||
Reference in new issue
Block a user