# Aros/Developer/Docs/Libraries/DiskFont

* Navbar for the Aros wikibook
* Aros User
* Aros User Docs
* Aros User FAQs
* Aros User Applications
* Aros User DOS Shell
* Aros/User/AmigaLegacy
* Aros Dev Docs
* Aros Developer Docs
* Porting Software from AmigaOS/SDL
* For Zune Beginners
* Zune .MUI Classes
* For SDL Beginners
* Aros Developer BuildSystem
* Specific platforms
* Aros x86 Complete System HCL
* Aros x86 Audio/Video Support
* Aros x86 Network Support
* Aros Intel AMD x86 Installing
* Aros Storage Support IDE SATA etc
* Aros Poseidon USB Support
* x86-64 Support
* Motorola 68k Amiga Support
* Linux and FreeBSD Support
* Windows Mingw and MacOSX Support
* Android Support
* Arm Raspberry Pi Support
* PPC Power Architecture
* misc
* Aros Public License

## Fonts

AROS can use two different fonts and Other font types such as the more common TrueType (AROS uses FreeType equivalent) fonts, you need to use another library
A font is basically a mixture of the typeface (shape of letters), style (bold, plain, italic) and size (measured in fonts). The AROS has one built in font called Topaz which can be accessed at all times. If using a disk based font, then you need to use the diskfont.library to load a font from disk.

### Bitmap Fonts

bitplane data in a custom format along with some metadata for the horizontal offset and left/right side widths of each character. The loader is in Diskfont.library as OpenDiskFont. Once loaded, a bitmap font is processed by OpenFont
Wanderer calls IconList with NULL font, because diskfont.library is not able to open "arial.font". This happens on the other hand because diskfont.library is not finding the arial.font in FONTS:, because ExAll call returns 0 (== done) on its first call. This means not all fonts are returned, because the passed 1024 bytes buffer is too small to get them all in one go.
Loading a disk font
To load a diskfont, use the OpenDiskFont function. You need to specify a TextAttr structure to state which font you require, the format of the command is:
TextFont font = OpenDiskFont(struct TextAttr textAttr)
The format of the TextAttr is:
For example, to specify a Topaz font, size 11 with Bold and Italic:
If you are drawing with this font, you can change the default Rastport font with the SetFont command and when done with it using the CloseFont functions: e.g.
If you want to know what fonts are available in your program before trying to load one from disk, then you can use the AvailFonts function which can read all the fonts from memory and disk and present them in an AvailFontsHeader structure, followed by a number of AvailFonts structures to be read by your program. You need to allocate some memory before calling this function to store the font information.
LONG error = AvailFonts(struct AvailFontsHeader *buffer, LONG bufBytes, ULONG flags )
For example,
For each font size described in a FontContents (or TFontContents) structure, there is a corresponding file in that font's directory whose name is its size. For example, for the font size Sapphire-19, there is a file in the Sapphire directory called 19. That file is basically a DiskFontHeader disguised as a loadable DOS hunk and is known as a font descriptor file.
For a bitmap font, the ".font" file is a FontContentsHeader structure:
Where the fch_FileID field can be either:
The FontContents structure:
Does anyone know what program was used to generate the ttcourier fonts? They were committed by Georg in 2001.
IIRC BitLine (see Aminet, comes with source code). Loads font into memory using diskfont.library and then saves it to disk. Source font was truetype font which diskfont.library transforms into bitmap font during loading (if there's a font engine like the freetype based ones which can handle it).
There's a small problem with these fonts: the glyphs are all aligned to the left of their box rather than to the centre (this is one of the papercut bugs).
A quick look at the ttcourier font (with tools like sys:tools/fontinfo and the bitmap font editor "TypeFace" in sys:extras/misc/aminet/). It seems only some sizes (like 14) have the problem and problem is missing/zero kerning/spacing tables.
Also looking at the svn log of the font files ("14", etc.) in workbench/fonts/ it seems problem may have happened when the Euro character was (manually) added to the fonts (IIRC with Typeface font editor running under AROS -> maybe a bug there), as I did a quick test with the initial revision of the "14" file which did not seem to have the kerning/spacing tables missing.

### FreeType Outline Fonts

Note that depending on style and other things fonts are not not always rendered with the same HIDD method. See rom/graphics/text.c. The text not visible on the screenshot is those which gets rendered with BlitColorexpansion method.