Libraries
Bitmapfont Source Code
 previous   up   next 

Types
bitmapFont
Font implementation type for bitmap fonts.

bitmapFont

const type: bitmapFont

Font implementation type for bitmap fonts. The following bitmap fonts are available: stdfont8.s7i, stdfont9.s7i, stdfont10.s7i, stdfont12.s7i, stdfont14.s7i, stdfont16.s7i, stdfont18.s7i, stdfont20.s7i, stdfont24.s7i


Function Summary
integer
width (in bitmapFont: bmpFont, in string: stri)
Determine the pixel width of a string displayed with a font.
integer
numOfCharsInWidth (in bitmapFont: bmpFont, in string: stri, in integer: allowedWidth)
Compute how many chars fit in a width, if stri is displayed.
PRIMITIVE_WINDOW
genPixmap (in array string: pattern, in color: foreground, in color: background, in integer: scale)
Create a pixmap from a pattern.
pixmapFontType
genPixmapFont (in bitmapFont: bmpFont, in integer: fontSize, in integer: scale, in color: foreground, in color: background)
Create a pixmap font from a bitmap font.
PRIMITIVE_WINDOW
getFontCharPixmap (in bitmapFont: bmpFont, inout pixmapFontType: pixmapFont, in char: ch)
Get the pixmap of a given bitmapFont and char.
integer
columnWidth (in fontPicType: fontPictures)
Determine the maximum column width of all chars in a fontPicType.

Function Detail

width

const func integer: width (in bitmapFont: bmpFont, in string: stri)

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

Returns:
the pixel width of stri displayed with bmpFont.

numOfCharsInWidth

const func integer: numOfCharsInWidth (in bitmapFont: bmpFont, in string: stri, in integer: allowedWidth)

Compute how many chars fit in a width, if stri is displayed. This is done for the given bmpFont. The allowedWidth 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 bmpFont.

genPixmap

const func PRIMITIVE_WINDOW: genPixmap (in array string: pattern, in color: foreground, in color: background, in integer: scale)

Create a pixmap from a pattern. A pattern is a rectangular grid of characters. It encodes the pixels of a pixmap with characters. The space (' ') encodes a background pixel and any other character encodes a foregound pixel. A scale of 1 describes an encoding with pixels. If scale is greater than 1 rectangles with side length scale are used instead of pixels.

Returns:
the created pixmap.

genPixmapFont

const func pixmapFontType: genPixmapFont (in bitmapFont: bmpFont, in integer: fontSize, in integer: scale, in color: foreground, in color: background)

Create a pixmap font from a bitmap font. The pixmapFont structure is set up and the pixmap for space (' ') is created. The pixmaps of other characters are created on demand with getFontCharPixmap.

Returns:
the created pixmap font.

getFontCharPixmap

const func PRIMITIVE_WINDOW: getFontCharPixmap (in bitmapFont: bmpFont, inout pixmapFontType: pixmapFont, in char: ch)

Get the pixmap of a given bitmapFont and char. This function is used to create character pixmaps on demand.

Returns:
the pixmap of the character ch.

columnWidth

const func integer: columnWidth (in fontPicType: fontPictures)

Determine the maximum column width of all chars in a fontPicType. This is used as helper function when a font is defined.

Returns:
the maximum column width of all chars in fontPictures.


 previous   up   next