Libraries
Font Source Code
 previous   up   next 

Types
font
Interface type for fonts.
emptyFont
Font implementation type to represent an empty font.
fontProperties
Font implementation type to manage font properties.

font

const type: font

Interface type for fonts. The font interface is implemented with emptyFont, fontProperties, bitmapFont and vectorFont.


emptyFont

const type: emptyFont

Font implementation type to represent an empty font.


fontProperties

const type: fontProperties

Font implementation type to manage font properties.


Function Summary
integer
xHeight (in font: aFont)
Get the height of the letter 'x' for a given font.
integer
capHeight (in font: aFont)
Get the height of capital letters for a given font.
integer
lineHeight (in font: aFont)
Get the height of a font.
integer
ascent (in font: aFont)
Get the ascent of a font.
integer
descent (in font: aFont)
Get the descent of a font.
integer
columnWidth (in font: aFont)
Get the maximum column width of a font.
integer
characterSpacing (in font: aFont)
Get the spacing between the chars of a font.
integer
width (in font: aFont, in string: stri)
Get the pixel width of a string displayed with a font.
integer
numOfCharsInWidth (in font: aFont, in string: stri, in integer: allowedWidth)
If a string is displayed with a font, how many chars fit in a width.
integer
compare (in font: font1, in font: font2)
Compare two font values.
integer
hashCode (in font: aFont)
Compute the hash value of a font.

Function Detail

xHeight

const func integer: xHeight (in font: aFont)

Get the height of the letter 'x' for a given font. The height measured in pixels.

Returns:
the pixel height of 'x' for aFont.

capHeight

const func integer: capHeight (in font: aFont)

Get the height of capital letters for a given font. The height measured in pixels.

Returns:
the capital letter height of aFont.

lineHeight

const func integer: lineHeight (in font: aFont)

Get the height of a font. This is the height necessary to display a line with all chars of a font. The line height is measured in pixels.

Returns:
the line height of aFont.

ascent

const func integer: ascent (in font: aFont)

Get the ascent of a font. The ascent is the distance between xHeight and the height of the tallest lower-case letter. The ascent is measured in pixels.

Returns:
the ascent pixels of aFont.

descent

const func integer: descent (in font: aFont)

Get the descent of a font. The descent is the maximum distance that a letter extends below the baseline of a font. The descent is measured in pixels.

Returns:
the descent pixels of aFont.

columnWidth

const func integer: columnWidth (in font: aFont)

Get the maximum column width of a font. The width of all chars in a font is checked to get the maximum column width. The maximum column width is measured in pixels.

Returns:
the maximum column width of aFont.

characterSpacing

const func integer: characterSpacing (in font: aFont)

Get the spacing between the chars of a font. The character spacing is measured in pixels.

Returns:
the spacing between the chars of aFont.

width

const func integer: width (in font: aFont, in string: stri)

Get the pixel width of a string displayed with a font.

Returns:
the pixel width of stri displayed with aFont.

numOfCharsInWidth

const func integer: numOfCharsInWidth (in font: aFont, in string: stri, in integer: allowedWidth)

If a string is displayed with a font, how many chars fit in a width. The width is specified in pixels. The expression:

numOfCharsInWidth(aFont, stri, width(aFont, stri))

will always be equivalent to

length(stri);
Returns:
the number of chars from stri that fit into allowedWidth if stri is displayed with aFont.

compare

const func integer: compare (in font: font1, in font: font2)

Compare two font values. This function does neither compare font contents nor font names. The order of two fonts is determined by comparing the memory positions of their internal data representation. Therefore the result of compare is arbitrary and may change if the program is executed again. Inside a program the result of compare is consistent and can be used to maintain hash tables.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in font: aFont)

Compute the hash value of a font.

Returns:
the hash value.


 previous   up   next