Skip to main content

repose_material/
lib.rs

1pub mod material3;
2mod symbol;
3pub use symbol::Symbol;
4
5use repose_core::View;
6use repose_ui::{Text, TextStyle};
7
8/// Register a font blob into the global FontSystem.
9pub fn install_material_symbols_font(bytes: &'static [u8]) {
10    repose_text::register_font_data(bytes);
11}
12
13/// Declare a set of Material Symbols by name.
14#[macro_export]
15macro_rules! material_symbols {
16    ( $($name:ident : $ch:literal),* $(,)? ) => {
17        pub struct Symbols;
18        impl Symbols {
19            $(
20                pub const $name: $crate::Symbol =
21                    $crate::Symbol::new(stringify!($name), $ch);
22            )*
23        }
24    };
25}
26
27/// A Material Symbol icon.
28pub fn Icon(symbol: Symbol) -> View {
29    Text(symbol.codepoint.to_string()).font_family("Material Symbols Outlined")
30}