with Allegro.Bitmaps; use Allegro.Bitmaps;
with Allegro.Color; use Allegro.Color;
with Allegro.UTF8; use Allegro.UTF8;
with Interfaces; use Interfaces;
with Interfaces.C; use Interfaces.C;
package Allegro.Fonts is
procedure Al_Init_Font_Addon;
pragma Import( C, Al_Init_Font_Addon, "al_init_font_addon" );
procedure Al_Shutdown_Font_Addon;
pragma Import( C, Al_Shutdown_Font_Addon, "al_shutdown_font_addon" );
function Al_Get_Allegro_Font_Version return Unsigned_32;
pragma Import( C, Al_Get_Allegro_Font_Version, "al_get_allegro_font_version" );
type Allegro_Font is limited private;
type A_Allegro_Font is access all Allegro_Font;
subtype Font_Loading_Flags is Unsigned_32;
function Al_Load_Font( filename : String;
size : Integer;
flags : Font_Loading_Flags ) return A_Allegro_Font;
procedure Al_Destroy_Font( f : in out A_Allegro_Font );
type A_Loader_Proc is access
function( filename : C.char_array;
size : Integer;
flags : Font_Loading_Flags ) return A_Allegro_Font;
pragma Convention( C, A_Loader_Proc );
function Al_Register_Font_Loader( ext : String; load : A_Loader_Proc ) return Boolean;
function Al_Get_Font_Line_Height( f : A_Allegro_Font ) return Integer;
pragma Import( C, Al_Get_Font_Line_Height, "al_get_font_line_height" );
function Al_Get_Font_Ascent( f : A_Allegro_Font ) return Integer;
pragma Import( C, Al_Get_Font_Ascent, "al_get_font_ascent" );
function Al_Get_Font_Descent( f : A_Allegro_Font ) return Integer;
pragma Import( C, Al_Get_Font_Descent, "al_get_font_descent" );
function Al_Get_Text_Width( f : A_Allegro_Font; str : String ) return Integer;
function Al_Get_Ustr_Width( f : A_Allegro_Font; ustr : A_Allegro_Ustr ) return Integer;
pragma Import( C, Al_Get_Ustr_Width, "al_get_ustr_width" );
subtype Font_Draw_Flags is Unsigned_32;
ALLEGRO_ALIGN_LEFT : constant Font_Draw_Flags := 0;
ALLEGRO_ALIGN_CENTRE : constant Font_Draw_Flags := 1;
ALLEGRO_ALIGN_CENTER : constant Font_Draw_Flags := 1;
ALLEGRO_ALIGN_RIGHT : constant Font_Draw_Flags := 2;
ALLEGRO_ALIGN_INTEGER : constant Font_Draw_Flags := 4;
procedure Al_Draw_Text( font : A_Allegro_Font;
color : Allegro_Color;
x, y : Float;
flags : Font_Draw_Flags;
text : String );
procedure Al_Draw_Ustr( font : A_Allegro_Font;
color : Allegro_Color;
x, y : Float;
flags : Font_Draw_Flags;
ustr : A_Allegro_Ustr );
pragma Import( C, Al_Draw_Ustr, "al_draw_ustr" );
procedure Al_Draw_Justified_Text( font : A_Allegro_Font;
color : Allegro_Color;
x1, x2 : Float;
y : Float;
diff : Float;
flags : Font_Draw_Flags;
text : String );
procedure Al_Draw_Justified_Ustr( font : A_Allegro_Font;
color : Allegro_Color;
x1, x2 : Float;
y : Float;
diff : Float;
flags : Font_Draw_Flags;
text : A_Allegro_Ustr );
pragma Import( C, Al_Draw_Justified_Ustr, "al_draw_justified_ustr" );
procedure Al_Get_Text_Dimensions( f : A_Allegro_Font;
text : String;
bbx : out Integer;
bby : out Integer;
bbw : out Integer;
bbh : out Integer );
procedure Al_Get_Ustr_Dimensions( f : A_Allegro_Font;
text : A_Allegro_Ustr;
bbx : out Integer;
bby : out Integer;
bbw : out Integer;
bbh : out Integer );
type Unicode_Range is
record
first : Integer;
last : Integer;
end record;
pragma Convention( C, Unicode_Range );
type Unicode_Range_Array is array (Integer range <>) of Unicode_Range;
pragma Convention( C, Unicode_Range_Array );
function Al_Grab_Font_From_Bitmap( bmp : A_Allegro_Bitmap;
ranges : Unicode_Range_Array
) return A_Allegro_Font;
pragma Precondition( ranges'Length > 0 );
function Al_Create_Builtin_Font return A_Allegro_Font;
pragma Import( C, Al_Create_Builtin_Font, "al_create_builtin_font" );
function Al_Load_Bitmap_Font( filename : String ) return A_Allegro_Font;
private
type Allegro_Font is limited null record;
pragma Convention( C, Allegro_Font );
end Allegro.Fonts;