The DRIVERS functions and variables



Variables:
     Name:         extern l_font *font_system;

     Description:  Name of the regular system font defined in the 
                   "seal.ini" file as "regular".



     Name:         extern l_font *font_system_bd;

     Description:  Name of the bold system font, defined in the 
                   "seal.ini" file as "bold".



     Name:         extern l_font *font_system_i;

     Description:  Name of the italic system font, defined in the 
                   "seal.ini" file as "italic".




     Name:         extern l_font *font_system_bi;

     Description:  Name of the bold+italic system font, defined in 
                   the "seal.ini" file as "bold+italic".




Functions:

screen_shot ()
     Description:
       Set this function for Seal begining screen, before componets
       (libraries, fonts, images etc.) are loaded into memory.

     Syntax:
       extern void (*screen_shot) ( void );

     Parameters:
       -

     Returns:
       -



FONT_GETSTRWIDTH ()
     Description:
       Gets the width of a string using a specific font.

     Syntax:
       l_int FONT_GETSTRWIDTH(l_font *f, l_text str, l_int l)

     Parameters:
       f           The font to use.
       str         String to get the width of.
       l           Length of the string.

     Returns:
       The width in pixels.



FONT_GETSTRHEIGHT ()
     Description:
       Gets the height of a font.

     Syntax:
       l_int FONT_GETSTRHEIGHT(l_font *f)

     Parameters:
       f           Name of the font.

     Returns:
       The height in pixels.



FONT_GETWIDTH ()
     Description:
       Gets the width of a certain character using the defined font.

     Syntax:
       l_int FONT_GETWIDTH(l_font *f, l_byte ch)

     Parameters:
       f           The font to use.
       ch          Character to get the width of.

     Returns:
       The width in pixels.



FONT_GETHEIGHT ()
     Description:
       Gets the height of a font.

     Syntax:
       l_int FONT_GETHEIGHT(l_font *f)

     Parameters:
       f           Name of the font.

     Returns:
       The height in pixels.




Functions for manipulating with fonts:

load_font ()
     Description:
       Loads characters or the whole font from a file. This function
       supports TTF, PCX, TIFF and FNT fonts.

     Syntax:
       l_font* load_font ( char* _filename, char *xxname, int w, 
                           int h, int from, int to);

     Parameters:
       _filename   Filename of the font to load.
       xxname      Set to zero.
       w           Width of font.
       h           Height of font.
       from        Number of the character to start loading from.
       to          Number of the character to stop loading at.

     Returns:
       The new loaded font.



unload_font ()
     Description:
       Unloads a previously loaded font.

     Syntax:
       void  unload_font ( l_font *f );

     Parameters:
       f           Name of the font to unload.

     Returns:
       -



add_font_to_system ()
     Description:
       Adds a font to the systems table of fonts. Use this function
       before loading your own font with get_font_in_size(). 

     Syntax:
       int  add_font_to_system ( l_font *font, char *name, int weight );

     Parameters:
       font        Filename of the font to load.
       name        The identification name to use in Seal, not the
                   filename. E.g. "Times New Roman".
       weight      Weight (size) of the font.

     Returns:
       True if successful. False otherwise.



load_supported_fonts ()
     Description:
       Loads the fonts from a structure in the "seal.ini" file.

     Syntax:
       void  load_supported_fonts ( char *ini_array_name, l_bool in_mem);

     Parameters:
       ini_array_name  The structure to load fonts from.
       in_mem          Set this to false when you're not using 
                       many characters from the font. Displaying 
                       these fonts is slower, but loading of font 
                       is in high speed.

     Returns:
       -



get_font_in_size
     Description:
       Gets a font from the systems font table for usage.

     Syntax:
       l_font *get_font_in_size ( char *fontname, int w, int h );

     Parameters:
       fontname    Identification name of font. Not the filename.
       w           Width of font to be used.
       h           Height of font to be used.

     Returns:
       The font.



textout_draw ()
     Description:
       Draws text to Allegros output (a bitmap).

     Syntax:
       void textout_draw(BITMAP *bmp, l_font *f, unsigned char *s, 
                         int len, int x1, int y1, int align, 
                         GrColor color, GrColor bcolor );

     Parameters:
       bmp         The bitmap to draw to.
       f           Name of the font to use.
       s           Text to draw.
       len         Length of the text. All text is drawn if set to -1.
       x1          X-coordinate to start drawing at.
       y1          Y-coordinate to start drawing at.
       align       One of the supported alignments of the text.
       color       Color of the text.
       bcolor      Color of the background. If set to TX_NOCOLOR no
                   background is drawn.

     Returns:
       -



