Register virtual fonts in native PDF shipout order
This commit is contained in:
1 parent
b008c0693a
commit
614f09aa9b
11 files changed
+708
-139
No files matched your search
@@ -21,6 +21,8 @@ pub struct NativeShipout {
|
||||
pub device: ShipoutDevice,
|
||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||
pub(super) font_overrides: BTreeMap<FontId, Arc<crate::native_font::NativeFont>>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub(super) virtual_glyphs: Option<crate::native_font::VirtualGlyphs>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub(super) pdf_color_start: Vec<Arc<PdfColorProgram>>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
@@ -53,6 +55,7 @@ impl NativeShipout {
|
||||
) -> Result<crate::render::DisplayList, String> {
|
||||
let mut page = crate::render::DisplayList {
|
||||
width: self.device.page_width,
|
||||
prepared_virtual_glyphs: self.virtual_glyphs.as_ref().map(|_| BTreeMap::new()),
|
||||
height: self.device.page_height,
|
||||
magnification: self.device.magnification,
|
||||
units: crate::render::DisplayUnits::TeX,
|
||||
@@ -134,14 +137,18 @@ impl NativeShipout {
|
||||
size,
|
||||
character,
|
||||
..
|
||||
} => DisplayItem::NativeGlyph {
|
||||
x,
|
||||
y,
|
||||
size,
|
||||
font: self.font_overrides.get(&font.id).cloned().unwrap_or(font),
|
||||
slot,
|
||||
character,
|
||||
paint: None,
|
||||
} => {
|
||||
if let Some(packet) = self.virtual_glyphs.as_ref()
|
||||
.and_then(|fonts| fonts.get(&font.id))
|
||||
.and_then(|glyphs| glyphs.get(&slot))
|
||||
{
|
||||
page.prepared_virtual_glyphs.as_mut().unwrap()
|
||||
.insert(page.items.len(), packet.clone());
|
||||
}
|
||||
DisplayItem::NativeGlyph {
|
||||
x, y, size, slot, character, paint: None,
|
||||
font: self.font_overrides.get(&font.id).cloned().unwrap_or(font),
|
||||
}
|
||||
},
|
||||
MathItem::Rule { width, height } => DisplayItem::Rule {
|
||||
x,
|
||||
|
||||
Reference in new issue
Block a user