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

@ -367,7 +367,8 @@ impl Application for Window {
vec!["Option 1", "Option 2", "Option 3", "Option 4"],
self.pick_list_selected,
Message::PickListSelected,
),
)
.text_size(14.0),
))
.add(settings::item(
"Slider",

View file

@ -225,7 +225,7 @@ impl Window {
}
fn page_title<Message: 'static>(&self, page: Page) -> Element<Message> {
row!(text(page.title()).size(30), horizontal_space(Length::Fill),).into()
row!(text(page.title()).size(28), horizontal_space(Length::Fill),).into()
}
fn is_condensed(&self) -> bool {
@ -245,14 +245,14 @@ impl Window {
column!(
iced::widget::Button::new(row!(
icon("go-previous-symbolic", 16).style(theme::Svg::SymbolicLink),
text(page.title()).size(16),
text(page.title()).size(14),
))
.padding(0)
.style(theme::Button::Link)
// .id(BTN.clone())
.on_press(Message::from(page)),
row!(
text(sub_page.title()).size(30),
text(sub_page.title()).size(28),
horizontal_space(Length::Fill),
),
)
@ -276,8 +276,8 @@ impl Window {
.style(theme::Svg::Symbolic)
.into(),
column!(
text(sub_page.title()).size(18),
text(sub_page.description()).size(12),
text(sub_page.title()).size(14),
text(sub_page.description()).size(10),
)
.spacing(2)
.into(),

2
iced

@ -1 +1 @@
Subproject commit 0f90f49692c1773abe1d161c7e60f6f64f621f2f
Subproject commit cb7f2b566bde194a0aaed869f5f903939a979c03

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)