textout_draw_rect ()
     Description:
       Draws text to Allegros output (a bitmap) in a specified rectangle.

     Syntax:
       void textout_draw_rect(BITMAP *bmp, l_font *f, unsigned char *s,
                              int len, int x1, int y1, int x2, int y2,
                              int align, GrColor color, GrColor bcolor,
                              int clip );

     Parameters:
       bmp         The bitmap to draw to.
       f           Name of the font to use.
       s           Text to draw.
       len         Length of the text. All text is drawn if set to -1.
       x1          X-coordinate of the upper-left corner of rectangle.
       y1          Y-coordinate of the upper-left corner of rectangle.
       x2          X-coordinate of the lower-right corner of rectangle.
       y2          Y-coordinate of the lower-right corner of rectangle.
       align       One of the supported alignments of the text.
       color       Color of the text.
       bcolor      Color of the background. If set to TX_NOCOLOR no
                   background is drawn.
       clip        Clip is used when you want to clip text to lower left/upper 
                   corner of x1,y1 and BITMAP clip and higher right/bottom 
                   corner of x2, y2 and BITMAP clip.

     Returns:
       -



textout_printf ()
     Description:
       Same as the textout_draw_rect() function but reformats the text.
       Supports the same formatting style as the "printf()" function.

     Syntax:
       void textout_printf(BITMAP *bmp, void *f, int len, int x1, int y1, 
                           int x2, int y2, int align, GrColor color,
                           GrColor bcolor, int clip, char *s, ... );

     Parameters:
       bmp         The bitmap to draw to.
       f           Name of the font to use.
       len         Length of the text. All text is drawn if set to -1.
       x1          X-coordinate of the upper-left corner of rectangle.
       y1          Y-coordinate of the upper-left corner of rectangle.
       x2          X-coordinate of the lower-right corner of rectangle.
       y2          Y-coordinate of the lower-right corner of rectangle.
       align       One of the supported alignments of the text.
       color       Color of the text.
       bcolor      Color of the background. If set to TX_NOCOLOR no
                   background is drawn.
       clip        Clip is used when you want to clip text to lower left/upper 
                   corner of x1,y1 and BITMAP clip and higher right/bottom 
                   corner of x2, y2 and BITMAP clip.
       s           The formatting to use.
       ...         Text to format and draw.

     Returns:
       -



draw_double_text ()
     Description:
       Same as the textout_draw_rect() function but also draws a
       "shadow" of the text in the specified color.


     Syntax:
       void draw_double_text ( BITMAP *out, GrFONT *f, unsigned char *txt,
                               int size, int x1, int y1, int x2, int y2,
                               int align, GrCOLOR f1, GrCOLOR f2, int clip );

     Parameters:
       bmp         The bitmap to draw to.
       f           Name of the font to use.
       txt         Text to draw.
       size        Length of the text. All text is drawn if set to -1.
       x1          X-coordinate of the upper-left corner of rectangle.
       y1          Y-coordinate of the upper-left corner of rectangle.
       x2          X-coordinate of the lower-right corner of rectangle.
       y2          Y-coordinate of the lower-right corner of rectangle.
       align       One of the supported alignments of the text.
       f1          Color of the text.
       f2          Color of the "shadow" of the text.
       clip        Clip is used when you want to clip text to lower left/upper 
                   corner of x1,y1 and BITMAP clip and higher right/bottom 
                   corner of x2, y2 and BITMAP clip.

     Returns:
       -



void draw_selected_text ()
     Description:
       Same as the textout_draw_rect() function but draws a
       section of the text in another color. This function may only be 
       drawn with the TX_ALIGN_DEFAULT alignment in this version of Seal!

     Syntax:
       void draw_selected_text ( BITMAP *out, GrFONT *f, unsigned char *txt, 
                                 int size, int sfrom, int sto, int x1, int y1,
                                 int x2, int y2, int align, GrCOLOR f1,
                                 GrCOLOR b1, GrCOLOR f2, GrCOLOR b2, int clip);

     Parameters:
       bmp         The bitmap to draw to.
       f           Name of the font to use.
       txt         Text to draw.
       size        Length of the text. All text is drawn if set to -1.
       sfrom       Position from where to draw with the second color.
       sfrom       Position where to stop drawing with the second color.
       x1          X-coordinate of the upper-left corner of rectangle.
       y1          Y-coordinate of the upper-left corner of rectangle.
       x2          X-coordinate of the lower-right corner of rectangle.
       y2          Y-coordinate of the lower-right corner of rectangle.
       align       One of the supported alignments of the text.
       f1          First color of the text.
       b1          First color of the background.
       f2          Second color of the text.
       b2          Second color of the background.
       clip        Clip is used when you want to clip text to lower left/upper 
                   corner of x1,y1 and BITMAP clip and higher right/bottom 
                   corner of x2, y2 and BITMAP clip.

     Returns:
       -




Supported Alignments


     TX_ALIGN_LEFT     - Align text to left (default in x).
     TX_ALIGN_TOP      - Align text to top (default in y).
     TX_ALIGN_RIGHT    - Align text to right.
     TX_ALIGN_BOTTOM   - Align text to bottom.
     TX_ALIGN_CENTERX  - Center text in x.
     TX_ALIGN_CENTERY  - Center text in y.
     TX_ALIGN_CENTER   - Center text in both x & y.
     TX_ALIGN_DEFAULT  - Default alignment.
     TX_UNDERLINE      - Underline text.
     TX_STRIKELINE     - Strike line through the text.