notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 83fe173ba3490df663ba8f729a0c23ccd30f00ca
parent 40a96f1df220a0987e5a7755cf6665a619c1d765
Author: kernelkind <kernelkind@gmail.com>
Date:   Thu,  5 Dec 2024 17:55:37 -0500

appearance fixes

- query for emoji fonts
- add more font sizes

Signed-off-by: kernelkind <kernelkind@gmail.com>

Diffstat:
Msrc/app_style.rs | 16++++++++++++++++
Msrc/fonts.rs | 10+++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/app_style.rs b/src/app_style.rs @@ -1,5 +1,6 @@ use crate::{ colors::{desktop_dark_color_theme, light_color_theme, mobile_dark_color_theme, ColorTheme}, + fonts::NamedFontFamily, ui::is_narrow, }; use egui::{ @@ -90,6 +91,7 @@ pub fn desktop_font_size(text_style: &NotedeckTextStyle) -> f32 { NotedeckTextStyle::Heading => 48.0, NotedeckTextStyle::Heading2 => 24.0, NotedeckTextStyle::Heading3 => 20.0, + NotedeckTextStyle::Heading4 => 14.0, NotedeckTextStyle::Body => 16.0, NotedeckTextStyle::Monospace => 13.0, NotedeckTextStyle::Button => 13.0, @@ -104,6 +106,7 @@ pub fn mobile_font_size(text_style: &NotedeckTextStyle) -> f32 { NotedeckTextStyle::Heading => 48.0, NotedeckTextStyle::Heading2 => 24.0, NotedeckTextStyle::Heading3 => 20.0, + NotedeckTextStyle::Heading4 => 14.0, NotedeckTextStyle::Body => 13.0, NotedeckTextStyle::Monospace => 13.0, NotedeckTextStyle::Button => 13.0, @@ -125,6 +128,7 @@ pub enum NotedeckTextStyle { Heading, Heading2, Heading3, + Heading4, Body, Monospace, Button, @@ -138,6 +142,7 @@ impl NotedeckTextStyle { Self::Heading => TextStyle::Heading, Self::Heading2 => TextStyle::Name("Heading2".into()), Self::Heading3 => TextStyle::Name("Heading3".into()), + Self::Heading4 => TextStyle::Name("Heading4".into()), Self::Body => TextStyle::Body, Self::Monospace => TextStyle::Monospace, Self::Button => TextStyle::Button, @@ -151,6 +156,7 @@ impl NotedeckTextStyle { Self::Heading => FontFamily::Proportional, Self::Heading2 => FontFamily::Proportional, Self::Heading3 => FontFamily::Proportional, + Self::Heading4 => FontFamily::Proportional, Self::Body => FontFamily::Proportional, Self::Monospace => FontFamily::Monospace, Self::Button => FontFamily::Proportional, @@ -228,3 +234,13 @@ pub fn create_themed_visuals(theme: ColorTheme, default: Visuals) -> Visuals { ..default } } + +pub static DECK_ICON_SIZE: f32 = 24.0; + +pub fn deck_icon_font_sized(size: f32) -> FontId { + egui::FontId::new(size, emoji_font_family()) +} + +pub fn emoji_font_family() -> FontFamily { + egui::FontFamily::Name(NamedFontFamily::Emoji.as_str().into()) +} diff --git a/src/fonts.rs b/src/fonts.rs @@ -5,6 +5,7 @@ use tracing::debug; pub enum NamedFontFamily { Medium, Bold, + Emoji, } impl NamedFontFamily { @@ -12,6 +13,7 @@ impl NamedFontFamily { match self { Self::Bold => "bold", Self::Medium => "medium", + Self::Emoji => "emoji", } } @@ -124,7 +126,9 @@ pub fn setup_fonts(ctx: &egui::Context) { mono.extend(base_fonts.clone()); let mut bold = vec!["OnestBold".to_owned()]; - bold.extend(base_fonts); + bold.extend(base_fonts.clone()); + + let emoji = vec!["NotoEmoji".to_owned()]; families.insert(egui::FontFamily::Proportional, proportional); families.insert(egui::FontFamily::Monospace, mono); @@ -136,6 +140,10 @@ pub fn setup_fonts(ctx: &egui::Context) { egui::FontFamily::Name(NamedFontFamily::Bold.as_str().into()), bold, ); + families.insert( + egui::FontFamily::Name(NamedFontFamily::Emoji.as_str().into()), + emoji, + ); debug!("fonts: {:?}", families);