Skip to content
CShift0.32

Font

Struct · namespace System.Ui · Since 0.32

struct Font

A bitmap font: every character is a cell of the same size. The two built-in fonts are the “fixed” fonts of X11, with ASCII, Latin-1 and a few typographic marks and arrows; other characters are drawn as ?. Zoom draws every pixel of a glyph as a square of that many pixels.

Name Description
Width The width of a character cell in pixels (without the zoom).
Height The height of a character cell in pixels (without the zoom).
Ascent How far the baseline is below the top of a cell.
Zoom Every font pixel becomes Zoom x Zoom pixels.
int Width

The width of a character cell in pixels (without the zoom).

int Height

The height of a character cell in pixels (without the zoom).

int Ascent

How far the baseline is below the top of a cell.

int Zoom

Every font pixel becomes Zoom x Zoom pixels.

Name Description
Fixed7x13 7 x 13 pixels: for a scale of 1 (96 dpi).
Fixed10x20 10 x 20 pixels: for a scale of about 1.5.
ForScale The built-in font that suits a scale (1 = 96 dpi): 7x13, 10x20, and both zoomed for higher scales.
Metrics A font of which only the sizes are known: for a Ui that is drawn with commands (Ui.BeginCommands) by a renderer with its own font (AmigaOS: the system font).
static Font Fixed7x13()

7 x 13 pixels: for a scale of 1 (96 dpi).

static Font Fixed10x20()

10 x 20 pixels: for a scale of about 1.5.

static Font ForScale(double scale)

The built-in font that suits a scale (1 = 96 dpi): 7x13, 10x20, and both zoomed for higher scales.

static Font Metrics(int width, int height, int ascent)

A font of which only the sizes are known: for a Ui that is drawn with commands (Ui.BeginCommands) by a renderer with its own font (AmigaOS: the system font). It draws nothing itself.

Name Description
Zoomed The same font with every pixel drawn zoom x zoom times.
CharWidth The width of one character on the screen.
LineHeight The height of a line on the screen.
Measure The width of a text on the screen (every character has the same width).
Draw Draws text into a canvas with its top left corner at (x, y) and returns its width (see Canvas.Text).
Font Zoomed(int zoom)

The same font with every pixel drawn zoom x zoom times.

int CharWidth()

The width of one character on the screen.

int LineHeight()

The height of a line on the screen.

int Measure(StringSlice text)

The width of a text on the screen (every character has the same width).

int Draw(ref Canvas canvas, int x, int y, StringSlice text, Color color)

Draws text into a canvas with its top left corner at (x, y) and returns its width (see Canvas.Text).