Font

Methods
13
Fields
8

Getting one

Font.new(…)
FontManager.getRunescapeFont()
FontManager.getRunescapeSmallFont()

Methods

MethodReturnsDescription
deriveFont(number)Font(Font, number) -> Font: This font at size.
deriveFont(number, number)Font
deriveFontStyle(number)FontThis font in style. Luau has one number type, so a one-number deriveFont is always the size overload, and the style one is this.
getSize()numberThe size, rounded half up.
getSize2D()numberThe size.
getStyle()numberThe style bits.
isBold()booleanWhether the style is bold.
isItalic()booleanWhether the style is italic.
isPlain()booleanWhether the style is plain.
getFamily()stringThe family the name resolved to: RuneScape, Dialog, Arial...
getFontName()stringThe face's name, e.g. RuneScape Bold, Arial Bold, Dialog.bold.
getName()stringThe name it was made with ("Sans-serif" stays "Sans-serif"; its family is Dialog); a name longer than 256 bytes is not kept and answe…
equals(any)booleanWhether other is the same font (== answers the same, the name it was made with included; false for anything else).
new(string, number, number)FontThe font for name: a RuneScape family, a logical font (Font.DIALOG...), or a system family or face name; any other name is Dialog. `s…

Fields

FieldTypeDescription
PLAINnumberFont.PLAIN: 0.
BOLDnumberFont.BOLD: 1.
ITALICnumberFont.ITALIC: 2.
DIALOGstringFont.DIALOG: the logical font Swing draws with (Arial, then the fallback faces).
DIALOG_INPUTstringFont.DIALOG_INPUT: the logical font of text input (Courier New).
SANS_SERIFstringFont.SANS_SERIF: the logical sans-serif font (Arial).
SERIFstringFont.SERIF: the logical serif font (Times New Roman).
MONOSPACEDstringFont.MONOSPACED: the logical monospaced font (Courier New).

Returned by

MethodReturnsDescription
Component.getFontFont?The font: the component's own, else its nearest ancestor's, else nil.
FontClass.newFontThe font for name: a RuneScape family, a logical font (Font.DIALOG...), or a system family or face name; any other name is Dialog. `s…
FontManagerClass.getDefaultBoldFontFontSwing's Dialog, bold, 16.
FontManagerClass.getDefaultFontFontSwing's Dialog, plain, 16 (Font.new(Font.DIALOG, Font.PLAIN, 16)).
FontManagerClass.getFallbackFontFontThe family's font with Dialog's faces behind it for the characters it lacks (what FontType.getFont() answers); an unknown family is `Di…
FontManagerClass.getRunescapeBoldFontFontRuneScape, bold, 16.
FontManagerClass.getRunescapeFontFontRuneScape, plain, 16.
FontManagerClass.getRunescapeSmallFontFontRuneScape Small, plain, 16.
FontMetrics.getFontFontThe font measured.
FontType.getFontFontThe font it describes.
Graphics.getFontFontThe current font.

Method details

deriveFont

deriveFont: ((Font, number) -> Font) & ((Font, number, number) -> Font)

(Font, number) -> Font: This font at size.

(Font, number, number) -> Font: This font in style at size.

deriveFontStyle

deriveFontStyle: (Font, number) -> Font

This font in style. Luau has one number type, so a one-number deriveFont is always the size overload, and the style one is this.

getSize

getSize: (Font) -> number

The size, rounded half up.

isBold

isBold: (Font) -> boolean

Whether the style is bold.

isItalic

isItalic: (Font) -> boolean

Whether the style is italic.

isPlain

isPlain: (Font) -> boolean

Whether the style is plain.

getFamily

getFamily: (Font) -> string

The family the name resolved to: RuneScape, Dialog, Arial...

getFontName

getFontName: (Font) -> string

The face's name, e.g. RuneScape Bold, Arial Bold, Dialog.bold.

getName

getName: (Font) -> string

The name it was made with ("Sans-serif" stays "Sans-serif"; its family is Dialog); a name longer than 256 bytes is not kept and answers its family's name.

equals

equals: (Font, any) -> boolean

Whether other is the same font (== answers the same, the name it was made with included; false for anything else).

new

new: (string, number, number) -> Font

The font for name: a RuneScape family, a logical font (Font.DIALOG...), or a system family or face name; any other name is Dialog. style is PLAIN, BOLD, ITALIC, or'ed; a face the family lacks is synthesized. Never raises.