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 tonilonly so an incomplete record can be constructed.source— logical font path under the application'spriv/directory, or anEmerge.Assets.Ref. Required; defaults tonil.weight— integer from100to900; defaults to400(regular). Use700for a bold variant when the supplied font provides it.italic— whether this registration is an italic variant; defaults tofalse.
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.
Types
@type normalized_t() :: t()
Canonical form after nested keyword records have been expanded.
@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.
@type t() :: %Emerge.Config.Font{ family: String.t() | nil, italic: boolean(), source: String.t() | Emerge.Assets.Ref.t() | nil, weight: 100..900 }