update to egui 0.30.0
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use egui::{FontData, FontDefinitions, FontTweak};
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::Arc;
|
||||
use tracing::debug;
|
||||
|
||||
use notedeck::fonts::NamedFontFamily;
|
||||
@@ -7,35 +8,35 @@ use notedeck::fonts::NamedFontFamily;
|
||||
// Use gossip's approach to font loading. This includes japanese fonts
|
||||
// for rending stuff from japanese users.
|
||||
pub fn setup_fonts(ctx: &egui::Context) {
|
||||
let mut font_data: BTreeMap<String, FontData> = BTreeMap::new();
|
||||
let mut font_data: BTreeMap<String, Arc<FontData>> = BTreeMap::new();
|
||||
let mut families = BTreeMap::new();
|
||||
|
||||
font_data.insert(
|
||||
"Onest".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestRegular1602-hint.ttf"
|
||||
)),
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"OnestMedium".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestMedium1602-hint.ttf"
|
||||
)),
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"DejaVuSans".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/DejaVuSansSansEmoji.ttf"
|
||||
)),
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"OnestBold".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/onest/OnestBold1602-hint.ttf"
|
||||
)),
|
||||
))),
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -60,43 +61,47 @@ pub fn setup_fonts(ctx: &egui::Context) {
|
||||
|
||||
font_data.insert(
|
||||
"Inconsolata".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/Inconsolata-Regular.ttf"
|
||||
))
|
||||
.tweak(FontTweak {
|
||||
scale: 1.22, // This font is smaller than DejaVuSans
|
||||
y_offset_factor: -0.18, // and too low
|
||||
y_offset: 0.0,
|
||||
baseline_offset_factor: 0.0,
|
||||
}),
|
||||
Arc::new(
|
||||
FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/Inconsolata-Regular.ttf"
|
||||
))
|
||||
.tweak(FontTweak {
|
||||
scale: 1.22, // This font is smaller than DejaVuSans
|
||||
y_offset_factor: -0.18, // and too low
|
||||
y_offset: 0.0,
|
||||
baseline_offset_factor: 0.0,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"NotoSansCJK".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoSansCJK-Regular.ttc"
|
||||
)),
|
||||
))),
|
||||
);
|
||||
|
||||
font_data.insert(
|
||||
"NotoSansThai".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
Arc::new(FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoSansThai-Regular.ttf"
|
||||
)),
|
||||
))),
|
||||
);
|
||||
|
||||
// Some good looking emojis. Use as first priority:
|
||||
font_data.insert(
|
||||
"NotoEmoji".to_owned(),
|
||||
FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoEmoji-Regular.ttf"
|
||||
))
|
||||
.tweak(FontTweak {
|
||||
scale: 1.1, // make them a touch larger
|
||||
y_offset_factor: 0.0,
|
||||
y_offset: 0.0,
|
||||
baseline_offset_factor: 0.0,
|
||||
}),
|
||||
Arc::new(
|
||||
FontData::from_static(include_bytes!(
|
||||
"../../../assets/fonts/NotoEmoji-Regular.ttf"
|
||||
))
|
||||
.tweak(FontTweak {
|
||||
scale: 1.1, // make them a touch larger
|
||||
y_offset_factor: 0.0,
|
||||
y_offset: 0.0,
|
||||
baseline_offset_factor: 0.0,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
let base_fonts = vec![
|
||||
|
||||
@@ -61,5 +61,5 @@ security-framework = "2.11.0"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
profiling = ["puffin", "puffin_egui", "eframe/puffin"]
|
||||
profiling = ["puffin", "puffin_egui"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user