font.eh

Font handling. More...

use "font.eh"

Constants

const FACE_MONO = 32
const FACE_PROP = 64
const FACE_SYSTEM = 0
const SIZE_LARGE = 16
const SIZE_MED = 0
const SIZE_SMALL = 8
const STYLE_BOLD = 1
const STYLE_ITALIC = 2
const STYLE_PLAIN = 0
const STYLE_ULINE = 4

Functions

def font_baseline(font: Int): Int;
def font_height(font: Int): Int;
def str_width(font: Int, str: String): Int;

Description

Font in Alchemy UI is specified as OR-combined mask of constants defined in this header. For example, to set large italicized font on TextItem you should use
item.set_font(SIZE_LARGE | STYLE_ITALIC)
If requested font does not exist then system will provide closest match.

Constant details

const FACE_SYSTEM = 0
Default font face for the system.

const FACE_MONO = 32
Monospace font face.

const FACE_PROP = 64
Proportional font face.

const STYLE_PLAIN = 0
Plain font style. Can be combined with other style constants.

const STYLE_BOLD = 1
Bold font style. Can be combined with other style constants.

const STYLE_ITALIC = 2
Italicized font style. Can be combined with other style constants.

const STYLE_ULINE = 4
Underlined font style. Can be combined with other style constants.

const SIZE_SMALL = 8
The "small" system-dependent font size.

const SIZE_MED = 0
The "medium" system-dependent font size.

const SIZE_LARGE = 16
The "large" system-dependent font size.

Function details

def str_width(font: Int, str: String): Int;
Returns the width given string will occupy when rendered with specified font.

def font_height(font: Int): Int;
Returns the standard height of a line of text in specified font.

def font_baseline(font: Int): Int;
Gets the distance in pixels from the top of the text to the text's baseline in specified font.