From f267433455dbc69e771b06dd7c433c90ad978d33 Mon Sep 17 00:00:00 2001 From: jelemux Date: Tue, 20 Oct 2020 01:09:47 +0200 Subject: made it work --- src/pdfgen.rs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/pdfgen.rs') diff --git a/src/pdfgen.rs b/src/pdfgen.rs index 410bb99..0bca467 100644 --- a/src/pdfgen.rs +++ b/src/pdfgen.rs @@ -2,19 +2,24 @@ use genpdf::Element as _; use genpdf::{elements, style, fonts}; pub fn genpdf() -> Vec { - let regular_bytes = include_bytes!("../fonts/fira-sans.regular.ttf"); - let regular_font_data = fonts::FontData::new(regular_bytes.to_vec(), None).expect("font data should be correct"); + let regular_bytes = include_bytes!("/usr/share/fonts/liberation/LiberationSans-Regular.ttf"); + let regular_font_data = fonts::FontData::new(regular_bytes.to_vec(), Some(printpdf::BuiltinFont::Helvetica)).expect("font data should be correct"); - let bold_bytes = include_bytes!("../fonts/fira-sans.bold.ttf"); - let bold_font_data = fonts::FontData::new(bold_bytes.to_vec(), None).expect("font data should be correct"); + let bold_bytes = include_bytes!("/usr/share/fonts/liberation/LiberationSans-Bold.ttf"); + let bold_font_data = fonts::FontData::new(bold_bytes.to_vec(), Some(printpdf::BuiltinFont::HelveticaBold)).expect("font data should be correct"); - let italic_bytes = include_bytes!("../fonts/fira-sans.italic.ttf"); - let italic_font_data = fonts::FontData::new(italic_bytes.to_vec(), None).expect("font data should be correct"); + let italic_bytes = include_bytes!("/usr/share/fonts/liberation/LiberationSans-Italic.ttf"); + let italic_font_data = fonts::FontData::new(italic_bytes.to_vec(), Some(printpdf::BuiltinFont::HelveticaOblique)).expect("font data should be correct"); - let bold_italic_bytes = include_bytes!("../fonts/fira-sans.bold-italic.ttf"); - let bold_italic_font_data = fonts::FontData::new(bold_italic_bytes.to_vec(), None).expect("font data should be correct"); + let bold_italic_bytes = include_bytes!("/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf"); + let bold_italic_font_data = fonts::FontData::new(bold_italic_bytes.to_vec(), Some(printpdf::BuiltinFont::HelveticaBoldOblique)).expect("font data should be correct"); - let font_family = fonts::FontFamily{ regular: regular_font_data, bold: bold_font_data, italic: italic_font_data, bold_italic: bold_italic_font_data }; + let font_family = fonts::FontFamily{ + regular: regular_font_data, + bold: bold_font_data, + italic: italic_font_data, + bold_italic: bold_italic_font_data + }; let mut doc = genpdf::Document::new(font_family); -- cgit v1.2.3