Skip to content

ayangweb/tauri-plugin-system-fonts

Repository files navigation

tauri-plugin-system-fonts

This plugin only works on tauri v2, if you need the v1 plugin, feel free to submit a PR!

Support getting all fonts installed on your system.

Platform Support

Platform Supported
Windows
macOS
Linux
Android
iOS

Install

cargo add tauri-plugin-system-fonts

You can install the JavaScript Guest bindings using your preferred JavaScript package manager:

pnpm add tauri-plugin-system-fonts-api

Usage

src-tauri/src/lib.rs

pub fn run() {
    tauri::Builder::default()
+       .plugin(tauri_plugin_system_fonts::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

src-tauri/capabilities/default.json

{
    ...
    "permissions": [
        ...
+       "system-fonts:default"
    ]
}

Afterwards all the plugin's APIs are available through the JavaScript guest bindings:

import { getSystemFonts } from "tauri-plugin-system-fonts-api";

const fonts = await getSystemFonts();

Methods

Method Description
getSystemFonts Get all fonts installed on the system.

Example

git clone https://github.com/ayangweb/tauri-plugin-system-fonts.git
pnpm install

pnpm build

cd examples/tauri-app

pnpm install

pnpm tauri dev

Thanks

  • Use fontdb to get all fonts installed on your system.

Who's Use It

  • EcoPaste - Open source cross-platform clipboard management tool.