tauri_plugin_system_symbols/lib.rs
1//! System symbol SVG path provider for Tauri.
2//!
3//! The plugin exposes a small command surface and keeps platform-specific
4//! symbol extraction behind `platform` modules.
5
6pub use error::{Error, Result};
7pub use models::{FillRule, Path};
8use tauri::{
9 plugin::{Builder, TauriPlugin},
10 Runtime,
11};
12
13mod commands;
14mod error;
15mod models;
16mod platform;
17
18/// Initializes the plugin. Register it with `tauri::Builder::plugin(init())`.
19pub fn init<R: Runtime>() -> TauriPlugin<R> {
20 Builder::new("system-symbols")
21 .invoke_handler(tauri::generate_handler![commands::get_symbol])
22 .build()
23}
24
25/// Resolves one platform system symbol into SVG path data.
26///
27/// On Windows, the value is resolved as a Segoe Fluent Icons glyph or
28/// codepoint. On macOS, the value is resolved as a copied SF Symbol character.
29pub fn get_symbol(symbol: impl AsRef<str>, size: f32) -> Result<Vec<Path>> {
30 platform::resolve_symbol(symbol.as_ref(), size)
31}