simplify BTreeMap
This commit is contained in:
parent
1507a0cc85
commit
d577d2f073
@ -117,26 +117,21 @@ lazy_static::lazy_static! {
|
|||||||
|
|
||||||
tracing::info!("Done loading assets! Took: {:?}", start.elapsed());
|
tracing::info!("Done loading assets! Took: {:?}", start.elapsed());
|
||||||
|
|
||||||
let mut font_data: BTreeMap<String, FontData> = BTreeMap::new();
|
let font_data: BTreeMap<String, FontData> = BTreeMap::from([
|
||||||
let mut families = BTreeMap::new();
|
("Hack".to_owned(), font_hack.expect("Hack font not found!")),
|
||||||
|
("Ubuntu-Light".to_owned(), font_ubuntu_light.expect("Ubuntu Light font not found!")),
|
||||||
font_data.insert("Hack".to_owned(), font_hack.expect("Hack font not found!"));
|
("NotoEmoji-Regular".to_owned(), font_notoemoji.expect("Noto Emoji font not found!"))
|
||||||
font_data.insert("Ubuntu-Light".to_owned(), font_ubuntu_light.expect("Ubuntu Light font not found!"));
|
]);
|
||||||
font_data.insert("NotoEmoji-Regular".to_owned(), font_notoemoji.expect("Noto Emoji font not found!"));
|
let families = BTreeMap::from([
|
||||||
|
(FontFamily::Monospace,
|
||||||
families.insert(
|
vec![
|
||||||
FontFamily::Monospace,
|
"Hack".to_owned(),
|
||||||
vec![
|
"Ubuntu-Light".to_owned(),
|
||||||
"Hack".to_owned(),
|
"NotoEmoji-Regular".to_owned(),
|
||||||
"Ubuntu-Light".to_owned(),
|
]),
|
||||||
"NotoEmoji-Regular".to_owned(),
|
(FontFamily::Proportional,
|
||||||
],
|
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()])
|
||||||
);
|
]);
|
||||||
|
|
||||||
families.insert(
|
|
||||||
FontFamily::Proportional,
|
|
||||||
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()],
|
|
||||||
);
|
|
||||||
|
|
||||||
let fonts = FontDefinitions {
|
let fonts = FontDefinitions {
|
||||||
font_data,
|
font_data,
|
||||||
@ -153,35 +148,35 @@ lazy_static::lazy_static! {
|
|||||||
/// Tests to make sure archived (and compressed) assets match expected data
|
/// Tests to make sure archived (and compressed) assets match expected data
|
||||||
#[test]
|
#[test]
|
||||||
fn test_file_data() {
|
fn test_file_data() {
|
||||||
let mut font_data: BTreeMap<String, FontData> = BTreeMap::new();
|
let font_data: BTreeMap<String, FontData> = BTreeMap::from([
|
||||||
let mut families = BTreeMap::new();
|
(
|
||||||
|
|
||||||
font_data.insert(
|
|
||||||
"Hack".to_owned(),
|
|
||||||
FontData::from_owned(include_bytes!("../assets/Hack-Regular.ttf").to_vec()),
|
|
||||||
);
|
|
||||||
font_data.insert(
|
|
||||||
"Ubuntu-Light".to_owned(),
|
|
||||||
FontData::from_owned(include_bytes!("../assets/Ubuntu-Light.ttf").to_vec()),
|
|
||||||
);
|
|
||||||
font_data.insert(
|
|
||||||
"NotoEmoji-Regular".to_owned(),
|
|
||||||
FontData::from_owned(include_bytes!("../assets/NotoEmoji-Regular.ttf").to_vec()),
|
|
||||||
);
|
|
||||||
|
|
||||||
families.insert(
|
|
||||||
FontFamily::Monospace,
|
|
||||||
vec![
|
|
||||||
"Hack".to_owned(),
|
"Hack".to_owned(),
|
||||||
|
FontData::from_owned(include_bytes!("../assets/Hack-Regular.ttf").to_vec()),
|
||||||
|
),
|
||||||
|
(
|
||||||
"Ubuntu-Light".to_owned(),
|
"Ubuntu-Light".to_owned(),
|
||||||
|
FontData::from_owned(include_bytes!("../assets/Ubuntu-Light.ttf").to_vec()),
|
||||||
|
),
|
||||||
|
(
|
||||||
"NotoEmoji-Regular".to_owned(),
|
"NotoEmoji-Regular".to_owned(),
|
||||||
],
|
FontData::from_owned(include_bytes!("../assets/NotoEmoji-Regular.ttf").to_vec()),
|
||||||
);
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
families.insert(
|
let families = BTreeMap::from([
|
||||||
FontFamily::Proportional,
|
(
|
||||||
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()],
|
FontFamily::Monospace,
|
||||||
);
|
vec![
|
||||||
|
"Hack".to_owned(),
|
||||||
|
"Ubuntu-Light".to_owned(),
|
||||||
|
"NotoEmoji-Regular".to_owned(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
(
|
||||||
|
FontFamily::Proportional,
|
||||||
|
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()],
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
let fonts = FontDefinitions {
|
let fonts = FontDefinitions {
|
||||||
font_data,
|
font_data,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user