feat: helper for loading fonts
This commit is contained in:
parent
0c1396cac3
commit
eb0fcf5278
3 changed files with 19 additions and 15 deletions
27
src/font.rs
27
src/font.rs
|
|
@ -2,23 +2,24 @@
|
|||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
pub use iced::Font;
|
||||
use iced::{
|
||||
font::{load, Error},
|
||||
Command,
|
||||
};
|
||||
|
||||
pub const FONT: Font = Font::with_name("Fira Sans Regular");
|
||||
// pub const FONT: Font = Font::External {
|
||||
// name: "Fira Sans Regular",
|
||||
// bytes: 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::External {
|
||||
// name: "Fira Sans Light",
|
||||
// bytes: 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_DATA: &[u8] = include_bytes!("../res/Fira/FiraSans-SemiBold.otf");
|
||||
|
||||
// pub const FONT_SEMIBOLD: Font = Font::External {
|
||||
// name: "Fira Sans SemiBold",
|
||||
// bytes: include_bytes!("../res/Fira/FiraSans-SemiBold.otf"),
|
||||
// };
|
||||
pub fn load_fonts() -> Command<Result<(), Error>> {
|
||||
Command::batch(vec![
|
||||
load(FONT_DATA),
|
||||
load(FONT_LIGHT_DATA),
|
||||
load(FONT_SEMIBOLD_DATA),
|
||||
])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue