fix: incorrect font weights, sizes, line heights
This commit is contained in:
parent
f06a81ccf9
commit
31f7e97d5b
8 changed files with 37 additions and 21 deletions
|
|
@ -367,7 +367,8 @@ impl Application for Window {
|
||||||
vec!["Option 1", "Option 2", "Option 3", "Option 4"],
|
vec!["Option 1", "Option 2", "Option 3", "Option 4"],
|
||||||
self.pick_list_selected,
|
self.pick_list_selected,
|
||||||
Message::PickListSelected,
|
Message::PickListSelected,
|
||||||
),
|
)
|
||||||
|
.text_size(14.0),
|
||||||
))
|
))
|
||||||
.add(settings::item(
|
.add(settings::item(
|
||||||
"Slider",
|
"Slider",
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn page_title<Message: 'static>(&self, page: Page) -> Element<Message> {
|
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 {
|
fn is_condensed(&self) -> bool {
|
||||||
|
|
@ -245,14 +245,14 @@ impl Window {
|
||||||
column!(
|
column!(
|
||||||
iced::widget::Button::new(row!(
|
iced::widget::Button::new(row!(
|
||||||
icon("go-previous-symbolic", 16).style(theme::Svg::SymbolicLink),
|
icon("go-previous-symbolic", 16).style(theme::Svg::SymbolicLink),
|
||||||
text(page.title()).size(16),
|
text(page.title()).size(14),
|
||||||
))
|
))
|
||||||
.padding(0)
|
.padding(0)
|
||||||
.style(theme::Button::Link)
|
.style(theme::Button::Link)
|
||||||
// .id(BTN.clone())
|
// .id(BTN.clone())
|
||||||
.on_press(Message::from(page)),
|
.on_press(Message::from(page)),
|
||||||
row!(
|
row!(
|
||||||
text(sub_page.title()).size(30),
|
text(sub_page.title()).size(28),
|
||||||
horizontal_space(Length::Fill),
|
horizontal_space(Length::Fill),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
@ -276,8 +276,8 @@ impl Window {
|
||||||
.style(theme::Svg::Symbolic)
|
.style(theme::Svg::Symbolic)
|
||||||
.into(),
|
.into(),
|
||||||
column!(
|
column!(
|
||||||
text(sub_page.title()).size(18),
|
text(sub_page.title()).size(14),
|
||||||
text(sub_page.description()).size(12),
|
text(sub_page.description()).size(10),
|
||||||
)
|
)
|
||||||
.spacing(2)
|
.spacing(2)
|
||||||
.into(),
|
.into(),
|
||||||
|
|
|
||||||
2
iced
2
iced
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0f90f49692c1773abe1d161c7e60f6f64f621f2f
|
Subproject commit cb7f2b566bde194a0aaed869f5f903939a979c03
|
||||||
25
src/font.rs
25
src/font.rs
|
|
@ -6,14 +6,33 @@ use iced::{
|
||||||
font::{load, Error},
|
font::{load, Error},
|
||||||
Command,
|
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_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_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 const FONT_SEMIBOLD_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-SemiBold.otf");
|
||||||
|
|
||||||
pub fn load_fonts() -> Command<Result<(), Error>> {
|
pub fn load_fonts() -> Command<Result<(), Error>> {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ use crate::{theme, Element};
|
||||||
use apply::Apply;
|
use apply::Apply;
|
||||||
use derive_setters::Setters;
|
use derive_setters::Setters;
|
||||||
use iced::{self, widget, Length};
|
use iced::{self, widget, Length};
|
||||||
use iced_core::renderer::BorderRadius;
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
@ -99,7 +98,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
|
||||||
std::mem::swap(&mut title, &mut self.title);
|
std::mem::swap(&mut title, &mut self.title);
|
||||||
|
|
||||||
super::text(title)
|
super::text(title)
|
||||||
.size(18)
|
.size(16)
|
||||||
.font(crate::font::FONT_SEMIBOLD)
|
.font(crate::font::FONT_SEMIBOLD)
|
||||||
.apply(widget::container)
|
.apply(widget::container)
|
||||||
.center_x()
|
.center_x()
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ where
|
||||||
font_active: None,
|
font_active: None,
|
||||||
font_hovered: None,
|
font_hovered: None,
|
||||||
font_inactive: None,
|
font_inactive: None,
|
||||||
font_size: 17.0,
|
font_size: 14.0,
|
||||||
icon_size: 16,
|
icon_size: 16,
|
||||||
height: Length::Shrink,
|
height: Length::Shrink,
|
||||||
width: Length::Fill,
|
width: Length::Fill,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ pub fn item<'a, Message: 'static>(
|
||||||
widget: impl Into<Element<'a, Message>>,
|
widget: impl Into<Element<'a, Message>>,
|
||||||
) -> Row<'a, Message, Renderer> {
|
) -> Row<'a, Message, Renderer> {
|
||||||
item_row(vec![
|
item_row(vec![
|
||||||
text(title).size(20).into(),
|
text(title).into(),
|
||||||
horizontal_space(iced::Length::Fill).into(),
|
horizontal_space(iced::Length::Fill).into(),
|
||||||
widget.into(),
|
widget.into(),
|
||||||
])
|
])
|
||||||
|
|
@ -65,12 +65,12 @@ impl<'a, Message: 'static> Item<'a, Message> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(description) = self.description {
|
if let Some(description) = self.description {
|
||||||
let title = text(self.title).size(20);
|
let title = text(self.title);
|
||||||
let desc = text(description).size(14);
|
let desc = text(description).size(10);
|
||||||
|
|
||||||
contents.push(column!(title, desc).spacing(2).into());
|
contents.push(column!(title, desc).spacing(2).into());
|
||||||
} else {
|
} else {
|
||||||
contents.push(text(self.title).size(20).into());
|
contents.push(text(self.title).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
contents.push(horizontal_space(iced::Length::Fill).into());
|
contents.push(horizontal_space(iced::Length::Fill).into());
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,7 @@ impl<'a, Message: 'static> Section<'a, Message> {
|
||||||
|
|
||||||
impl<'a, Message: 'static> From<Section<'a, Message>> for Element<'a, Message> {
|
impl<'a, Message: 'static> From<Section<'a, Message>> for Element<'a, Message> {
|
||||||
fn from(data: Section<'a, Message>) -> Self {
|
fn from(data: Section<'a, Message>) -> Self {
|
||||||
let title = text(data.title)
|
let title = text(data.title).font(crate::font::FONT_SEMIBOLD).into();
|
||||||
.size(20)
|
|
||||||
.font(crate::font::FONT_SEMIBOLD)
|
|
||||||
.into();
|
|
||||||
|
|
||||||
column(vec![title, data.children.into_element()])
|
column(vec![title, data.children.into_element()])
|
||||||
.spacing(8)
|
.spacing(8)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue