Skip to content

Serve user-provided font files from the app, so a phone can use them #412

Done

Description

@devswha

Split out of #204 (part 2), proposed by @Kuhave. Part 1, the Terminal font and Chat font fields in Settings, shipped in v0.3.42 (#308).

Problem

A font family name in Settings only works where that font is installed. A phone has none of the fonts people use in a terminal, so the terminal there still falls back to the system monospace: on a Galaxy phone with a custom font style that is a proportional font, and with the default style Hangul glyphs are narrower than their two cells. The same should hold for other East Asian wide characters.

Proposal

The server serves font files the user provides, so nothing leaves the PC:

  • The user drops .woff2/.ttf files into $HERDR_WEB_STATE_DIR/fonts/.
  • The server lists and serves them (for example /api/fonts), behind the same access check as the rest of the API.
  • The client registers them with the FontFace API, so the font list in Settings can name them on any device.
  • The service worker caches them, so a phone downloads each file once.

Implementation notes from #204:

  • Wait for document.fonts.load() before measuring. Otherwise xterm sizes cells from the fallback font and the WebGL renderer caches glyphs from it. After the load, set fontFamily again so the atlas is rebuilt, then fit() and resize.

Open questions

  • Size. A font with CJK coverage is large: the bundled icon font alone is 1.2 MB as woff2, and a full CJK font runs to tens of MB. Likely limits: woff2 only or a size cap on other formats, and download only the fonts the Settings list names.
  • Cache. The files take room in the installed app's storage, and iOS can evict it, so a phone may download a font again.
  • Remote PCs. Which PC's fonts a pane on a remote PC uses, and whether the bridge has to serve them.
  • Resize. A font that arrives late changes the cell size; the terminal should be refitted once, not once per file.

Where

Terminal; Phone, installed app and alerts; Chat and prompt cards

Workarounds and alternatives

  • On a Galaxy phone, switch the system font style back to the default (fixes Latin, not the Hangul gaps), or stay in the chat view.
  • Bundle a default monospace font with CJK coverage: no setup, but no single font fits every language, and it adds tens of MB to every install.
  • Load from a CDN: simplest, but it adds an outbound dependency and breaks offline use.

This is a backlog proposal; implementation is not committed.

Activity

  1. added
    enhancement
    on Oct 3, 2026
  2. devswha commented on Nov 27, 2026

    @devswha
    OwnerAuthor

    Closing this as done (#3068): font files dropped into the state folder's fonts/ directory are served at /api/fonts behind the usual access check, registered with the FontFace API, and kept by the service worker, so a phone draws a font only the PC has when Settings names it.

    Remaining: the font list in Settings does not offer the served fonts by name yet.

    If you still need that remaining part, please open a new issue for it — thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions