HSFont
TypeThis 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
staticHSFont.body() -> HSFont
Body text style
Declaration
HSFont.body() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.callout() -> HSFont
Callout text style
Declaration
HSFont.callout() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.caption() -> HSFont
Caption text style
Declaration
HSFont.caption() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.caption2() -> HSFont
Caption2 text style
Declaration
HSFont.caption2() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.footnote() -> HSFont
Footnote text style
Declaration
HSFont.footnote() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.headline() -> HSFont
Headline text style
Declaration
HSFont.headline() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.largeTitle() -> HSFont
Large Title text style
Declaration
HSFont.largeTitle() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.subheadline() -> HSFont
Sub-headline text style
Declaration
HSFont.subheadline() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.title() -> HSFont
Title text style
Declaration
HSFont.title() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.title2() -> HSFont
Title2 text style
Declaration
HSFont.title2() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.title3() -> HSFont
Title3 text style
Declaration
HSFont.title3() -> HSFont
Returns
HSFont
An HSFont object
staticHSFont.system(size) -> HSFont
The system font in a custom size
Declaration
HSFont.system(size) -> HSFont
Parameters
| Name | Type | Description |
|---|---|---|
| size | number | The font size in points |
Returns
HSFont
An HSFont object
staticHSFont.system(size, weight) -> HSFont
The system font in a custom size with a choice of weights
Declaration
HSFont.system(size, weight) -> HSFont
Parameters
| Name | Type | Description |
|---|---|---|
| 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
staticHSFont.custom(name, size) -> HSFont
A font present on the system at a given size
Declaration
HSFont.custom(name, size) -> HSFont
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | A string containing the name of the font to instantiate |
| size | number | The font size in points |
Returns
HSFont
An HSFont object