decodeFile static method

Font? decodeFile(
  1. String path
)

Maps the font at path instead of reading it into memory: the pages stay clean, file-backed and evictable, and nothing is copied.

Only for trusted, stable local files — system fonts are the intended use. The mapping stays live for the returned font's lifetime, and null covers only failures detected during this call: an unsupported platform (web, Windows), a native library predating this export, a missing, unreadable, empty or oversized file, or a blob harfbuzz refuses. It says nothing about later access — if the file is truncated or its backing storage goes away, faulting a page in raises SIGBUS and terminates the process rather than returning an error.

Do not use for user-supplied paths, removable media or network volumes; read the bytes and use decode instead. Callers must always have a decode fallback for the platforms that return null.

Implementation

static Font? decodeFile(String path) {
  return decodeFontFile(path);
}