Write PDF interword spaces with actual device fonts
This commit is contained in:
1 parent
b93d5f55da
commit
514a2d3344
24 files changed
+664
-65
No files matched your search
@@ -128,6 +128,11 @@ pub enum DisplayItem {
|
||||
y: i64,
|
||||
operation: crate::pdf_device::PdfGraphics,
|
||||
},
|
||||
PdfTextSpace {
|
||||
x: i64,
|
||||
y: i64,
|
||||
operation: crate::pdf_device::text_spaces::SpaceOperation,
|
||||
},
|
||||
Special(String),
|
||||
}
|
||||
|
||||
@@ -247,6 +252,8 @@ pub struct DisplayList {
|
||||
pub units: DisplayUnits,
|
||||
pub pdf: Option<crate::pdf_device::PdfPageData>,
|
||||
pub pdf_links: crate::pdf_device::links::PageLinks,
|
||||
pub pdf_text_spaces: Option<crate::pdf_device::text_spaces::SpaceSettings>,
|
||||
pub pdf_space_plan: Option<crate::pdf_device::text_spaces::SpacePlan>,
|
||||
pub pdf_resources: crate::pdf_device::page_resources::PageResources,
|
||||
}
|
||||
impl Default for DisplayList {
|
||||
@@ -261,6 +268,8 @@ impl Default for DisplayList {
|
||||
units: DisplayUnits::PostScript,
|
||||
pdf: None,
|
||||
pdf_links: Default::default(),
|
||||
pdf_text_spaces: None,
|
||||
pdf_space_plan: None,
|
||||
pdf_resources: Default::default(),
|
||||
}
|
||||
}
|
||||
@@ -322,7 +331,10 @@ impl DisplayList {
|
||||
&& self.items.iter().zip(&other.items).all(|(left, right)| {
|
||||
match (left.native_svg_glyph(), right.native_svg_glyph()) {
|
||||
(Some(Ok(left)), Some(Ok(right))) => left == right,
|
||||
(None, None) => left == right,
|
||||
(None, None) => {
|
||||
left == right || matches!((left, right),
|
||||
(DisplayItem::PdfTextSpace { .. }, DisplayItem::PdfTextSpace { .. }))
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
})
|
||||
@@ -376,6 +388,7 @@ impl DisplayList {
|
||||
| DisplayItem::Image { x, y, .. }
|
||||
| DisplayItem::PdfImage { x, y, .. }
|
||||
| DisplayItem::PdfGraphics { x, y, .. }
|
||||
| DisplayItem::PdfTextSpace { x, y, .. }
|
||||
| DisplayItem::Link { x, y, .. } => {
|
||||
*x += dx;
|
||||
*y += dy;
|
||||
@@ -634,7 +647,7 @@ impl DisplayList {
|
||||
*thickness as f64 / 65_536.0
|
||||
));
|
||||
}
|
||||
DisplayItem::Link { .. } => {}
|
||||
DisplayItem::Link { .. } | DisplayItem::PdfTextSpace { .. } => {}
|
||||
DisplayItem::Special(content) => {
|
||||
out.push_str(&format!(
|
||||
"<!-- special: {} -->
|
||||
|
||||
Reference in new issue
Block a user