Index

Package: Fonts

Description

package Fonts is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Font (abstract)

type Font is abstract new Limited_Object with private;

Ancestors:

Primitive operations:

Construct
Delete (overriding Objects.Delete)
Objects.Construct (Inherited)
Objects.To_String (Inherited)
A Font represents a specific font of a specific size. Two Font instances are required to work with the same font in two different font sizes.

Types

A_Font

type A_Font is access all Font'Class;

Constants & Global variables

FONT_EXCEPTION

FONT_EXCEPTION : exception;
Raised by Initialize on error, or on failure to load a font. Check the exception's message for details.

Subprograms & Entries

Load_Font

function Load_Font
( filename: String;
size: Positive ) return A_Font;
Loads a font from disk at a specific size. The file format will be automatically detected; it must be a supported font format. An exception will be raised on error.

Draw_String

procedure Draw_String
( this: not null access Font'Class;
str: String;
x, y: Float;
color: Allegro_Color );
Renders a string onto the drawing target.

Text_Height

function Text_Height
( this: not null access Font'Class ) return Positive;
Returns the height in pixels of a string rendered with the font.

Text_Length

function Text_Length
( this: not null access Font'Class;
str: String ) return Natural;
Returns the length in pixels of a string rendered with the font.

Delete

procedure Delete
( this: in out A_Font );
Deletes a font.