How to use multiple Phosphor variants
mainSince all Phosphor variants share the same codepoints, only one variant can be the default fallback for the Proportional font. To use multiple variants (e.g., Regular and Fill):
- Add the primary variant using
add_to_fonts(this sets it as the fallback). - Add additional variants using
add_as_family. - Access additional variants using their specific
richhelper or by selecting the family.
Example with subsetting:
egui_phosphor::subset! {
pub mod icons {
use regular::{GEAR, HOUSE};
use fill::{GEAR, HEART};
}
}
icons::regular::add_to_fonts(&mut fonts);
icons::fill::add_as_family(&mut fonts);
// Using the fallback variant:
ui.label(format!("{} Settings", icons::regular::GEAR));
// Using an additional variant via the rich helper:
ui.label(icons::fill::rich(format!("{} Favourite", icons::fill::HEART)));