Smith.Font (Smith v0.3.0)

Copy Markdown View Source

Immutable font bytes with SHA-256 provenance.

Load an explicit TTF/OTF file once with load/2, then reuse the snapshot in Smith.Text.new/2. Editing or deleting the file cannot change that snapshot. No system font discovery, fallback, or silent replacement occurs. Keep your font's license with the project; the example Graduate font is bundled in priv/fonts under the SIL Open Font License.

Summary

Functions

Validates font bytes and captures their content hash. Options: face_index: 0 for collections.

Loads and validates a font file. Options: face_index: 0. Returns file-read or native font errors.

Types

t()

@opaque t()

Functions

from_binary(bytes, opts \\ [])

@spec from_binary(binary(), keyword()) :: {:ok, t()} | {:error, term()}

Validates font bytes and captures their content hash. Options: face_index: 0 for collections.

load(path, opts \\ [])

@spec load(String.t(), keyword()) :: {:ok, t()} | {:error, term()}

Loads and validates a font file. Options: face_index: 0. Returns file-read or native font errors.