LavaUI docs GitHub

struct ContentScale

Swift

struct ContentScale

Discrete UI text scale — bitmap fonts re-raster at fixed pixel sizes so Yoga measure and FreeType glyphs stay pixel-aligned (no GPU scale of atlas coverage).

Intended as a reusable policy object for a future declarative-UI package: apps bind shortcuts to zoomIn / zoomOut; layout hosts re-run after FontStore.apply.

Sources/LavaUI/Font.swift:821

Constructors

init(basePixelSize: Float = 16, multipliers: [Float] = ContentScale.defaultMultipliers, index: Int? = nil)

Creates a scale.

  • basePixelSize: The face size at multiplier 1.
  • multipliers: The zoom steps, smallest first.
  • index: The starting step, clamped; nil starts at the 1.0 step, or the middle one if there is none.

Sources/LavaUI/Font.swift:837

Properties

let basePixelSize: Float

Face size at multiplier 1.0.

Sources/LavaUI/Font.swift:830

var canZoomIn: Bool { get }

Whether there is a larger step.

Sources/LavaUI/Font.swift:862

var canZoomOut: Bool { get }

Whether there is a smaller step.

Sources/LavaUI/Font.swift:864

static let defaultMultipliers: [Float]

Multipliers of the bootstrap base size (e.g. 16 → 12…32).

Sources/LavaUI/Font.swift:823

var index: Int { get }

Index into multipliers (clamped).

Sources/LavaUI/Font.swift:828

var multiplier: Float { get }

The active step's multiplier.

Sources/LavaUI/Font.swift:854

let multipliers: [Float]

The zoom steps, as multipliers of basePixelSize, smallest first.

Sources/LavaUI/Font.swift:826

var pixelSize: Float { get }

Integer FT pixel size for the active step (min 1).

Sources/LavaUI/Font.swift:857

Methods

@discardableResult mutating func reset() -> Bool

Returns to the 1.0 step (or the first, if there is none). Returns false if it was already there.

Sources/LavaUI/Font.swift:885

@discardableResult mutating func zoomIn() -> Bool

Moves one step larger. Returns false at the largest step.

Sources/LavaUI/Font.swift:868

@discardableResult mutating func zoomOut() -> Bool

Moves one step smaller. Returns false at the smallest step.

Sources/LavaUI/Font.swift:876