Are variable fonts supported? #1862
-
Hi! let mut fonts = FontDefinitions::default();
// Install my own font (maybe supporting non-latin characters):
fonts.font_data.insert("my_font".to_owned(),
FontData::from_static(include_bytes!("../../fonts/Ubuntu-Light.ttf"))); // .ttf and .otf supported If I have a font that has bold, semibold, etc built into 1 file does egui support loading those styles from that file?
Or should I be creating separate font families from separate ttf files?
Or is there a better configuration to support things like different font weights? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
ah I think I found the answer to my own question :) Line 25 in 0571bf6 /// How to select a sized font.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct FontId {
/// Height in points.
pub size: f32,
/// What font family to use.
pub family: FontFamily,
// TODO: weight (bold), italics, …
} |
Beta Was this translation helpful? Give feedback.
-
If there are several font faces in one file, you can use |
Beta Was this translation helpful? Give feedback.
If there are several font faces in one file, you can use
FontData::index
to select the one you want.