Font
Struct · namespace System.Ui · Since 0.32
struct FontA 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.
Fields
Section titled “Fields”| 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 WidthThe width of a character cell in pixels (without the zoom).
Height
Section titled “Height”int HeightThe height of a character cell in pixels (without the zoom).
Ascent
Section titled “Ascent”int AscentHow far the baseline is below the top of a cell.
int ZoomEvery font pixel becomes Zoom x Zoom pixels.
Static methods
Section titled “Static methods”| 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). |
Fixed7x13
Section titled “Fixed7x13”static Font Fixed7x13()7 x 13 pixels: for a scale of 1 (96 dpi).
Fixed10x20
Section titled “Fixed10x20”static Font Fixed10x20()10 x 20 pixels: for a scale of about 1.5.
ForScale
Section titled “ForScale”static Font ForScale(double scale)The built-in font that suits a scale (1 = 96 dpi): 7x13, 10x20, and both zoomed for higher scales.
Metrics
Section titled “Metrics”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.
Methods
Section titled “Methods”| 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). |
Zoomed
Section titled “Zoomed”Font Zoomed(int zoom)The same font with every pixel drawn zoom x zoom times.
CharWidth
Section titled “CharWidth”int CharWidth()The width of one character on the screen.
LineHeight
Section titled “LineHeight”int LineHeight()The height of a line on the screen.
Measure
Section titled “Measure”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).