feat: configurable fonts

This commit is contained in:
Michael Aaron Murphy 2024-10-03 21:27:06 +02:00 committed by Michael Murphy
parent e645dee2f0
commit 9e064e7fa0
20 changed files with 143 additions and 124 deletions

View file

@ -156,9 +156,7 @@ impl<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static>
cursor: mouse::Cursor,
viewport: &Rectangle,
) {
let font = self
.font
.unwrap_or_else(|| text::Renderer::default_font(renderer));
let font = self.font.unwrap_or_else(|| crate::font::default());
draw(
renderer,
@ -275,7 +273,7 @@ pub fn layout(
bounds: Size::new(f32::MAX, f32::MAX),
size: iced::Pixels(text_size),
line_height: text_line_height,
font: font.unwrap_or_else(|| text::Renderer::default_font(renderer)),
font: font.unwrap_or_else(|| crate::font::default()),
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top,
shaping: text::Shaping::Advanced,
@ -418,7 +416,7 @@ pub fn overlay<'a, S: AsRef<str>, Message: 'a, Item: Clone + PartialEq + 'static
bounds: Size::new(f32::MAX, f32::MAX),
size: iced::Pixels(text_size),
line_height,
font: font.unwrap_or_else(|| text::Renderer::default_font(renderer)),
font: font.unwrap_or_else(|| crate::font::default()),
horizontal_alignment: alignment::Horizontal::Left,
vertical_alignment: alignment::Vertical::Top,
shaping: text::Shaping::Advanced,