with Ada.Unchecked_Conversion;
with Allegro.Bitmaps; use Allegro.Bitmaps;
with Allegro.Palettes; use Allegro.Palettes;
package Allegro.Fonts is
type Font is private;
type A_Font is access all Font;
type A_Font_Load_Callback is
access function( filename : String;
pal : A_RGB;
param : Address ) return A_Font;
procedure Destroy_Font( f : in out A_Font );
function Extract_Font_Range( f : not null A_Font; first, last : Integer ) return A_Font;
function Get_Font_Range_Begin( f : not null A_Font; rang : Integer ) return Integer;
function Get_Font_Range_End( f : not null A_Font; rang : Integer ) return Integer;
function Get_Font_Ranges( f : not null A_Font ) return Integer;
function Grab_Font_From_Bitmap( bmp : not null A_Bitmap ) return A_Font;
function Is_Color_Font( f : not null A_Font ) return Integer;
function Is_Compatible_Font( f1, f2 : not null A_Font ) return A_Font;
function Is_Mono_Font( f : not null A_Font ) return Integer;
function Load_Bios_Font( filename : String; pal : A_RGB; param : Address ) return A_Font;
function Load_Bitmap_Font( filename : String; pal : A_RGB; param : Address ) return A_Font;
function Load_Dat_Font( filename : String; pal : A_RGB; param : Address ) return A_Font;
function Load_Font( filename : String; pal : A_RGB; param : Address ) return A_Font;
function Load_Grx_Font( filename : String; pal : A_RGB; param : Address ) return A_Font;
function Load_Grx_Or_Bios_Font( filename : String; pal : A_RGB; param : Address ) return A_Font;
function Load_Txt_Font( filename : String; pal : A_RGB; param : Address ) return A_Font;
procedure Make_Trans_Font( f : not null A_Font );
function Merge_Fonts( f1, f2 : not null A_Font ) return A_Font;
procedure Register_Font_File_Type( ext : String; load : A_Font_Load_Callback );
function Transpose_Font( f : not null A_Font; drange : Integer ) return Integer;
function To_A_Font is new Ada.Unchecked_Conversion( Address, A_Font );
private
type Font_Vtable is
record
font_height : Address;
char_length : Address;
text_length : Address;
render_char : Address;
render : Address;
destroy : Address;
get_font_ranges : Address;
get_font_range_begin : Address;
get_font_range_end : Address;
extract_font_range : Address;
merge_fonts : Address;
transpose_font : Address;
end record;
pragma Convention( C, Font_Vtable );
type A_Font_Vtable is access all Font_Vtable;
type Font is
record
data : Address;
height : Integer;
vtable : A_Font_Vtable;
end record;
pragma Convention( C, Font );
pragma Convention( C, A_Font_Load_Callback );
pragma Import( C, Extract_Font_Range, "extract_font_range" );
pragma Import( C, Get_Font_Range_Begin, "get_font_range_begin" );
pragma Import( C, Get_Font_Range_End, "get_font_range_end" );
pragma Import( C, Get_Font_Ranges, "get_font_ranges" );
pragma Import( C, Grab_Font_From_Bitmap, "grab_font_from_bitmap" );
pragma Import( C, Is_Color_Font, "is_color_font" );
pragma Import( C, Is_Compatible_Font, "is_compatible_font" );
pragma Import( C, Is_Mono_Font, "is_mono_font" );
pragma Import( C, Make_Trans_Font, "make_trans_font" );
pragma Import( C, Merge_Fonts, "merge_fonts" );
pragma Import( C, Transpose_Font, "transpose_font" );
end Allegro.Fonts;