🍮 Add custom font support (#43)

* 🍮 Add custom font support

* Revert incorrect change
This commit is contained in:
Jasper Bekkers 2022-11-21 12:36:18 +01:00 committed by GitHub
parent 425f741982
commit 6249b0e037
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}