AmigaBitmapFont: The S3 AmigaBitmapFont and AmigaBitmapFontSet classes

AmigaBitmapFontR Documentation

The S3 AmigaBitmapFont and AmigaBitmapFontSet classes


A comprehensive representation of monochromous Amiga bitmap fonts.


Nowadays fonts are represented by vector graphics an computer systems. On the original Commodore Amiga, the screen resolution, system memory and cpu speed were limited. On those systems, it was more efficient to use bitmap images to represent the glyphs in fonts. The AmigaBitmapFontSet and AmigaBitmapFont classes can be used to represent Amiga bitmap fonts.

The Commodore Amiga had a directory named 'FONTS' located in the root, where (bitmap) fonts were stored. Font sets were stored under the font name with a *.font extension. Files with the *.font extension did not contain the bitmap images of the font. Rather the *.font file contained information on which font heights (in pixels) are available, in addition to some other meta-information.

The bitmap images were stored in separate files for each individual height. The AmigaBitmapFontSet is an S3 class that forms a comprehensive format (named list) to represent the *.font files. The AmigaBitmapFont is an S3 class is a comprehensive format (named list) that represent each font bitmap and glyph information. The AmigaBitmapFontSet objects will hold one or more AmigaBitmapFont objects.

The AmigaBitmapFont and AmigaBitmapFontSet objects are essentially named lists. Their structure and most important elements are described below. Although it is possible to replace elements manually, it is only advisable when you know what you are doing as it may break the validity of the font.



A factor with levels 'FontContents', 'TFontContents' and 'ScalableOutline'. It specifies the type of font. Currently only the first level is supported.


number of font heights available for this font. It should match with the length of FontContents. Do not change this value manually.


This is a list with bitmap entries for each specific font height (in pixels). The name of each element in this list is 'pt' followed by the height. Each element in this list holds the elements:


Miscellaneous information from the *.font file


This element represents the filename of the nested font bitmap images. Note that it should be a valid Commodore Amiga filename. It is best to modify this name using fontName. Note that this field could cause problems as Commodore Amiga filenames can contain characters that most modern platforms would not allow (such as the question mark).


This element is of type AmigaBitmapFont and is structured as described in the following section. The information in this element is no longer part of the *.font file.


Information represented by a AmigaBitmapFont is not stored in *.font files. Rather it is stored in sub-directories of the font in separate files. It has the following structure:


Elements with information on the font properties and style, and also relative file pointers.

A data.frame containing glyph info with information for specific glyphs on each row. Each row matches with a specific ASCII code, ranging from tf_LoChar up to tf_HiChar. There is an additional row that contains information for the default glyph that is out of the range of the tf_LoChar and tf_HiChar. The data.frame thus has 2 + tf_HiChar - tf_LoChar rows. This table is used to extract and plot a glyph from the bitmap image correctly.


Is a monochromous bitmap image of all the font's glyphs in a single line. It is a simple raster object (see as.raster) with an additional attribute 'palette', which lists the two colours in the image. In this palette, the first colour is the background colour and the second colour is interpreted as the foregroundcolour.

Useful functions

For importing and exporting the following functions are useful: read.AmigaBitmapFont, read.AmigaBitmapFontSet, write.AmigaBitmapFont and write.AmigaBitmapFontSet.

The following generic functions are implemented for these objects: plot, print, as.raster and as.raw.

Use c to combine one or more AmigaBitmapFont objects into a AmigaBitmapFontSet.


Pepijn de Vries


See Also

Other AmigaBitmapFont.operations: availableFontSizes(), c(), fontName(), font_example, getAmigaBitmapFont(), rasterToAmigaBitmapFont(), rawToAmigaBitmapFontSet(), rawToAmigaBitmapFont(), read.AmigaBitmapFontSet(), read.AmigaBitmapFont(), write.AmigaBitmapFont()

Other raster.operations: as.raster.AmigaBasicShape(), bitmapToRaster(), dither(), index.colours(), rasterToAmigaBasicShape(), rasterToAmigaBitmapFont(), rasterToBitmap(), rasterToHWSprite(), rasterToIFF()


## Not run: 
## 'font_example' is an example of the AmigaBitmapFontSet object:

## An AmigaBitmapFont object can also be extracted from this object:
font_example_9 <- getAmigaBitmapFont(font_example, 9)

## the objects can be printed, plotted, converted to raw data or a raster:
font_example_raw    <- as.raw(font_example)
font_example_raster <- as.raster(font_example)

## You can also format text using the font:
formated_raster     <- as.raster(font_example, text = "Foo bar", style = "bold")
plot(font_example, text = "Foo bar", style = "underlined", interpolate = F)

## End(Not run)

AmigaFFH documentation built on Aug. 27, 2023, 9:07 a.m.