ttf

package
v1.0.1-0...-c7f6355 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2020 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package ttf provides support for Allegro's TTF font addon.

Index

Constants

View Source
const (
	TTF_NO_KERNING  TtfFlags = C.ALLEGRO_TTF_NO_KERNING
	TTF_MONOCHROME           = C.ALLEGRO_TTF_MONOCHROME
	TTF_NO_AUTOHINT          = C.ALLEGRO_TTF_NO_AUTOHINT
)

Variables

This section is empty.

Functions

func Install

func Install()

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

See https://liballeg.org/a5docs/5.2.6/font.html#al_init_ttf_addon

func Installed

func Installed() bool

Returns true if the TTF addon is initialized, otherwise returns false.

See https://liballeg.org/a5docs/5.2.6/font.html#al_is_ttf_addon_initialized

func LoadFont

func LoadFont(filename string, size int, flags TtfFlags) (*font.Font, error)

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

See https://liballeg.org/a5docs/5.2.6/font.html#al_load_ttf_font

func LoadFontF

func LoadFontF(file *allegro.File, filename string, size int, flags TtfFlags) (*font.Font, error)

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.

See https://liballeg.org/a5docs/5.2.6/font.html#al_load_ttf_font_f

func LoadFontStretch

func LoadFontStretch(filename string, w, h int, flags TtfFlags) (*font.Font, error)

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

See https://liballeg.org/a5docs/5.2.6/font.html#al_load_ttf_font_stretch

func LoadFontStretchF

func LoadFontStretchF(file *allegro.File, filename string, w, h int, flags TtfFlags) (*font.Font, error)

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.

See https://liballeg.org/a5docs/5.2.6/font.html#al_load_ttf_font_stretch_f

func Uninstall

func Uninstall()

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

See https://liballeg.org/a5docs/5.2.6/font.html#al_shutdown_ttf_addon

func Version

func Version() (major, minor, revision, release uint8)

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

See https://liballeg.org/a5docs/5.2.6/font.html#al_get_allegro_ttf_version

Types

type TtfFlags

type TtfFlags int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL