From 6249b0e03702d795908436de62dae2ece5346c2b Mon Sep 17 00:00:00 2001 From: Jasper Bekkers Date: Mon, 21 Nov 2022 12:36:18 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=AE=20Add=20custom=20font=20support=20?= =?UTF-8?q?(#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🍮 Add custom font support * Revert incorrect change --- src/font/system/no_std.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/font/system/no_std.rs b/src/font/system/no_std.rs index ce12475..fff1308 100644 --- a/src/font/system/no_std.rs +++ b/src/font/system/no_std.rs @@ -16,13 +16,10 @@ pub struct FontSystem{ impl FontSystem { pub fn new() -> Self { - //TODO: get locale from argument? let locale = "en-US".to_string(); - //TODO: allow loading fonts from memory let mut db = fontdb::Database::new(); { - //TODO: configurable default fonts db.set_monospace_family("Fira Mono"); db.set_sans_serif_family("Fira Sans"); db.set_serif_family("DejaVu Serif"); @@ -34,6 +31,13 @@ impl FontSystem { } } + pub fn new_with_locale_and_db(locale: &str, db: fontdb::Database) -> Self { + Self { + locale: locale.to_string(), + db + } + } + pub fn locale(&self) -> &str { &self.locale }