1 /* SFont: a simple font-library that uses special bitmaps as fonts
2 Copyright (C) 2003 Karl Bartel
4 WWW: http://www.linux-games.com/sfont/
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 /************************************************************************
28 * SFONT - SDL Font Library by Karl Bartel <karlb@gmx.net> *
30 * All functions are explained below. For further information, take a *
31 * look at the example files, the links at the SFont web site, or *
32 * contact me, if you problem isn' addressed anywhere. *
34 ************************************************************************/
40 // Delcare one variable of this type for each font you are using.
41 // To load the fonts, load the font image into YourFont->Surface
42 // and call SFont_InitFont(YourFont);
49 // Initializes the font
50 // Font: this contains the suface with the font.
51 // The Surface must be loaded before calling this function
52 SFont_Font* SFont_InitFont (SDL_Surface *Font);
55 // Font: The font to free
56 // The font must be loaded before using this function.
57 void SFont_FreeFont(SFont_Font* Font);
59 // Blits a string to a surface
60 // Destination: the suface you want to blit to
61 // text: a string containing the text you want to blit.
62 void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, int x, int y,
65 // Returns the width of "text" in pixels
66 int SFont_TextWidth(const SFont_Font* Font, const char *text);
67 // Returns the height of "text" in pixels (which is always equal to Font->Surface->h)
68 int SFont_TextHeight(const SFont_Font* Font);
70 // Blits a string to Surface with centered x position
71 void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y,