From 7e090ca42f143a0497e04f8d90fe56ce5218e222 Mon Sep 17 00:00:00 2001 From: Aphek Date: Tue, 19 May 2020 03:17:01 -0300 Subject: [PATCH] Also copy font licenses when copy-fonts is enabled --- src/renderer/html_handlebars/hbs_renderer.rs | 3 +++ src/theme/fonts/mod.rs | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 9ebe11aa..8953d3b6 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -181,6 +181,9 @@ impl HtmlHandlebars { )?; if html_config.copy_fonts { write_file(destination, "fonts/fonts.css", theme::fonts::CSS)?; + for (file_name, contents) in theme::fonts::LICENSES.iter() { + write_file(destination, file_name, contents)?; + } for (file_name, contents) in theme::fonts::OPEN_SANS.iter() { write_file(destination, file_name, contents)?; } diff --git a/src/theme/fonts/mod.rs b/src/theme/fonts/mod.rs index 0e0bc4c1..5d2e29cb 100644 --- a/src/theme/fonts/mod.rs +++ b/src/theme/fonts/mod.rs @@ -1,5 +1,16 @@ pub static CSS: &[u8] = include_bytes!("fonts.css"); // An array of (file_name, file_contents) pairs +pub static LICENSES: [(&str, &[u8]); 2] = [ + ( + "fonts/OPEN-SANS-LICENSE.txt", + include_bytes!("OPEN-SANS-LICENSE.txt"), + ), + ( + "fonts/SOURCE-CODE-PRO-LICENSE.txt", + include_bytes!("SOURCE-CODE-PRO-LICENSE.txt"), + ), +]; +// An array of (file_name, file_contents) pairs pub static OPEN_SANS: [(&str, &[u8]); 10] = [ ( "fonts/open-sans-v17-all-charsets-300.woff2",