simplify FontDefinitions code
This commit is contained in:
parent
3104b5b689
commit
ec8593b22a
@ -13,6 +13,7 @@ use epi::{Frame, Storage};
|
|||||||
use include_flate::flate;
|
use include_flate::flate;
|
||||||
use instant::Duration;
|
use instant::Duration;
|
||||||
use shadow_rs::shadow;
|
use shadow_rs::shadow;
|
||||||
|
use std::collections::BTreeMap;
|
||||||
use std::ops::{BitXorAssign, RangeInclusive};
|
use std::ops::{BitXorAssign, RangeInclusive};
|
||||||
|
|
||||||
shadow!(build);
|
shadow!(build);
|
||||||
@ -45,25 +46,26 @@ flate!(static EMOJI_FILE: [u8] from "assets/NotoEmoji-Regular.ttf"); // Font use
|
|||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
static ref FONT_DEFINITIONS: FontDefinitions = {
|
static ref FONT_DEFINITIONS: FontDefinitions = {
|
||||||
let mut fonts = FontDefinitions::default();
|
let mut font_data: BTreeMap<String, FontData> = BTreeMap::new();
|
||||||
fonts
|
let mut families = BTreeMap::new();
|
||||||
.font_data
|
|
||||||
.insert("Ubuntu-Light".to_owned(), FontData::from_static(&FONT_FILE));
|
font_data.insert("Ubuntu-Light".to_owned(), FontData::from_static(&FONT_FILE));
|
||||||
|
font_data.insert("NotoEmoji-Regular".to_owned(), FontData::from_static(&EMOJI_FILE));
|
||||||
|
|
||||||
fonts
|
families.insert(
|
||||||
.font_data
|
|
||||||
.insert("NotoEmoji-Regular".to_owned(), FontData::from_static(&EMOJI_FILE));
|
|
||||||
|
|
||||||
fonts.families.insert(
|
|
||||||
FontFamily::Monospace,
|
FontFamily::Monospace,
|
||||||
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()],
|
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()],
|
||||||
);
|
);
|
||||||
|
|
||||||
fonts.families.insert(
|
families.insert(
|
||||||
FontFamily::Proportional,
|
FontFamily::Proportional,
|
||||||
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()],
|
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()],
|
||||||
);
|
);
|
||||||
fonts
|
|
||||||
|
FontDefinitions {
|
||||||
|
font_data,
|
||||||
|
families,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user