Skip to main content
Komga exposes font resources for WebPub and EPUB readers. Font listing returns strings; CSS and font-file operations return binary Blob | File data.

List available fonts

The list contains family names, not file descriptors. To discover the files for a family, fetch its CSS and inspect the @font-face declarations or use the file names supplied by your reader integration. Keep the exact spelling and casing returned by Komga when passing fontFamily.
The CSS and file routes are reader resources, but deployment security and browser origin still matter. Fetch them through the SDK when the reader needs the configured base URL, session credentials, or API key; a direct CSS <link> cannot use the SDK client’s headers.

Load a font in a browser reader

Use the CSS endpoint when you want the server’s @font-face declarations. Use getFontFile when a reader needs an explicit FontFace and remember to release the object URL:

Get font-family CSS

Pass the family as the flat fontFamily parameter. The response is a Blob | File, so read it as text before injecting it:

Get a font file

The file operation takes both fontFamily and fontFile as flat parameters:

Save a font file in Node.js

The generated response is binary in every runtime. In Node.js, use the native Blob and ArrayBuffer APIs and write the bytes with node:fs/promises:
The SDK does not cache fonts. Cache the bytes or CSS in your reader application only when the server’s update policy permits it, and key cached values by both family and file name.

Error handling

Font calls return the generated result union by default. Use unwrap when you want a typed throwing boundary:

Next steps

Book content

Access pages, manifests, and resources.

Authentication

Configure Basic or API-key authentication.