prehnite_core/font/
widget.rs1#![doc = "フォントに関連するicedウィジェット"]
2use iced::{widget, Font};
3
4pub enum IconFamily {
5 MaterialSymbolsOutlined,
6}
7
8impl From<IconFamily> for Font {
9 fn from(value: IconFamily) -> Self {
10 Font::with_name(match value {
11 IconFamily::MaterialSymbolsOutlined => {
12 crate::font::fonts::material_symbols_outlined::NAME
13 }
14 })
15 }
16}
17
18pub fn material_symbol<'a>(code_point: impl Into<String>) -> widget::Text<'a> {
20 icon(code_point, IconFamily::MaterialSymbolsOutlined)
21}
22
23pub fn icon<'a>(code_point: impl Into<String>, icon_family: IconFamily) -> widget::Text<'a> {
25 iced::widget::text(code_point.into()).font(icon_family)
26}