Unit al5ttf

Uses
Classes, Interfaces, Objects and Records
Types
Constants
Variables

Description

Allows to use TrueType Font format.

Overview

Functions and Procedures

function al_init_ttf_addon: AL_BOOL; CDECL; external ALLEGRO_TTF_LIB_NAME;
procedure al_shutdown_ttf_addon; CDECL; external ALLEGRO_TTF_LIB_NAME;
function al_get_allegro_ttf_version: AL_UINT32; CDECL; external ALLEGRO_TTF_LIB_NAME;
function al_load_ttf_font (const filename: AL_STR; size, flags: AL_INT): ALLEGRO_FONTptr; CDECL; external ALLEGRO_TTF_LIB_NAME;
function al_load_ttf_font_f (afile: ALLEGRO_FILEptr; const filename: AL_STR; size, flags: AL_INT): ALLEGRO_FONTptr; CDECL; external ALLEGRO_TTF_LIB_NAME;
function al_load_ttf_font_stretch (const filename: AL_STR; w, h, flags: AL_INT): ALLEGRO_FONTptr; CDECL; external ALLEGRO_TTF_LIB_NAME;
function al_load_ttf_font_stretch_f (afile: ALLEGRO_FILEptr; const filename: AL_STR; w, h, flags: AL_INT): ALLEGRO_FONTptr; CDECL; external ALLEGRO_TTF_LIB_NAME;

Description

Functions and Procedures

function al_init_ttf_addon: AL_BOOL; CDECL; external ALLEGRO_TTF_LIB_NAME;

Initializes the TTF addon. Call this after al_init_font_addon to make al_load_font recognize ".ttf" and other formats supported by al_load_ttf_font.

Returns

True on success, False on failure.

procedure al_shutdown_ttf_addon; CDECL; external ALLEGRO_TTF_LIB_NAME;

Unloads the TTF addon. You normally don't need to call this.

function al_get_allegro_ttf_version: AL_UINT32; CDECL; external ALLEGRO_TTF_LIB_NAME;

Returns the (compiled) version of the addon, in the same format as al_get_allegro_version.

function al_load_ttf_font (const filename: AL_STR; size, flags: AL_INT): ALLEGRO_FONTptr; CDECL; external ALLEGRO_TTF_LIB_NAME;

Loads a TrueType font from a file using the FreeType library. Quoting from the FreeType FAQ this means support for many different font formats:

TrueType, OpenType, Type1, CID, CFF, Windows FON/FNT, X11 PCF, and others

The size parameter determines the size the font will be rendered at, specified in pixels. The standard font size is measured in units per EM, if you instead want to specify the size as the total height of glyphs in pixels, pass it as a negative value.

Note

If you want to display text at multiple sizes, load the font multiple times with different size parameters.

The following flags are supported:

  • ALLEGRO_TTF_NO_KERNING - Do not use any kerning even if the font file supports it.

  • ALLEGRO_TTF_MONOCHROME - Load as a monochrome font (which means no anti-aliasing of the font is done).

  • ALLEGRO_TTF_NO_AUTOHINT - Disable the Auto Hinter which is enabled by default in newer versions of FreeType.

See also
al_init_ttf_addon
Initializes the TTF addon.
al_load_ttf_font_f
Like al_load_ttf_font, but the font is read from the file handle.
function al_load_ttf_font_f (afile: ALLEGRO_FILEptr; const filename: AL_STR; size, flags: AL_INT): ALLEGRO_FONTptr; CDECL; external ALLEGRO_TTF_LIB_NAME;

Like al_load_ttf_font, but the font is read from the file handle. The filename is only used to find possible additional files next to a font file.

Note

The file handle is owned by the returned ALLEGRO_FONTptr object and must not be freed by the caller, as FreeType expects to be able to read from it at a later time.

function al_load_ttf_font_stretch (const filename: AL_STR; w, h, flags: AL_INT): ALLEGRO_FONTptr; CDECL; external ALLEGRO_TTF_LIB_NAME;

Like al_load_ttf_font, except it takes separate width (w) and height (h) parameters instead of a single size parameter.

If the height is a positive value, and the width zero or positive, then font will be stretched according to those parameters. The width must not be negative if the height is positive.

As with al_load_ttf_font, the height may be a negative value to specify the total height in pixels. Then the width must also be a negative value, or zero.

Returns

Nil if the height is positive while width is negative, or if the height is negative while the width is positive.

See also
al_load_ttf_font
Loads a TrueType font from a file using the FreeType library.
al_load_ttf_font_stretch_f
Like al_load_ttf_font_stretch, but the font is read from the file handle.
function al_load_ttf_font_stretch_f (afile: ALLEGRO_FILEptr; const filename: AL_STR; w, h, flags: AL_INT): ALLEGRO_FONTptr; CDECL; external ALLEGRO_TTF_LIB_NAME;

Like al_load_ttf_font_stretch, but the font is read from the file handle. The filename is only used to find possible additional files next to a font file.

Note

The file handle is owned by the returned ALLEGRO_FONTptr object and must not be freed by the caller, as FreeType expects to be able to read from it at a later time.

See also
al_load_ttf_font_stretch
Like al_load_ttf_font, except it takes separate width (w) and height (h) parameters instead of a single size parameter.

Generated by PasDoc 0.15.0. Generated on 2024-11-10 15:15:06.