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