This is a JavaScript object used to represent macOS fonts. It includes a variety of static methods that can instantiate the various font sizes commonly used with UI elements, and also includes static methods for instantiating the system font at various sizes/weights, or any custom font available on the system.

Properties

This type has no properties.

Methods

static HSFont.body()

Body text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.callout()

Callout text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.caption()

Caption text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.caption2()

Caption2 text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.footnote()

Footnote text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.headline()

Headline text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.largeTitle()

Large Title text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.subheadline()

Sub-headline text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.title()

Title text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.title2()

Title2 text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.title3()

Title3 text style

Parameters

None

Returns

HSFont - An HSFont object

static HSFont.system(size)

The system font in a custom size

Parameters

  • size number

    The font size in points

Returns

HSFont - An HSFont object

static HSFont.system(size, weight)

The system font in a custom size with a choice of weights

Parameters

  • size number

    The font size in points

  • weight string

    The font weight as a string (e.g. "ultralight", "thin", "light", "regular", "medium", "semibold", "bold", "heavy", "black")

Returns

HSFont - An HSFont object

static HSFont.custom(name, size)

A font present on the system at a given size

Parameters

  • name string

    A string containing the name of the font to instantiate

  • size number

    The font size in points

Returns

HSFont - An HSFont object