Bring in bold font, use in side menu

This commit is contained in:
Mike Dilger 2023-05-08 16:10:04 +12:00
parent 53dd9c913b
commit 87e73032fd
5 changed files with 17 additions and 2 deletions

Binary file not shown.

BIN
fonts/DejaVuSans-Bold.ttf Normal file

Binary file not shown.

View File

@ -26,3 +26,6 @@ Noto Emoji (monochrome) comes from:
CHARS COVERED
NotoEmoji-Regular:
From 1F000 forward, we take these. Therefore strip them from the other fonts.
pyftsubset DejaVuSans-Bold.ttf --unicodes="U+0000-FFFD" --ignore-missing-glyphs --output-file DejaVuSans-Bold-SansEmoji.ttf

View File

@ -38,7 +38,7 @@ use eframe::{egui, IconData};
#[cfg(not(feature = "side-menu"))]
use egui::SelectableLabel;
use egui::{
Color32, ColorImage, Context, Image, ImageData, Label, RichText, Sense,
Color32, ColorImage, Context, FontFamily, Image, ImageData, Label, RichText, Sense,
TextStyle, TextureHandle, TextureOptions, Ui, Vec2,
};
#[cfg(feature = "video-ffmpeg")]
@ -1148,7 +1148,10 @@ impl GossipUi {
}
fn new_selected_label(&mut self, selected: bool, text: &str ) -> Label {
let rtext = RichText::new(text).color(self.settings.theme.navigation_text_color(selected));
let mut rtext = RichText::new(text).color(self.settings.theme.navigation_text_color(selected));
if selected {
rtext = rtext.family(FontFamily::Name("Bold".into()));
}
Label::new(rtext).sense(Sense::click())
}

View File

@ -350,6 +350,10 @@ pub(super) fn font_definitions() -> FontDefinitions {
"DejaVuSans".to_owned(),
FontData::from_static(include_bytes!("../../../fonts/DejaVuSansSansEmoji.ttf")),
);
font_data.insert(
"DejaVuSansBold".to_owned(),
FontData::from_static(include_bytes!("../../../fonts/DejaVuSans-Bold-SansEmoji.ttf")),
);
if cfg!(feature = "lang-cjk") {
font_data.insert(
@ -395,6 +399,11 @@ pub(super) fn font_definitions() -> FontDefinitions {
vec!["Inconsolata".to_owned(), "NotoEmoji-Regular".to_owned()],
);
families.insert(
FontFamily::Name("Bold".into()),
vec!["DejaVuSansBold".to_owned()]
);
FontDefinitions {
font_data,
families,