//! Windows resolver: each role maps to a Segoe Fluent Icons codepoint, //! rendered as text in the system font (never bundled). use crate::IconRole; /// The Segoe Fluent Icons glyph for the role. pub(crate) fn glyph(role: IconRole) -> Option<&'static str> { let glyph = match role { IconRole::Check => "\u{E73E}", // CheckMark IconRole::Close => "\u{E8BB}", // ChromeClose IconRole::ChevronDown => "\u{E70D}", // ChevronDown IconRole::ChevronLeft => "\u{E76B}", // ChevronLeft IconRole::ChevronRight => "\u{E76C}", // ChevronRight IconRole::ChevronUp => "\u{E70E}", // ChevronUp IconRole::Plus => "\u{E710}", // Add IconRole::Minus => "\u{E738}", // Remove IconRole::Search => "\u{E721}", // Search IconRole::Folder => "\u{E8B7}", // Folder IconRole::Warning => "\u{E7BA}", // Warning IconRole::Info => "\u{E946}", // Info IconRole::Copy => "\u{E8C8}", // Copy IconRole::Eye => "\u{E7B3}", // RedEye IconRole::EyeOff => "\u{ED1A}", // Hide IconRole::PanelLeft => "\u{E90C}", // DockLeft IconRole::PanelRight => "\u{E90D}", // DockRight IconRole::WindowMinimize => "\u{E921}", // ChromeMinimize IconRole::WindowMaximize => "\u{E922}", // ChromeMaximize IconRole::WindowRestore => "\u{E923}", // ChromeRestore IconRole::Microphone => "\u{E720}", // Microphone IconRole::Stop => "\u{E71A}", // Stop IconRole::Settings => "\u{E713}", // Settings IconRole::Refresh => "\u{E72C}", // Refresh IconRole::Undo => "\u{E7A7}", // Undo IconRole::Redo => "\u{E7A6}", // Redo IconRole::ZoomIn => "\u{E8A3}", // ZoomIn IconRole::ZoomOut => "\u{E71F}", // ZoomOut IconRole::Trash => "\u{E74D}", // Delete IconRole::Edit => "\u{E70F}", // Edit IconRole::Save => "\u{E74E}", // Save IconRole::Download => "\u{E896}", // Download IconRole::Share => "\u{E72D}", // Share IconRole::Send => "\u{E724}", // Send IconRole::Print => "\u{E749}", // Print IconRole::EnterFullScreen => "\u{E740}", // FullScreen IconRole::ExitFullScreen => "\u{E73F}", // BackToWindow IconRole::Cut => "\u{E8C6}", // Cut IconRole::Paste => "\u{E77F}", // Paste IconRole::Sort => "\u{E8CB}", // Sort IconRole::Home => "\u{E80F}", // Home IconRole::Menu => "\u{E700}", // GlobalNavButton IconRole::More => "\u{E712}", // More IconRole::Grid => "\u{ECA5}", // Tiles IconRole::List => "\u{EA37}", // List IconRole::File => "\u{E8A5}", // Document IconRole::Image => "\u{E8B9}", // Picture IconRole::Calendar => "\u{E787}", // Calendar IconRole::Clock => "\u{E917}", // Clock IconRole::User => "\u{E77B}", // Contact IconRole::Lock => "\u{E72E}", // Lock IconRole::Unlock => "\u{E785}", // Unlock IconRole::Star => "\u{E734}", // FavoriteStar IconRole::Heart => "\u{EB51}", // Heart IconRole::Pin => "\u{E718}", // Pin IconRole::Mail => "\u{E715}", // Mail IconRole::Link => "\u{E71B}", // Link IconRole::Play => "\u{E768}", // Play IconRole::Pause => "\u{E769}", // Pause IconRole::Help => "\u{E897}", // Help IconRole::Volume => "\u{E767}", // Volume IconRole::VolumeMuted => "\u{E74F}", // Mute IconRole::AlignLeft => "\u{E8E4}", // AlignLeft IconRole::AlignCenter => "\u{E8E3}", // AlignCenter IconRole::AlignRight => "\u{E8E2}", // AlignRight IconRole::Sun => "\u{E706}", // Brightness IconRole::Moon => "\u{E708}", // QuietHours // No Segoe spinner glyph, the icon falls back to the bundled SVG. IconRole::Loader => return None, }; Some(glyph) } /// The system font the codepoints resolve against (Windows 11+). pub(crate) const FONT_FAMILY: &str = "Segoe Fluent Icons"; #[cfg(test)] mod tests { use super::*; #[test] fn every_role_maps_a_codepoint_or_falls_back_to_the_bundled_svg() { for role in crate::IconRole::all() { assert!( glyph(*role).is_some() || crate::asset_bytes(role.asset_path()).is_some(), "no Segoe codepoint or bundled asset for {role:?}" ); } } }