Skip to content

Commit 31f7e97

Browse files
committed
fix: incorrect font weights, sizes, line heights
1 parent f06a81c commit 31f7e97

File tree

8 files changed

+37
-21
lines changed

8 files changed

+37
-21
lines changed

examples/cosmic-sctk/src/window.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ impl Application for Window {
367367
vec!["Option 1", "Option 2", "Option 3", "Option 4"],
368368
self.pick_list_selected,
369369
Message::PickListSelected,
370-
),
370+
)
371+
.text_size(14.0),
371372
))
372373
.add(settings::item(
373374
"Slider",

examples/cosmic/src/window.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl Window {
225225
}
226226

227227
fn page_title<Message: 'static>(&self, page: Page) -> Element<Message> {
228-
row!(text(page.title()).size(30), horizontal_space(Length::Fill),).into()
228+
row!(text(page.title()).size(28), horizontal_space(Length::Fill),).into()
229229
}
230230

231231
fn is_condensed(&self) -> bool {
@@ -245,14 +245,14 @@ impl Window {
245245
column!(
246246
iced::widget::Button::new(row!(
247247
icon("go-previous-symbolic", 16).style(theme::Svg::SymbolicLink),
248-
text(page.title()).size(16),
248+
text(page.title()).size(14),
249249
))
250250
.padding(0)
251251
.style(theme::Button::Link)
252252
// .id(BTN.clone())
253253
.on_press(Message::from(page)),
254254
row!(
255-
text(sub_page.title()).size(30),
255+
text(sub_page.title()).size(28),
256256
horizontal_space(Length::Fill),
257257
),
258258
)
@@ -276,8 +276,8 @@ impl Window {
276276
.style(theme::Svg::Symbolic)
277277
.into(),
278278
column!(
279-
text(sub_page.title()).size(18),
280-
text(sub_page.description()).size(12),
279+
text(sub_page.title()).size(14),
280+
text(sub_page.description()).size(10),
281281
)
282282
.spacing(2)
283283
.into(),

src/font.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,33 @@ use iced::{
66
font::{load, Error},
77
Command,
88
};
9+
use iced_core::font::Family;
10+
11+
pub const FONT: Font = Font {
12+
family: Family::Name("Fira Sans"),
13+
weight: iced_core::font::Weight::Normal,
14+
stretch: iced_core::font::Stretch::Normal,
15+
monospaced: false,
16+
};
917

10-
pub const FONT: Font = Font::with_name("Fira Sans Regular");
1118
pub const FONT_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-Regular.otf");
1219

13-
pub const FONT_LIGHT: Font = Font::with_name("Fira Sans Light");
20+
pub const FONT_LIGHT: Font = Font {
21+
family: Family::Name("Fira Sans"),
22+
weight: iced_core::font::Weight::Light,
23+
stretch: iced_core::font::Stretch::Normal,
24+
monospaced: false,
25+
};
26+
1427
pub const FONT_LIGHT_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-Light.otf");
1528

16-
pub const FONT_SEMIBOLD: Font = Font::with_name("Fira Sans SemiBold");
29+
pub const FONT_SEMIBOLD: Font = Font {
30+
family: Family::Name("Fira Sans"),
31+
weight: iced_core::font::Weight::Semibold,
32+
stretch: iced_core::font::Stretch::Normal,
33+
monospaced: false,
34+
};
35+
1736
pub const FONT_SEMIBOLD_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-SemiBold.otf");
1837

1938
pub fn load_fonts() -> Command<Result<(), Error>> {

src/widget/header_bar.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::{theme, Element};
55
use apply::Apply;
66
use derive_setters::Setters;
77
use iced::{self, widget, Length};
8-
use iced_core::renderer::BorderRadius;
98
use std::borrow::Cow;
109

1110
#[must_use]
@@ -99,7 +98,7 @@ impl<'a, Message: Clone + 'static> HeaderBar<'a, Message> {
9998
std::mem::swap(&mut title, &mut self.title);
10099

101100
super::text(title)
102-
.size(18)
101+
.size(16)
103102
.font(crate::font::FONT_SEMIBOLD)
104103
.apply(widget::container)
105104
.center_x()

src/widget/segmented_button/widget.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ where
147147
font_active: None,
148148
font_hovered: None,
149149
font_inactive: None,
150-
font_size: 17.0,
150+
font_size: 14.0,
151151
icon_size: 16,
152152
height: Length::Shrink,
153153
width: Length::Fill,

src/widget/settings/item.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn item<'a, Message: 'static>(
1515
widget: impl Into<Element<'a, Message>>,
1616
) -> Row<'a, Message, Renderer> {
1717
item_row(vec![
18-
text(title).size(20).into(),
18+
text(title).into(),
1919
horizontal_space(iced::Length::Fill).into(),
2020
widget.into(),
2121
])
@@ -65,12 +65,12 @@ impl<'a, Message: 'static> Item<'a, Message> {
6565
}
6666

6767
if let Some(description) = self.description {
68-
let title = text(self.title).size(20);
69-
let desc = text(description).size(14);
68+
let title = text(self.title);
69+
let desc = text(description).size(10);
7070

7171
contents.push(column!(title, desc).spacing(2).into());
7272
} else {
73-
contents.push(text(self.title).size(20).into());
73+
contents.push(text(self.title).into());
7474
}
7575

7676
contents.push(horizontal_space(iced::Length::Fill).into());

src/widget/settings/section.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ impl<'a, Message: 'static> Section<'a, Message> {
3131

3232
impl<'a, Message: 'static> From<Section<'a, Message>> for Element<'a, Message> {
3333
fn from(data: Section<'a, Message>) -> Self {
34-
let title = text(data.title)
35-
.size(20)
36-
.font(crate::font::FONT_SEMIBOLD)
37-
.into();
34+
let title = text(data.title).font(crate::font::FONT_SEMIBOLD).into();
3835

3936
column(vec![title, data.children.into_element()])
4037
.spacing(8)

0 commit comments

Comments
 (0)