2022-12-06 16:12:59 +01:00
|
|
|
// Copyright 2022 System76 <info@system76.com>
|
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
2023-08-15 10:51:59 +02:00
|
|
|
//! Select preferred fonts.
|
|
|
|
|
|
2022-09-30 09:35:55 -06:00
|
|
|
pub use iced::Font;
|
2023-05-30 12:03:15 -04:00
|
|
|
use iced::{
|
|
|
|
|
font::{load, Error},
|
|
|
|
|
Command,
|
2022-09-30 09:35:55 -06:00
|
|
|
};
|
2023-05-30 23:46:49 +02:00
|
|
|
use iced_core::font::Family;
|
|
|
|
|
|
2023-09-01 07:16:13 +02:00
|
|
|
pub const DEFAULT: Font = FONT;
|
|
|
|
|
|
2023-05-30 23:46:49 +02:00
|
|
|
pub const FONT: Font = Font {
|
|
|
|
|
family: Family::Name("Fira Sans"),
|
|
|
|
|
weight: iced_core::font::Weight::Normal,
|
|
|
|
|
stretch: iced_core::font::Stretch::Normal,
|
|
|
|
|
monospaced: false,
|
|
|
|
|
};
|
2022-09-30 09:35:55 -06:00
|
|
|
|
2023-05-30 12:03:15 -04:00
|
|
|
pub const FONT_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-Regular.otf");
|
2022-09-30 09:35:55 -06:00
|
|
|
|
2023-05-30 23:46:49 +02:00
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
|
2023-05-30 12:03:15 -04:00
|
|
|
pub const FONT_LIGHT_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-Light.otf");
|
|
|
|
|
|
2023-05-30 23:46:49 +02:00
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
|
2023-05-30 12:03:15 -04:00
|
|
|
pub const FONT_SEMIBOLD_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-SemiBold.otf");
|
|
|
|
|
|
2023-10-30 15:48:03 +01:00
|
|
|
pub const FONT_BOLD: Font = Font {
|
|
|
|
|
family: Family::Name("Fira Sans"),
|
|
|
|
|
weight: iced_core::font::Weight::Bold,
|
|
|
|
|
stretch: iced_core::font::Stretch::Normal,
|
|
|
|
|
monospaced: false,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pub const FONT_BOLD_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-Bold.otf");
|
|
|
|
|
|
2023-09-01 07:16:13 +02:00
|
|
|
pub const FONT_MONO_REGULAR: Font = Font {
|
|
|
|
|
family: Family::Name("Fira Mono"),
|
|
|
|
|
weight: iced_core::font::Weight::Normal,
|
|
|
|
|
stretch: iced_core::font::Stretch::Normal,
|
|
|
|
|
monospaced: true,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
pub const FONT_MONO_REGULAR_DATA: &[u8] = include_bytes!("../res/Fira/FiraMono-Regular.otf");
|
|
|
|
|
|
2023-05-30 12:03:15 -04:00
|
|
|
pub fn load_fonts() -> Command<Result<(), Error>> {
|
|
|
|
|
Command::batch(vec![
|
|
|
|
|
load(FONT_DATA),
|
|
|
|
|
load(FONT_LIGHT_DATA),
|
|
|
|
|
load(FONT_SEMIBOLD_DATA),
|
2023-10-30 15:48:03 +01:00
|
|
|
load(FONT_BOLD_DATA),
|
2023-09-01 07:16:13 +02:00
|
|
|
load(FONT_MONO_REGULAR_DATA),
|
2023-05-30 12:03:15 -04:00
|
|
|
])
|
|
|
|
|
}
|