add emoji-icon-font (fixes gear icon)

This commit is contained in:
Simon Gardling
2022-04-12 15:02:38 -04:00
parent 7dfe1cd067
commit 316305b89e
2 changed files with 28 additions and 4 deletions

BIN
assets/emoji-icon-font.ttf Normal file

Binary file not shown.

View File

@@ -74,6 +74,7 @@ lazy_static::lazy_static! {
let mut font_ubuntu_light: Option<FontData> = None; let mut font_ubuntu_light: Option<FontData> = None;
let mut font_notoemoji: Option<FontData> = None; let mut font_notoemoji: Option<FontData> = None;
let mut font_hack: Option<FontData> = None; let mut font_hack: Option<FontData> = None;
let mut font_emoji_icon: Option<FontData> = None;
// Stores text // Stores text
let mut text_data: Option<JsonFileOutput> = None; let mut text_data: Option<JsonFileOutput> = None;
@@ -104,6 +105,15 @@ lazy_static::lazy_static! {
"Ubuntu-Light.ttf" => { "Ubuntu-Light.ttf" => {
font_ubuntu_light = Some(font_data); font_ubuntu_light = Some(font_data);
}, },
"emoji-icon-font.ttf" => {
font_emoji_icon = Some(font_data.tweak(
egui::FontTweak {
scale: 0.8, // make it smaller
y_offset_factor: 0.07, // move it down slightly
y_offset: 0.0,
},
))
}
_ => { _ => {
panic!("Font File {} not expected!", path_string); panic!("Font File {} not expected!", path_string);
} }
@@ -120,17 +130,22 @@ lazy_static::lazy_static! {
let font_data: BTreeMap<String, FontData> = BTreeMap::from([ let font_data: BTreeMap<String, FontData> = BTreeMap::from([
("Hack".to_owned(), font_hack.expect("Hack font not found!")), ("Hack".to_owned(), font_hack.expect("Hack font not found!")),
("Ubuntu-Light".to_owned(), font_ubuntu_light.expect("Ubuntu Light font not found!")), ("Ubuntu-Light".to_owned(), font_ubuntu_light.expect("Ubuntu Light font not found!")),
("NotoEmoji-Regular".to_owned(), font_notoemoji.expect("Noto Emoji font not found!")) ("NotoEmoji-Regular".to_owned(), font_notoemoji.expect("Noto Emoji font not found!")),
("emoji-icon-font".to_owned(), font_emoji_icon.expect("Emoji Icon Font not found!"))
]); ]);
let families = BTreeMap::from([ let families = BTreeMap::from([
(FontFamily::Monospace, (FontFamily::Monospace,
vec![ vec![
"Hack".to_owned(), "Hack".to_owned(),
"Ubuntu-Light".to_owned(), "Ubuntu-Light".to_owned(),
"NotoEmoji-Regular".to_owned(), "NotoEmoji-Regular".to_owned(),
"emoji-icon-font".to_owned(),
]), ]),
(FontFamily::Proportional, (FontFamily::Proportional,
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()]) vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned(),
"emoji-icon-font".to_owned()])
]); ]);
let fonts = FontDefinitions { let fonts = FontDefinitions {
@@ -161,6 +176,10 @@ fn test_file_data() {
"NotoEmoji-Regular".to_owned(), "NotoEmoji-Regular".to_owned(),
FontData::from_owned(include_bytes!("../assets/NotoEmoji-Regular.ttf").to_vec()), FontData::from_owned(include_bytes!("../assets/NotoEmoji-Regular.ttf").to_vec()),
), ),
(
"emoji-icon-font".to_owned(),
FontData::from_owned(include_bytes!("../assets/emoji-icon-font.ttf").to_vec()),
),
]); ]);
let families = BTreeMap::from([ let families = BTreeMap::from([
@@ -170,11 +189,16 @@ fn test_file_data() {
"Hack".to_owned(), "Hack".to_owned(),
"Ubuntu-Light".to_owned(), "Ubuntu-Light".to_owned(),
"NotoEmoji-Regular".to_owned(), "NotoEmoji-Regular".to_owned(),
"emoji-icon-font".to_owned(),
], ],
), ),
( (
FontFamily::Proportional, FontFamily::Proportional,
vec!["Ubuntu-Light".to_owned(), "NotoEmoji-Regular".to_owned()], vec![
"Ubuntu-Light".to_owned(),
"NotoEmoji-Regular".to_owned(),
"emoji-icon-font".to_owned(),
],
), ),
]); ]);
@@ -464,7 +488,7 @@ impl MathApp {
); );
function.settings_opened.bitxor_assign( function.settings_opened.bitxor_assign(
ui.add(Button::new("")) // fix gear icon ui.add(Button::new(""))
.on_hover_text(match function.settings_opened { .on_hover_text(match function.settings_opened {
true => "Close Settings", true => "Close Settings",
false => "Open Settings", false => "Open Settings",