From f3f82f5f2b35f70d2cad934448c7e159aed2a3df Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 16 Feb 2019 18:34:18 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20pdf=20code=20in=20typesetter=20?= =?UTF-8?q?=F0=9F=9A=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pdf.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pdf.rs b/src/pdf.rs index d3616cb9a..14feb2ab7 100644 --- a/src/pdf.rs +++ b/src/pdf.rs @@ -3,7 +3,7 @@ use std::io::{self, Write}; use crate::doc::{Document, DocumentFont}; use pdf::{PdfWriter, Id, Rect, Size, Version, DocumentCatalog, PageTree, - Page, PageData, Resource, Font, FontType, Text, Trailer}; + Page, PageData, Resource, font::Type1Font, Text, Trailer}; /// A type that is a sink for types that can be written conforming @@ -78,8 +78,7 @@ impl WritePdf for W { for font in &doc.fonts { match font { DocumentFont::Builtin(font) => { - writer.write_obj(id, &Font { - subtype: FontType::Type1, + writer.write_obj(id, &Type1Font { base_font: font.name().to_owned(), })?; }, @@ -96,8 +95,8 @@ impl WritePdf for W { let string = &content.0; let mut text = Text::new(); - text.set_font(1, Size::from_points(13.0)) - .move_pos(Size::from_points(108.0), Size::from_points(734.0)) + text.set_font(1, 13.0) + .move_pos(108.0, 734.0) .write_str(&string); writer.write_obj(id, &text.as_stream())?;