//! 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 codepoint for the role. pub(crate) fn glyph(role: IconRole) -> Option { let codepoint = match role { IconRole::Check => 0xE73E, // CheckMark IconRole::Close => 0xE8BB, // ChromeClose IconRole::ChevronDown => 0xE70D, // ChevronDown IconRole::ChevronLeft => 0xE76B, // ChevronLeft IconRole::ChevronRight => 0xE76C, // ChevronRight IconRole::ChevronUp => 0xE70E, // ChevronUp IconRole::Plus => 0xE710, // Add IconRole::Minus => 0xE738, // Remove IconRole::Search => 0xE721, // Search IconRole::Folder => 0xE8B7, // Folder IconRole::Warning => 0xE7BA, // Warning IconRole::Info => 0xE946, // Info }; char::from_u32(codepoint) } /// 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_to_a_codepoint() { for role in crate::IconRole::all() { assert!(glyph(*role).is_some(), "missing codepoint for {role:?}"); } } #[test] fn the_close_role_uses_the_chrome_close_glyph() { assert_eq!(glyph(IconRole::Close), Some('\u{E8BB}')); } }