From 85abefbc5668d42c0d23735a4ce157ee8659c88b Mon Sep 17 00:00:00 2001 From: tpart <10518520-tpart@users.noreply.gitlab.com> Date: Sun, 15 Jan 2023 12:38:42 +0100 Subject: Use cantarell font --- server/src/frontend/style/cantarell.woff2 | Bin 0 -> 93888 bytes server/src/frontend/style/layout.css | 9 ++++++--- server/src/frontend/style/mod.rs | 21 ++++++++++++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 server/src/frontend/style/cantarell.woff2 (limited to 'server/src/frontend') diff --git a/server/src/frontend/style/cantarell.woff2 b/server/src/frontend/style/cantarell.woff2 new file mode 100644 index 0000000..76fd894 Binary files /dev/null and b/server/src/frontend/style/cantarell.woff2 differ diff --git a/server/src/frontend/style/layout.css b/server/src/frontend/style/layout.css index 4418903..0612a7e 100644 --- a/server/src/frontend/style/layout.css +++ b/server/src/frontend/style/layout.css @@ -1,8 +1,11 @@ -@import url("https://s.metamuffin.org/static/font-ubuntu/include.css"); +@font-face { + font-family: 'Cantarell'; + src: url(/assets/cantarell.woff2) format('woff2'); +} * { color: white; - font-family: "Ubuntu", sans-serif; + font-family: "Cantarell", sans-serif; font-weight: 300; margin: 0px; padding: 0px; @@ -39,4 +42,4 @@ nav h1 { padding: 1em; color: rgb(255, 117, 117); font-family: monospace; -} +} \ No newline at end of file diff --git a/server/src/frontend/style/mod.rs b/server/src/frontend/style/mod.rs index 9d0729e..1e51d10 100644 --- a/server/src/frontend/style/mod.rs +++ b/server/src/frontend/style/mod.rs @@ -1,2 +1,21 @@ +use std::{fs::{File, read_to_string}, io::Read}; -pub const CSS_BUNDLE: &'static str = include_str!("layout.css"); + + +pub fn css_bundle() -> String { + if cfg!(debug_assertions) { + read_to_string("server/src/frontend/style/layout.css").unwrap() + } else { + include_str!("layout.css").to_string() + } +} + +pub fn font_bundle() -> Vec { + if cfg!(debug_assertions) { + let mut woff = Vec::new(); + File::open("server/src/frontend/style/cantarell.woff2").unwrap().read_to_end(&mut woff).unwrap(); + woff + } else { + include_bytes!("cantarell.woff2").to_vec() + } +} -- cgit v1.2.3-70-g09d2