[[tags: allegro game]]
== allegro
This document pertains to font related methods found in the Allegro egg.
Please see the main [allegro] wiki page for more information.
[[toc:]]
== Enums
=== font-align
(font-align->int font-align)
{{font-align}} may be one of the following symbols:
* left
* center
* right
(int->font-align integer)
== Records
=== font
font
(font-data font)
(font-height font)
=== utf-string
utf-string
== Functions
=== Fonts
(register-font-loader (string extension) (function font (string integer integer)))
Implements al_register_font_loader.
(load-bitmap-font* string)
Implements al_load_bitmap_font.
(load-bitmap-font string)
Implements al_load_bitmap_font, with (free-font!) declared as a finalizer.
(load-font* string (integer size) (integer flags))
Implements al_load_font.
(load-font string (integer size) (integer flags))
Implements al_load_font, with (free-font!) declared as a finalizer.
(make-font-from-bitmap* bitmap (integer n) (s32vector ranges))
Implements al_grab_font_from_bitmap.
(make-font-from-bitmap bitmap (integer n) (s32vector ranges))
Implements al_grab_font_from_bitmap, with (free-font!) declared as a finalizer.
(free-font! font)
Implements al_destroy_font.
(font-draw-utf (font f) (color c) (float x) (float y) (font-align flags) (utf-string ustr))
Implements al_draw_ustr.
(font-draw-string (font f) (color c) (float x) (float y) (font-align flags) (string text))
Implements al_draw_text.
(font-draw-justified-string (font f) (color c) (float x1) (float x2) (float y) (float diff) (font-align flags) (c-string text))
Implements al_draw_justified_text.
(font-draw-justified-utf-string (font f) (color c) (float x1) (float x2) (float y) (float diff) (font-align flags) (utf-string text))
Implements al_draw_justified_ustr.
(font-width font string)
Implements al_get_text_width.
(font-utf-width font utf-string)
Implements al_get_ustr_width.
(font-line-height font)
Implements al_get_font_line_height.
(font-ascent font)
Implements al_get_font_ascent.
(font-descent font)
Implements al_get_font_descent.
(font-utf-dimensions (font f) (utf-string text))
Returns a 4-element list consisting of the bounding box elements: x, y, width and height.
(font-dimensions (font f) (string text))
Returns a 4-element list consisting of the bounding box elements: x, y, width and height.
(font-addon-install)
Implements al_init_font_addon.
(font-addon-uninstall)
Implements al_shutdown_font_addon.
(font-addon-version)
Implements al_get_allegro_font_version.
=== True Type Font Support
(load-ttf* (string filename) (integer size) (integer flags))
Implements al_load_ttf_font.
(load-ttf (string filename) (integer size) (integer flags))
Implements al_load_ttf_font, with (free-font!) declared as a finalizer.
(load-ttf-from-file* (file f) (string filename) (integer size) (integer flags))
Implements al_load_ttf_font_f.
(load-ttf-from-file (file f) (string filename) (integer size) (integer flags))
Implements al_load_ttf_font_f, with (free-font!) declared as a finalizer.
(ttf-addon-install)
Implements al_init_ttf_addon.
(ttf-addon-uninstall)
Implements al_shutdown_ttf_addon.
(ttf-addon-version)
Implements al_get_allegro_ttf_version.
=== UTF Strings
(make-utf-string* string)
Implements al_ustr_new.
(make-utf-string string)
Implements al_ustr_new, with (free-utf-string!) declared as a finalizer.
(make-utf-string-from-buffer* blob)
Given a blob, produces a new utf-string.
(make-utf-string-from-buffer blob)
Given a blob, produces a new utf-string, with (free-utf-string!) declared as a finalizer.
(free-utf-string! utf-string)
Implements al_ustr_free.
(utf->string utf-string)
Implements al_cstr.
(utf->buffer! utf-string blob)
Implements al_ustr_to_buffer.
(utf->string-copy utf-string)
Implements al_cstr_dup.
(utf-copy* utf-string)
Implements al_ustr_dup.
(utf-copy utf-string)
Implements al_ustr_dup, with (free-utf-string!) declared as a finalizer.
(utf-substring* utf-string (integer start) (integer end))
Implements al_ustr_dup_substr.
(utf-substring utf-string (integer start) (integer end))
Implements al_ustr_dup_substr, with (free-utf-string!) declared as a finalizer.
(utf-empty-string)
Implements al_ustr_empty_string.
(make-utf-null-string*)
Makes an empty utf-string struct, where the string pointer is unset.
(make-utf-null-string)
Makes an empty utf-string struct, where the string pointer is unset, with (free-utf-string!) declared as a finalizer.
(utf-reference-cstr* string)
Implements al_ref_cstr.
(utf-reference-cstr string)
Implements al_ref_cstr, with (free-utf-string!) declared as a finalizer.
(utf-reference-buffer* blob)
Implements al_ref_buffer.
(utf-reference-buffer blob)
Implements al_ref_buffer, with (free-utf-string!) declared as a finalizer.
(utf-reference-utf-string* utf-string (integer start) (integer end))
Implements al_ref_ustr.
(utf-reference-utf-string utf-string (integer start) (integer end))
Implements al_ref_ustr, with (free-utf-string!) declared as a finalizer.
(utf-size utf-string)
Implements al_ustr_size.
(utf-length utf-string)
Implements al_ustr_length.
(utf-offset utf-string integer)
Implements al_ustr_offset.
(utf-next utf-string integer)
Implements al_ustr_next, modified to return #f at the end of the string.
(utf-previous utf-string integer)
Implements al_ustr_prev, modified to return #f at the end of the string.
(utf-get utf-string integer)
Implements al_ustr_get.
(utf-get-next utf-string integer)
Returns a 2-element list consisting of the next code and its position, or #f if at the end of the string.
(utf-get-prev utf-string integer)
Returns a 2-element list consisting of the previous code and its position, or #f if at the start of the string.
(utf-remove-char! utf-string integer)
Implements al_ustr_remove_chr.
(utf-remove-range! utf-string (integer start) (integer end))
Implements al_ustr_remove_range.
(utf-truncate! utf-string integer)
Implements al_ustr_truncate.
(utf-ltrim! utf-string)
Implements al_ustr_ltrim_ws.
(utf-rtrim! utf-string)
Implements al_ustr_rtrim_ws.
(utf-trim! utf-string)
Implements al_ustr_trim_ws.
(utf-assign! utf-string utf-string)
Implements al_ustr_assign.
(utf-assign-substring! utf-string utf-string (integer start) (integer end))
Implements al_ustr_assign_substr.
(utf-assign-string! utf-string string)
Implements al_ustr_assign_cstr.
(utf-set-char! utf-string (integer pos) (integer char))
Implements al_ustr_set_chr.
(utf-replace-range! utf-string (integer start) (integer end) utf-string)
Implements al_ustr_replace_range.
(utf-find utf-string (integer start) utf-string)
Implements al_ustr_find_str.
(utf-find-string utf-string (integer start) string)
Implements al_ustr_find_cstr.
(utf-find-char utf-string (integer start) (integer char))
Implements al_ustr_find_chr.
(utf-find-set utf-string (integer start) utf-string)
Implements al_ustr_find_set.
(utf-find-set-string utf-string integer string)
Implements al_ustr_find_set_cstr.
(utf-find-cset utf-string integer utf-string)
Implements al_ustr_find_cset.
(utf-find-cset-string utf-string integer string)
Implements al_ustr_find_set_cstr.
(utf-rfind utf-string integer utf-string)
Implements al_ustr_rfind_str.
(utf-rfind-char utf-string integer (integer char))
Implements al_ustr_rfind_char.
(utf-rfind-string utf-string integer string)
Implements al_ustr_rfind_cstr.
(utf-find&replace! utf-string integer utf-string utf-string)
Implements al_ustr_find_replace.
(utf-find&replace-string! utf-string integer string string)
Implements al_ustr_find_replace_cstr.
(utf-equal? utf-string utf-string)
Implements al_ustr_equal.
(utf-compare utf-string utf-string)
Implements al_ustr_compare.
(utf-ncompare utf-string utf-string integer)
Implements al_ustr_ncompare.
(utf-prefix? utf-string utf-string)
Implements al_ustr_has_prefix.
(utf-prefix-string? utf-string string)
Implements al_ustr_has_prefix_cstr.
(utf-suffix? utf-string utf-string)
Implements al_ustr_has_prefix.
(utf-suffix-string? utf-string string)
Implements al_ustr_has_suffix_cstr.
(utf8-width integer32)
Implements al_utf8_width.
(utf8-encode! blob integer32)
Implements al_utf8_encode.
(utf-string-utf16-size utf-string)
Implements al_ustr_size_utf16.
(utf-string-utf16-encode utf-string blob integer)
Implements al_ustr_encode_utf16.
(utf16-width integer)
Implements al_utf16_width.
(utf16-encode u16vector integer32)
Implements al_utf16_encode.