Emerge.Config.Font (Emerge v0.5.1)

Copy Markdown View Source

One application font registration. Add this record to Emerge.Config.Assets.fonts. Use the registered family with Emerge.UI.Font.family/1 in your UI.

%Emerge.Config{
  assets: %Emerge.Config.Assets{
    fonts: [%Emerge.Config.Font{family: "Inter", source: "fonts/Inter-Bold.ttf", weight: 700}]
  }
}

Fields

  • family — non-empty family name used by your UI. Required; defaults to nil only so an incomplete record can be constructed.
  • source — logical font path under the application's priv/ directory, or an Emerge.Assets.Ref. Required; defaults to nil.
  • weight — integer from 100 to 900; defaults to 400 (regular). Use 700 for a bold variant when the supplied font provides it.
  • italic — whether this registration is an italic variant; defaults to false.

The family/weight/italic combination must be unique in the font list. Registering a weight does not synthesize a different font file. Fonts require a new viewport to change. See Use assets for registering multiple variants.

Summary

Types

Canonical form after nested keyword records have been expanded.

Typed keyword shorthand accepted in this record's parent field.

t()

Types

normalized_t()

@type normalized_t() :: t()

Canonical form after nested keyword records have been expanded.

options()

@type options() :: [
  family: String.t() | nil,
  source: String.t() | Emerge.Assets.Ref.t() | nil,
  weight: 100..900,
  italic: boolean()
]

Typed keyword shorthand accepted in this record's parent field.

t()

@type t() :: %Emerge.Config.Font{
  family: String.t() | nil,
  italic: boolean(),
  source: String.t() | Emerge.Assets.Ref.t() | nil,
  weight: 100..900
}