summaryrefslogtreecommitdiff
path: root/src/export
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-24 00:39:43 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-24 00:41:15 +0200
commit148a06c070e6376e6f86b878d08dfd4f0aef8a73 (patch)
tree7330ecae5fa3dbb79c3bb3ce6a099205ec92d2c9 /src/export
parentd546453880721d7a12ea228e5c1ed6c65b653ca2 (diff)
Switch from state to decorations for underline/strikethrough/overline
Diffstat (limited to 'src/export')
-rw-r--r--src/export/pdf.rs30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/export/pdf.rs b/src/export/pdf.rs
index d613efc3..ee2b026c 100644
--- a/src/export/pdf.rs
+++ b/src/export/pdf.rs
@@ -50,7 +50,7 @@ impl<'a> PdfExporter<'a> {
for frame in frames {
for (_, element) in frame.elements() {
match *element {
- Element::Text(ref shaped) => font_map.insert(shaped.face_id),
+ Element::Text(ref text) => font_map.insert(text.face_id),
Element::Geometry(_, _) => {}
Element::Image(id, _) => {
let img = ctx.images.get(id);
@@ -168,35 +168,35 @@ impl<'a> PdfExporter<'a> {
let y = (page.size.h - pos.y).to_pt() as f32;
match *element {
- Element::Text(ref shaped) => {
- if fill != Some(shaped.fill) {
- write_fill(&mut content, shaped.fill);
- fill = Some(shaped.fill);
+ Element::Text(ref text) => {
+ if fill != Some(text.fill) {
+ write_fill(&mut content, text.fill);
+ fill = Some(text.fill);
}
- let mut text = content.text();
+ let mut text_writer = content.text();
// Then, also check if we need to issue a font switching
// action.
- if face_id != Some(shaped.face_id) || shaped.size != size {
- face_id = Some(shaped.face_id);
- size = shaped.size;
+ if face_id != Some(text.face_id) || text.size != size {
+ face_id = Some(text.face_id);
+ size = text.size;
- let name = format!("F{}", self.font_map.map(shaped.face_id));
- text.font(Name(name.as_bytes()), size.to_pt() as f32);
+ let name = format!("F{}", self.font_map.map(text.face_id));
+ text_writer.font(Name(name.as_bytes()), size.to_pt() as f32);
}
- let face = self.fonts.get(shaped.face_id);
+ let face = self.fonts.get(text.face_id);
// Position the text.
- text.matrix(1.0, 0.0, 0.0, 1.0, x, y);
+ text_writer.matrix(1.0, 0.0, 0.0, 1.0, x, y);
- let mut positioned = text.show_positioned();
+ let mut positioned = text_writer.show_positioned();
let mut adjustment = Em::zero();
let mut encoded = vec![];
// Write the glyphs with kerning adjustments.
- for glyph in &shaped.glyphs {
+ for glyph in &text.glyphs {
adjustment += glyph.x_offset;
if !adjustment.is_zero() {