legos/font

Types

pub type Adjustment {
  Adjustment(
    capital: Float,
    lowercase: Float,
    baseline: Float,
    descender: Float,
  )
}

Constructors

  • Adjustment(
      capital: Float,
      lowercase: Float,
      baseline: Float,
      descender: Float,
    )
pub type ExternalFontConfig {
  ExternalFontConfig(url: String, name: String)
}

Constructors

  • ExternalFontConfig(url: String, name: String)
pub type Font =
  @internal Font
pub type FontConfig {
  FontConfig(
    name: String,
    adjustment: option.Option(@internal Adjustment),
    variants: List(@internal Variant),
  )
}

Constructors

  • FontConfig(
      name: String,
      adjustment: option.Option(@internal Adjustment),
      variants: List(@internal Variant),
    )

Add a text shadow

pub type TextShadowConfig {
  TextShadowConfig(
    offset: #(Float, Float),
    blur: Float,
    color: @internal Color,
  )
}

Constructors

  • TextShadowConfig(
      offset: #(Float, Float),
      blur: Float,
      color: @internal Color,
    )
pub type Variant =
  @internal Variant

Values

pub fn align_left() -> @internal Attribute(@internal Aligned, msg)

Align text to the left

pub fn align_right() -> @internal Attribute(
  @internal Aligned,
  msg,
)

Align text to the right

pub fn bold() -> @internal Attribute(@internal Aligned, msg)

Bold text

pub fn center() -> @internal Attribute(@internal Aligned, msg)

Center align text

pub fn color(
  font_color: @internal Color,
) -> @internal Attribute(decorative, msg)

Set the font color

pub fn diagonal_fractions() -> @internal Variant

Diagonal fractions variant

pub fn external(config: ExternalFontConfig) -> @internal Font

Import an external font

pub fn extra_bold() -> @internal Attribute(@internal Aligned, msg)

Extra bold font weight

pub fn extra_light() -> @internal Attribute(
  @internal Aligned,
  msg,
)

Extra light font weight

pub fn family(
  families: List(@internal Font),
) -> @internal Attribute(@internal Aligned, msg)

Set the font family from a list of fonts

pub fn feature(name: String, on: Bool) -> @internal Variant

Set a feature by name and enabled state

pub fn full() -> @internal Attribute(@internal Aligned, msg)

Full size

pub fn glow(
  clr: @internal Color,
  intensity: Float,
) -> @internal Attribute(decorative, msg)

Add a glow effect (simplified shadow)

pub fn hairline() -> @internal Attribute(@internal Aligned, msg)

Hairline font weight

pub fn heavy() -> @internal Attribute(@internal Aligned, msg)

Heavy font weight

pub fn indexed(name: String, index: Int) -> @internal Variant

Set an indexed font variant

pub fn italic() -> @internal Attribute(@internal Aligned, msg)

Italic text

pub fn justify() -> @internal Attribute(@internal Aligned, msg)

Justify text alignment

pub fn letter_spacing(
  offset: Float,
) -> @internal Attribute(@internal Aligned, msg)

Set letter spacing in pixels

pub fn ligatures() -> @internal Variant

Ligatures variant

pub fn light() -> @internal Attribute(@internal Aligned, msg)

Light font weight

pub fn medium() -> @internal Attribute(@internal Aligned, msg)

Medium font weight

pub fn monospace() -> @internal Font

A monospace font

pub fn ordinal() -> @internal Variant

Ordinal markers variant

pub fn regular() -> @internal Attribute(@internal Aligned, msg)

Regular font weight

pub fn sans_serif() -> @internal Font

A sans-serif font

pub fn semi_bold() -> @internal Attribute(@internal Aligned, msg)

Semi-bold font weight

pub fn serif() -> @internal Font

A serif font

pub fn shadow(
  config: TextShadowConfig,
) -> @internal Attribute(decorative, msg)
pub fn size(i: Int) -> @internal Attribute(decorative, msg)

Set font size in pixels

pub fn size_by_capital() -> @internal Attribute(
  @internal Aligned,
  msg,
)

Size by capital height

pub fn slashed_zero() -> @internal Variant

Slashed zero variant

pub fn small_caps() -> @internal Variant

Small caps variant

pub fn stacked_fractions() -> @internal Variant

Stacked fractions variant

pub fn strike() -> @internal Attribute(@internal Aligned, msg)

Strike through text

pub fn swash(index: Int) -> @internal Variant

Swash variant with index

pub fn tabular_numbers() -> @internal Variant

Tabular numbers variant

pub fn typeface(name: String) -> @internal Font

A specific typeface by name

pub fn underline() -> @internal Attribute(@internal Aligned, msg)

Underline text

pub fn unitalicized() -> @internal Attribute(
  @internal Aligned,
  msg,
)

Remove italic styling

pub fn variant(
  var: @internal Variant,
) -> @internal Attribute(@internal Aligned, msg)

Set a single font variant

pub fn variant_list(
  vars: List(@internal Variant),
) -> @internal Attribute(@internal Aligned, msg)

Set multiple font variants

pub fn with(config: FontConfig) -> @internal Font

Create a font with custom properties

pub fn word_spacing(
  offset: Float,
) -> @internal Attribute(@internal Aligned, msg)

Set word spacing in pixels

Search Document