### Install unifont Package Source: https://github.com/unjs/unifont/blob/main/README.md This snippet provides the command to install the unifont package using npm, making it available for use in your project. ```sh npm install unifont ``` -------------------------------- ### Basic unifont Usage with Google Fonts Source: https://github.com/unjs/unifont/blob/main/README.md This JavaScript example demonstrates how to initialize unifont with the Google Fonts provider. It then shows how to resolve a specific font by name ('Poppins') and how to list all available fonts from the configured providers. ```js import { createUnifont, providers } from 'unifont' const unifont = await createUnifont([ providers.google(), ]) const fonts = await unifont.resolveFont('Poppins') console.log(fonts) const availableFonts = await unifont.listFonts() console.log(availableFonts) ``` -------------------------------- ### Configure unifont with Custom unstorage Cache Source: https://github.com/unjs/unifont/blob/main/README.md This TypeScript example illustrates how to integrate unifont with a custom caching solution using the unstorage library. It configures unifont to use a file system-based cache, ensuring font data is persistently stored in a specified directory, reducing redundant API calls. ```ts import { createUnifont, providers } from 'unifont' import { createStorage } from 'unstorage' import fsDriver from 'unstorage/drivers/fs-lite' const storage = createStorage({ driver: fsDriver({ base: 'node_modules/.cache/unifont' }) }) const cachedUnifont = await createUnifont([providers.google()], { storage }) console.log(await cachedUnifont.resolveFont('Poppins')) // cached data is stored in `node_modules/.cache/unifont` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.