fix: incorrect font weights, sizes, line heights

This commit is contained in:
Michael Aaron Murphy 2023-05-30 23:46:49 +02:00 committed by Michael Murphy
parent f06a81ccf9
commit 31f7e97d5b
8 changed files with 37 additions and 21 deletions

View file

@ -6,14 +6,33 @@ use iced::{
font::{load, Error},
Command,
};
use iced_core::font::Family;
pub const FONT: Font = Font {
family: Family::Name("Fira Sans"),
weight: iced_core::font::Weight::Normal,
stretch: iced_core::font::Stretch::Normal,
monospaced: false,
};
pub const FONT: Font = Font::with_name("Fira Sans Regular");
pub const FONT_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-Regular.otf");
pub const FONT_LIGHT: Font = Font::with_name("Fira Sans Light");
pub const FONT_LIGHT: Font = Font {
family: Family::Name("Fira Sans"),
weight: iced_core::font::Weight::Light,
stretch: iced_core::font::Stretch::Normal,
monospaced: false,
};
pub const FONT_LIGHT_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-Light.otf");
pub const FONT_SEMIBOLD: Font = Font::with_name("Fira Sans SemiBold");
pub const FONT_SEMIBOLD: Font = Font {
family: Family::Name("Fira Sans"),
weight: iced_core::font::Weight::Semibold,
stretch: iced_core::font::Stretch::Normal,
monospaced: false,
};
pub const FONT_SEMIBOLD_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-SemiBold.otf");
pub fn load_fonts() -> Command<Result<(), Error>> {

View file

@ -5,7 +5,6 @@ use crate::{theme, Element};
use apply::Apply;
use derive_setters::Setters;
use iced::{self, widget, Length};
use iced_core::renderer::BorderRadius;
use std::borrow::Cow;
#[must_use]
@ -99,7 +98,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
std::mem::swap(&mut title, &mut self.title);
super::text(title)
.size(18)
.size(16)
.font(crate::font::FONT_SEMIBOLD)
.apply(widget::container)
.center_x()

View file

@ -147,7 +147,7 @@ where
font_active: None,
font_hovered: None,
font_inactive: None,
font_size: 17.0,
font_size: 14.0,
icon_size: 16,
height: Length::Shrink,
width: Length::Fill,

View file

@ -15,7 +15,7 @@ pub fn item<'a, Message: 'static>(
widget: impl Into<Element<'a, Message>>,
) -> Row<'a, Message, Renderer> {
item_row(vec![
text(title).size(20).into(),
text(title).into(),
horizontal_space(iced::Length::Fill).into(),
widget.into(),
])
@ -65,12 +65,12 @@ impl<'a, Message: 'static> Item<'a, Message> {
}
if let Some(description) = self.description {
let title = text(self.title).size(20);
let desc = text(description).size(14);
let title = text(self.title);
let desc = text(description).size(10);
contents.push(column!(title, desc).spacing(2).into());
} else {
contents.push(text(self.title).size(20).into());
contents.push(text(self.title).into());
}
contents.push(horizontal_space(iced::Length::Fill).into());

View file

@ -31,10 +31,7 @@ impl<'a, Message: 'static> Section<'a, Message> {
impl<'a, Message: 'static> From<Section<'a, Message>> for Element<'a, Message> {
fn from(data: Section<'a, Message>) -> Self {
let title = text(data.title)
.size(20)
.font(crate::font::FONT_SEMIBOLD)
.into();
let title = text(data.title).font(crate::font::FONT_SEMIBOLD).into();
column(vec![title, data.children.into_element()])
.spacing(8)