Skip to main content

FontResolution

class FontResolution

Outcome of resolving one font role's [FontSpec] into something the platform can render with.

Never a bare null, so the SDKs can log why they are falling back to Lato:

  • [Loaded] - a validated font file is on disk
  • [System] - a font name to look up on the device; nothing was downloaded
  • [Unusable] - the clip can never work as it stands: no ttf/otf asset, no family name, unparsable json, or bytes that arrived and are not a font (empty, no sfnt magic, too short to hold an sfnt header). Also the verdict for a cleared role. Retrying will not help; fall back to Lato and stop asking.
  • [Unavailable] - the answer never arrived, or not all of it: the clip json could not be fetched, the font file download failed or timed out, fewer bytes arrived than the server declared, resolution timed out, no file store was wired up (yet), or a platform implementation threw. The font itself may be perfectly fine. Fall back to Lato now, worth retrying later.

The dividing line is what was learned, not how far it got: a 404 on the font file is [Unavailable] because the next request may well answer, while an error page served in its place is [Unusable] because those bytes will never be a font.

Properties​

path​

val path: String get()

Path of the font file on disk, for the platform's font registration call.