Skip to contents

Functions to write AmigaBitmapFont() and AmigaBitmapFontSet() class objects to files.

Usage

write.AmigaBitmapFont(x, file, disk = NULL)

write.AmigaBitmapFontSet(x, path = getwd(), disk = NULL)

Arguments

x

Respectively an AmigaBitmapFont() or a AmigaBitmapFontSet() object depending on which of the write-functions is called. This is the object that will be written to the specified file.

file

A character string specifying the file location to which x (an AmigaBitmapFont() object) needs to be written. It is common practice on the Amiga to use the font height in pixels as file name.

disk

A virtual Commodore Amiga disk to which the file should be written. This should be an amigaDisk() object. Using this argument requires the adfExplorer package. When set to NULL, this argument is ignored.

path

A character string specifying the path where x (an AmigaBitmapFontSet() object) needs to be stored. The filename for the font set will be extracted from x using fontName() followed by the *.font extension. A subdirectory will be created with the same name (without the extension) if it doesn't already exists. In this subdirectory all the nested AmigaBitmapFont() objects are stored.

Value

Invisibly returns the result of the call of close to the file connection. Or, when disk is specified, a copy of disk is returned to which the file(s) is/are written.

Details

AmigaBitmapFontSet() class objects are written to a *.font file. The filename used for this purpose is obtained from the object itself using fontName(). In addition, a subdirectory is created automatically (when it doesn't already exist) to which al the separate bitmap images for each font height are written to individual files.

AmigaBitmapFont() class objects can also be written to a file. In order to use it on a Commodore Amiga or emulator, it is better to embed the font bitmap in a font set (using c()) and write the set to corresponding files.

Author

Pepijn de Vries

Examples

if (FALSE) {
## obtain a bitmap font set:
data(font_example)

## write the font set to their files. The file name
## is extracted from the font object, so you only have
## to provide the path:
write.AmigaBitmapFont(font_example, temp.dir())

## extract a font bitmap:
font <- getAmigaBitmapFont(font_example, 9)

## and write it to the temp dir:
write.AmigaBitmapFont(font, file.path(temp.dir(), "9"))

## The following examples require the 'adfExplorer' package:
font.disk <- adfExplorer::blank.amigaDOSDisk("font.disk")
font.disk <- adfExplorer::dir.create.adf(font.disk, "FONTS")
font.disk <- write.AmigaBitmapFontSet(font_example, "DF0:FONTS", font.disk)
}