appearance fixes
- query for emoji fonts - add more font sizes Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
colors::{desktop_dark_color_theme, light_color_theme, mobile_dark_color_theme, ColorTheme},
|
colors::{desktop_dark_color_theme, light_color_theme, mobile_dark_color_theme, ColorTheme},
|
||||||
|
fonts::NamedFontFamily,
|
||||||
ui::is_narrow,
|
ui::is_narrow,
|
||||||
};
|
};
|
||||||
use egui::{
|
use egui::{
|
||||||
@@ -90,6 +91,7 @@ pub fn desktop_font_size(text_style: &NotedeckTextStyle) -> f32 {
|
|||||||
NotedeckTextStyle::Heading => 48.0,
|
NotedeckTextStyle::Heading => 48.0,
|
||||||
NotedeckTextStyle::Heading2 => 24.0,
|
NotedeckTextStyle::Heading2 => 24.0,
|
||||||
NotedeckTextStyle::Heading3 => 20.0,
|
NotedeckTextStyle::Heading3 => 20.0,
|
||||||
|
NotedeckTextStyle::Heading4 => 14.0,
|
||||||
NotedeckTextStyle::Body => 16.0,
|
NotedeckTextStyle::Body => 16.0,
|
||||||
NotedeckTextStyle::Monospace => 13.0,
|
NotedeckTextStyle::Monospace => 13.0,
|
||||||
NotedeckTextStyle::Button => 13.0,
|
NotedeckTextStyle::Button => 13.0,
|
||||||
@@ -104,6 +106,7 @@ pub fn mobile_font_size(text_style: &NotedeckTextStyle) -> f32 {
|
|||||||
NotedeckTextStyle::Heading => 48.0,
|
NotedeckTextStyle::Heading => 48.0,
|
||||||
NotedeckTextStyle::Heading2 => 24.0,
|
NotedeckTextStyle::Heading2 => 24.0,
|
||||||
NotedeckTextStyle::Heading3 => 20.0,
|
NotedeckTextStyle::Heading3 => 20.0,
|
||||||
|
NotedeckTextStyle::Heading4 => 14.0,
|
||||||
NotedeckTextStyle::Body => 13.0,
|
NotedeckTextStyle::Body => 13.0,
|
||||||
NotedeckTextStyle::Monospace => 13.0,
|
NotedeckTextStyle::Monospace => 13.0,
|
||||||
NotedeckTextStyle::Button => 13.0,
|
NotedeckTextStyle::Button => 13.0,
|
||||||
@@ -125,6 +128,7 @@ pub enum NotedeckTextStyle {
|
|||||||
Heading,
|
Heading,
|
||||||
Heading2,
|
Heading2,
|
||||||
Heading3,
|
Heading3,
|
||||||
|
Heading4,
|
||||||
Body,
|
Body,
|
||||||
Monospace,
|
Monospace,
|
||||||
Button,
|
Button,
|
||||||
@@ -138,6 +142,7 @@ impl NotedeckTextStyle {
|
|||||||
Self::Heading => TextStyle::Heading,
|
Self::Heading => TextStyle::Heading,
|
||||||
Self::Heading2 => TextStyle::Name("Heading2".into()),
|
Self::Heading2 => TextStyle::Name("Heading2".into()),
|
||||||
Self::Heading3 => TextStyle::Name("Heading3".into()),
|
Self::Heading3 => TextStyle::Name("Heading3".into()),
|
||||||
|
Self::Heading4 => TextStyle::Name("Heading4".into()),
|
||||||
Self::Body => TextStyle::Body,
|
Self::Body => TextStyle::Body,
|
||||||
Self::Monospace => TextStyle::Monospace,
|
Self::Monospace => TextStyle::Monospace,
|
||||||
Self::Button => TextStyle::Button,
|
Self::Button => TextStyle::Button,
|
||||||
@@ -151,6 +156,7 @@ impl NotedeckTextStyle {
|
|||||||
Self::Heading => FontFamily::Proportional,
|
Self::Heading => FontFamily::Proportional,
|
||||||
Self::Heading2 => FontFamily::Proportional,
|
Self::Heading2 => FontFamily::Proportional,
|
||||||
Self::Heading3 => FontFamily::Proportional,
|
Self::Heading3 => FontFamily::Proportional,
|
||||||
|
Self::Heading4 => FontFamily::Proportional,
|
||||||
Self::Body => FontFamily::Proportional,
|
Self::Body => FontFamily::Proportional,
|
||||||
Self::Monospace => FontFamily::Monospace,
|
Self::Monospace => FontFamily::Monospace,
|
||||||
Self::Button => FontFamily::Proportional,
|
Self::Button => FontFamily::Proportional,
|
||||||
@@ -228,3 +234,13 @@ pub fn create_themed_visuals(theme: ColorTheme, default: Visuals) -> Visuals {
|
|||||||
..default
|
..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())
|
||||||
|
}
|
||||||
|
|||||||
10
src/fonts.rs
10
src/fonts.rs
@@ -5,6 +5,7 @@ use tracing::debug;
|
|||||||
pub enum NamedFontFamily {
|
pub enum NamedFontFamily {
|
||||||
Medium,
|
Medium,
|
||||||
Bold,
|
Bold,
|
||||||
|
Emoji,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NamedFontFamily {
|
impl NamedFontFamily {
|
||||||
@@ -12,6 +13,7 @@ impl NamedFontFamily {
|
|||||||
match self {
|
match self {
|
||||||
Self::Bold => "bold",
|
Self::Bold => "bold",
|
||||||
Self::Medium => "medium",
|
Self::Medium => "medium",
|
||||||
|
Self::Emoji => "emoji",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +126,9 @@ pub fn setup_fonts(ctx: &egui::Context) {
|
|||||||
mono.extend(base_fonts.clone());
|
mono.extend(base_fonts.clone());
|
||||||
|
|
||||||
let mut bold = vec!["OnestBold".to_owned()];
|
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::Proportional, proportional);
|
||||||
families.insert(egui::FontFamily::Monospace, mono);
|
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()),
|
egui::FontFamily::Name(NamedFontFamily::Bold.as_str().into()),
|
||||||
bold,
|
bold,
|
||||||
);
|
);
|
||||||
|
families.insert(
|
||||||
|
egui::FontFamily::Name(NamedFontFamily::Emoji.as_str().into()),
|
||||||
|
emoji,
|
||||||
|
);
|
||||||
|
|
||||||
debug!("fonts: {:?}", families);
|
debug!("fonts: {:?}", families);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user