diff options
Diffstat (limited to 'src/pdfgen.rs')
-rw-r--r-- | src/pdfgen.rs | 23 |
1 files changed, 14 insertions, 9 deletions
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<u8> { - 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); |