Documentation ¶
Overview ¶
Package font provides support for Allegro's font addon.
Index ¶
- Constants
- func DrawJustifiedText(font *Font, color allegro.Color, x1, x2, y, diff float32, flags DrawFlags, ...)
- func DrawJustifiedTextf(font *Font, color allegro.Color, x1, x2, y, diff float32, flags DrawFlags, ...)
- func DrawText(font *Font, color allegro.Color, x, y float32, flags DrawFlags, text string)
- func DrawTextf(font *Font, color allegro.Color, x, y float32, flags DrawFlags, format string, ...)
- func Install()
- func Installed() bool
- func Uninstall()
- func Version() (major, minor, revision, release uint8)
- type DrawFlags
- type Font
Constants ¶
const ( ALIGN_LEFT DrawFlags = C.ALLEGRO_ALIGN_LEFT ALIGN_CENTRE = C.ALLEGRO_ALIGN_CENTRE ALIGN_RIGHT = C.ALLEGRO_ALIGN_RIGHT ALIGN_INTEGER = C.ALLEGRO_ALIGN_INTEGER )
Variables ¶
This section is empty.
Functions ¶
func DrawJustifiedText ¶
func DrawJustifiedText(font *Font, color allegro.Color, x1, x2, y, diff float32, flags DrawFlags, text string)
Like al_draw_text, but justifies the string to the region x1-x2.
See https://liballeg.org/a5docs/5.2.6/font.html#al_draw_justified_text
func DrawJustifiedTextf ¶
func DrawText ¶
Writes the NUL-terminated string text onto the target bitmap at position x, y, using the specified font.
See https://liballeg.org/a5docs/5.2.6/font.html#al_draw_text
func Install ¶
func Install()
Initialise the font addon.
See https://liballeg.org/a5docs/5.2.6/font.html#al_init_font_addon
func Installed ¶
func Installed() bool
Returns true if the font addon is initialized, otherwise returns false.
See https://liballeg.org/a5docs/5.2.6/font.html#al_is_font_addon_initialized
func Uninstall ¶
func Uninstall()
Shut down the font addon. This is done automatically at program exit, but can be called any time the user wishes as well.
See https://liballeg.org/a5docs/5.2.6/font.html#al_shutdown_font_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_font_version
Types ¶
type Font ¶
type Font C.ALLEGRO_FONT
func Builtin ¶
Creates a monochrome bitmap font (8x8 pixels per character).
See https://liballeg.org/a5docs/5.2.6/font.html#al_create_builtin_font
func GrabFontFromBitmap ¶
Creates a new font from an Allegro bitmap. You can delete the bitmap after the function returns as the font will contain a copy for itself.
See https://liballeg.org/a5docs/5.2.6/font.html#al_grab_font_from_bitmap
func LoadBitmapFont ¶
Load a bitmap font from a file. This is done by first calling al_load_bitmap_flags and then al_grab_font_from_bitmap.
See https://liballeg.org/a5docs/5.2.6/font.html#al_load_bitmap_font
func LoadFont ¶
Loads a font from disk. This will use al_load_bitmap_font_flags if you pass the name of a known bitmap format, or else al_load_ttf_font.
See https://liballeg.org/a5docs/5.2.6/font.html#al_load_font
func (*Font) Ascent ¶
Returns the ascent of the specified font.
See https://liballeg.org/a5docs/5.2.6/font.html#al_get_font_ascent
func (*Font) Descent ¶
Returns the descent of the specified font.
See https://liballeg.org/a5docs/5.2.6/font.html#al_get_font_descent
func (*Font) Destroy ¶
func (f *Font) Destroy()
Frees the memory being used by a font structure. Does nothing if passed NULL.
See https://liballeg.org/a5docs/5.2.6/font.html#al_destroy_font
func (*Font) LineHeight ¶
Returns the usual height of a line of text in the specified font. For bitmap fonts this is simply the height of all glyph bitmaps. For truetype fonts it is whatever the font file specifies. In particular, some special glyphs may be higher than the height returned here.
See https://liballeg.org/a5docs/5.2.6/font.html#al_get_font_line_height
func (*Font) TextDimensions ¶
Sometimes, the al_get_text_width and al_get_font_line_height functions are not enough for exact text placement, so this function returns some additional information.
See https://liballeg.org/a5docs/5.2.6/font.html#al_get_text_dimensions