Skip to main content

repose_material/
lib.rs

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