1. with Ada.Unchecked_Conversion; 
  2. with Allegro.Bitmaps;                   use Allegro.Bitmaps; 
  3. with Allegro.Palettes;                  use Allegro.Palettes; 
  4.  
  5. package Allegro.Fonts is 
  6.  
  7.     -- Allegro 4.2.2 - Fonts 
  8.     -- This package is complete 
  9.  
  10.     type Font is private; 
  11.     type A_Font is access all Font; 
  12.  
  13.     type A_Font_Load_Callback is 
  14.         access function( filename : String; 
  15.                          pal      : A_RGB; 
  16.                          param    : Address ) return A_Font; 
  17.  
  18.     ---------------------------------------------------------------------------- 
  19.  
  20.     procedure Destroy_Font( f : in out A_Font ); 
  21.  
  22.     function Extract_Font_Range( f : not null A_Font; first, last : Integer ) return A_Font; 
  23.  
  24.     function Get_Font_Range_Begin( f : not null A_Font; rang : Integer ) return Integer; 
  25.  
  26.     function Get_Font_Range_End( f : not null A_Font; rang : Integer ) return Integer; 
  27.  
  28.     function Get_Font_Ranges( f : not null A_Font ) return Integer; 
  29.  
  30.     function Grab_Font_From_Bitmap( bmp : not null A_Bitmap ) return A_Font; 
  31.  
  32.     function Is_Color_Font( f : not null A_Font ) return Integer; 
  33.  
  34.     function Is_Compatible_Font( f1, f2 : not null A_Font ) return A_Font; 
  35.  
  36.     function Is_Mono_Font( f : not null A_Font ) return Integer; 
  37.  
  38.     function Load_Bios_Font( filename : String; pal : A_RGB; param : Address ) return A_Font; 
  39.  
  40.     function Load_Bitmap_Font( filename : String; pal : A_RGB; param : Address ) return A_Font; 
  41.  
  42.     function Load_Dat_Font( filename : String; pal : A_RGB; param : Address ) return A_Font; 
  43.  
  44.     function Load_Font( filename : String; pal : A_RGB; param : Address ) return A_Font; 
  45.  
  46.     function Load_Grx_Font( filename : String; pal : A_RGB; param : Address ) return A_Font; 
  47.  
  48.     function Load_Grx_Or_Bios_Font( filename : String; pal : A_RGB; param : Address ) return A_Font; 
  49.  
  50.     function Load_Txt_Font( filename : String; pal : A_RGB; param : Address ) return A_Font; 
  51.  
  52.     procedure Make_Trans_Font( f : not null A_Font ); 
  53.  
  54.     function Merge_Fonts( f1, f2 : not null A_Font ) return A_Font; 
  55.  
  56.     procedure Register_Font_File_Type( ext : String; load : A_Font_Load_Callback ); 
  57.  
  58.     function Transpose_Font( f : not null A_Font; drange : Integer ) return Integer; 
  59.  
  60.     function To_A_Font is new Ada.Unchecked_Conversion( Address, A_Font ); 
  61.  
  62. private 
  63.  
  64.     type Font_Vtable is 
  65.         record 
  66.             font_height          : Address; 
  67.             char_length          : Address; 
  68.             text_length          : Address; 
  69.             render_char          : Address; 
  70.             render               : Address; 
  71.             destroy              : Address; 
  72.             get_font_ranges      : Address; 
  73.             get_font_range_begin : Address; 
  74.             get_font_range_end   : Address; 
  75.             extract_font_range   : Address; 
  76.             merge_fonts          : Address; 
  77.             transpose_font       : Address; 
  78.        end record; 
  79.     pragma Convention( C, Font_Vtable ); 
  80.     type A_Font_Vtable is access all Font_Vtable; 
  81.  
  82.     type Font is 
  83.         record 
  84.             data   : Address; 
  85.             height : Integer; 
  86.             vtable : A_Font_Vtable; 
  87.         end record; 
  88.     pragma Convention( C, Font ); 
  89.  
  90.     ---------------------------------------------------------------------------- 
  91.  
  92.     pragma Convention( C, A_Font_Load_Callback ); 
  93.  
  94.     pragma Import( C, Extract_Font_Range, "extract_font_range" ); 
  95.     pragma Import( C, Get_Font_Range_Begin, "get_font_range_begin" ); 
  96.     pragma Import( C, Get_Font_Range_End, "get_font_range_end" ); 
  97.     pragma Import( C, Get_Font_Ranges, "get_font_ranges" ); 
  98.     pragma Import( C, Grab_Font_From_Bitmap, "grab_font_from_bitmap" ); 
  99.     pragma Import( C, Is_Color_Font, "is_color_font" ); 
  100.     pragma Import( C, Is_Compatible_Font, "is_compatible_font" ); 
  101.     pragma Import( C, Is_Mono_Font, "is_mono_font" ); 
  102.     pragma Import( C, Make_Trans_Font, "make_trans_font" ); 
  103.     pragma Import( C, Merge_Fonts, "merge_fonts" ); 
  104.     pragma Import( C, Transpose_Font, "transpose_font" ); 
  105.  
  106. end Allegro.Fonts;