2
* Copyright (C) 2001 by Holger Rapp
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24
#include "singleton.h"
26
// Ugly: Size of chars is hard coded for widelands.
27
// Somebody's feeling like defining a font file format?
31
/** class Font_Handler
33
* This class generates font Pictures out of strings and returns them
34
* This is sure that the user want's fixed font strings
38
* DEPENDS: class Graph::Pic
39
* DEPENDS: func Graph::copy_pic
41
class Font_Handler : public Singleton<Font_Handler> {
42
Font_Handler(const Font_Handler&);
43
Font_Handler& operator=(const Font_Handler&);
46
const static unsigned short MAX_FONTS=2;
52
void set_font(const unsigned short, Pic*, const unsigned short, const unsigned short);
53
Pic* get_string(const char*, const unsigned short);
55
/** inline unsigned short get_fh(unsigned short f)
57
* This function returns the height of the given font
58
* Args: f which font to check
61
inline unsigned short get_fh(unsigned short f) { assert(f<MAX_FONTS); assert(h[f]); return h[f]; }
63
/** inline unsigned short get_fw(unsigned short f)
65
* This function returns the width of the given font
66
* Args: f which font to check
69
inline unsigned short get_fw(unsigned short f) { assert(f<MAX_FONTS); assert(w[f]); return w[f]; }
72
unsigned short w[MAX_FONTS];
73
unsigned short h[MAX_FONTS];
78
#define g_fh Font_Handler::get_singleton()
80
#endif /* __S__FONT_H */