Tabular IQ

Overview

The Font class encapsulates a font. Its size is in points, which the display scales, so one Font reads the same on every display. The derivation methods (bold, italic, underlined, larger, smaller, scaled, withPointSize) each return a new Font with one change and leave this one as it was, so a heading can be written as SystemFonts.Default.bold().scaled(1.4).

Constructor

Font(family : String, pointsize : Integer, style : Integer, facename : String)

Arguments

family
The family of the new font. One of Font.Default, Font.Roman, Font.Swiss or Font.Modern.
pointsize
The pointsize of the new font.
style
The style of the new font. Combination of Font.Normal, Font.Bold, Font.Italic, and Font.Underlined.
facename
The facename of the new font.

Properties

Font.Default
A flag representing the default font family.
Font.Roman
A flag representing the Roman font family.
Font.Swiss
A flag representing the Swiss font family.
Font.Modern
A flag representing the Modern font family, the fixed-pitch one (Courier New on Windows).
Font.Normal
A flag representing the normal font style.
Font.Bold
A flag representing the bold font style.
Font.Italic
A flag representing the italicized font style.
Font.Underlined
A flag representing the underlined font style.

Methods

Font.bold
Returns a bold copy of the font.
Font.getFaceName
Gets the facename of the font.
Font.getFamily
Gets the family of the font.
Font.getPointSize
Gets the point size of the font.
Font.getStyle
Gets the style of the font.
Font.italic
Returns an italic copy of the font.
Font.larger
Returns a copy of the font one step larger.
Font.scaled
Returns a copy of the font scaled by a factor.
Font.setFaceName
Sets the new facename of the font.
Font.setFamily
Sets the new family of the font.
Font.setPointSize
Sets the new point size of the font.
Font.setStyle
Sets the new style of the font.
Font.smaller
Returns a copy of the font one step smaller.
Font.underlined
Returns an underlined copy of the font.
Font.withPointSize
Returns a copy of the font at a point size.

Font.bold

function Font.bold() : Font

Returns

A new, bold Font.

Description

Returns a new Font like this one but bold; this font is unchanged.

Font.getFaceName

function Font.getFaceName()

Description

Gets the facename of the font.

Font.getFamily

function Font.getFamily()

Description

Gets the family of the font.

Font.getPointSize

function Font.getPointSize()

Description

Gets the point size of the font.

Font.getStyle

function Font.getStyle()

Description

Gets the style of the font.

Font.italic

function Font.italic() : Font

Returns

A new, italic Font.

Description

Returns a new Font like this one but italic; this font is unchanged.

Font.larger

function Font.larger() : Font

Returns

A new, larger Font.

Description

Returns a new Font like this one with its point size multiplied by 1.2; this font is unchanged.

Font.scaled

function Font.scaled(factor : Number) : Font

Arguments

factor
The number to multiply the point size by.

Returns

A new Font of the scaled size.

Description

Returns a new Font like this one with its point size multiplied by factor; this font is unchanged. A factor that is not a positive number leaves the size as it is.

Font.setFaceName

function Font.setFaceName(facename : String)

Arguments

facename
The new facename of the font.

Description

Sets the new facename of the font.

Font.setFamily

function Font.setFamily(family : String)

Arguments

family
The new family of the font, where family is one of Font.Default, Font.Roman, Font.Swiss, or Font.Modern.

Description

Sets the new family of the font, where family is one of Font.Default, Font.Roman, Font.Swiss, or Font.Modern.

Font.setPointSize

function Font.setPointSize(size : Integer)

Arguments

size
The new size of the font in points.

Description

Sets the new size of the font in points.

Font.setStyle

function Font.setStyle(style : Integer)

Arguments

style
The new style of the font, which is a combination Font.Normal, Font.Bold, Font.Italic, and Font.Underlined.

Description

Sets the new style of the font to a combination of Font.Normal, Font.Bold, Font.Italic, and Font.Underlined.

Font.smaller

function Font.smaller() : Font

Returns

A new, smaller Font.

Description

Returns a new Font like this one with its point size divided by 1.2; this font is unchanged.

Font.underlined

function Font.underlined() : Font

Returns

A new, underlined Font.

Description

Returns a new Font like this one but underlined; this font is unchanged.

Font.withPointSize

function Font.withPointSize(size : Integer) : Font

Arguments

size
The point size of the new font.

Returns

A new Font of that size.

Description

Returns a new Font like this one at size points; this font is unchanged. A size that is not a positive number leaves the size as it is.