1. with Allegro.Bitmaps;                   use Allegro.Bitmaps; 
  2. with Allegro.Truecolor;                 use Allegro.Truecolor; 
  3. with Objects;                           use Objects; 
  4.  
  5. package Font_API is 
  6.  
  7.     -- Initializes the font system and each underlying font API (ex: AlFont/FreeType). 
  8.     -- An exception will be raised on error. 
  9.     procedure Initialize; 
  10.  
  11.     -- Finalizes the font system and each underlying font API that was 
  12.     -- previously initialized. If Initialize has not been called then this will 
  13.     -- have no effect. 
  14.     procedure Finalize; 
  15.  
  16.     ---------------------------------------------------------------------------- 
  17.  
  18.     -- An Abstract_Font represents a specific font of a specific size. Two 
  19.     -- Abstract_Font instances are required to work with the same font in two 
  20.     -- different font sizes. 
  21.     type Abstract_Font is abstract new Limited_Object with private; 
  22.     type Font_Type is access all Abstract_Font'Class; 
  23.  
  24.     -- Loads a font from disk at a specific size. The file format will be 
  25.     -- automatically detected; it must be a supported font format. An exception 
  26.     -- will be raised on error. 
  27.     function Load_Font( filename : String; size : Positive ) return Font_Type; 
  28.     pragma Precondition( filename'Length > 0 ); 
  29.  
  30.     -- Returns the height in pixels of a string rendered with the font. 
  31.     function Text_Height( this : access Abstract_Font ) return Positive is abstract; 
  32.  
  33.     -- Returns the length in pixels of a string rendered with the font. 
  34.     function Text_Length( this : access Abstract_Font; 
  35.                           str  : String ) return Natural is abstract; 
  36.  
  37.     -- Renders a string to a bitmap. 'color' is the color of the letters. If 
  38.     -- 'smooth' is True, the text will be antialiased if possible. 
  39.     procedure Textout( this   : access Abstract_Font; 
  40.                        bmp    : A_Bitmap; 
  41.                        str    : String; 
  42.                        x, y   : Integer; 
  43.                        color  : Color_Type; 
  44.                        smooth : Boolean ) is abstract; 
  45.  
  46.     -- Deletes a font. 
  47.     procedure Delete( this : in out Font_Type ); 
  48.     pragma Postcondition( this = null ); 
  49.  
  50.     -- Raised by Initialize on error, or on failure to load a font. Check the 
  51.     -- exception's message for details. 
  52.     FONT_EXCEPTION : exception; 
  53.  
  54. private 
  55.  
  56.     type Abstract_Font is abstract new Limited_Object with null record; 
  57.  
  58. end Font_API;