1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. private with Alfont; 
  10.  
  11. private package Font_API.Alfont_Fonts is 
  12.  
  13.     -- Initializes the AlFont API. This must be called before attempting to load 
  14.     -- a font. Raises an exception on error. 
  15.     procedure Initialize; 
  16.  
  17.     -- Finalizes the AlFont API. Call this on application exit. 
  18.     procedure Finalize; 
  19.  
  20.     -- Attempts to load 'filename' with AlFont. The AlFont API supports all 
  21.     -- formats that are supported by FreeType 2. Returns null if the file can't 
  22.     -- be found or isn't a supported format. 
  23.     function Load_Font( filename : String; size : Positive ) return Font_Type; 
  24.     pragma Precondition( filename'Length > 0 ); 
  25.  
  26. private 
  27.  
  28.     use Alfont; 
  29.  
  30.     type Alfont_Font is new Abstract_Font with 
  31.         record 
  32.             ptr : A_Alfont_Font := null; 
  33.         end record; 
  34.  
  35.     -- Raises an exception on error loading 'filename'. 
  36.     procedure Construct( this     : access Alfont_Font; 
  37.                          filename : String; 
  38.                          size     : Positive ); 
  39.  
  40.     procedure Delete( this : in out Alfont_Font ); 
  41.  
  42.     function Text_Height( this : access Alfont_Font ) return Positive; 
  43.  
  44.     function Text_Length( this : access Alfont_Font; 
  45.                           str  : String ) return Natural; 
  46.  
  47.     procedure Textout( this   : access Alfont_Font; 
  48.                        bmp    : A_Bitmap; 
  49.                        str    : String; 
  50.                        x, y   : Integer; 
  51.                        color  : Color_Type; 
  52.                        smooth : Boolean ); 
  53.  
  54. end Font_API.Alfont_Fonts;