Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FontSettings

Class for specifying a font.

Instances of FontSettings are immutable, meaning that its setters don't modify the object, but instead return a completely new modified object.

When creating a new FontSettings object from scratch, parameters can be passed like follows:

  • new FontSettings({ size: 18, style: 'italic' })

Index

Constructors

constructor

  • When creating a new FontSettings object from scratch, parameters can be passed like follows:

    • new FontSettings({ size: 18, style: 'italic' })

    Parameters

    • Optional props: Partial<FontProperties>

      Optional object containing parameters for creation of FontSettings

    Returns FontSettings

Methods

getFamily

  • getFamily(): string
  • Get family of font

    Returns string

    The list of typeface names / family names.

getSize

  • getSize(): number
  • Get size of font

    Returns number

    The size, or height of the font.

getStyle

  • Get style of font

    Returns FontStyle

    The style of the font.

getVariant

  • getVariant(): boolean
  • Get variant of font

    Returns boolean

    Small caps or not

getWeight

  • Get weight of font

    Returns FontWeight

    The weight style, or thickness of the font characters.

setFamily

  • setFamily(family: string): this
  • Create new FontSettings object with different font family.

    Parameters

    • family: string

    Returns this

    New FontSettings object.

setSize

  • setSize(size: number): this
  • Create new FontSettings object with different font size.

    Parameters

    • size: number

    Returns this

    New FontSettings object.

setStyle

  • Create new FontSettings object with different font style.

    Parameters

    • style: FontStyle

      The style of the font. Options: "normal" | "italic" | "oblique"

    Returns this

    New FontSettings object.

setVariant

  • setVariant(smallCaps: boolean): this
  • Create new FontSettings object with different font variant. The font-variant property specifies whether or not a text should be displayed in a small-caps font.

    Parameters

    • smallCaps: boolean

      true selects font-variant: "small-caps", otherwise "normal".

    Returns this

    New FontSettings object.

setWeight

  • Create new FontSettings object with different font weight.

    Parameters

    • weight: FontWeight

      The weight style, or thickness of the font characters. Options: "normal" | "bold" | "bolder" | "lighter" | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900

    Returns this

    New FontSettings object.

Static Record

  • Record(defaultValues: TProps, name?: undefined | string): Factory<TProps>
  • Unlike other types in Immutable.js, the Record() function creates a new Record Factory, which is a function that creates Record instances.

    See above for examples of using Record().

    Note: Record is a factory function and not a class, and does not use the new keyword during construction.

    Type parameters

    • TProps

    Parameters

    • defaultValues: TProps
    • Optional name: undefined | string

    Returns Factory<TProps>