1 /************************************************************************
2  *                                                                      *
3  *  FreeSynd - a remake of the classic Bullfrog game "Syndicate".       *
4  *                                                                      *
5  *   Copyright (C) 2005  Stuart Binge  <skbinge@gmail.com>              *
6  *   Copyright (C) 2005  Joost Peters  <joostp@users.sourceforge.net>   *
7  *   Copyright (C) 2006  Trent Waddington <qg@biodome.org>              *
8  *   Copyright (C) 2006  Tarjei Knapstad <tarjei.knapstad@gmail.com>    *
9  *   Copyright (C) 2011  Joey Parrish  <joey.parrish@gmail.com>         *
10  *                                                                      *
11  *    This program is free software;  you can redistribute it and / or  *
12  *  modify it  under the  terms of the  GNU General  Public License as  *
13  *  published by the Free Software Foundation; either version 2 of the  *
14  *  License, or (at your option) any later version.                     *
15  *                                                                      *
16  *    This program is  distributed in the hope that it will be useful,  *
17  *  but WITHOUT  ANY WARRANTY;  without even  the implied  warranty of  *
18  *  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *
19  *  General Public License for more details.                            *
20  *                                                                      *
21  *    You can view the GNU  General Public License, online, at the GNU  *
22  *  project's  web  site;  see <http://www.gnu.org/licenses/gpl.html>.  *
23  *  The full text of the license is also included in the file COPYING.  *
24  *                                                                      *
25  ************************************************************************/
26 
27 #ifndef FONTMANAGER_H
28 #define FONTMANAGER_H
29 
30 #include "common.h"
31 #include "font.h"
32 
33 class SpriteManager;
34 
35 /*!
36  * Manager for all fonts used in the application.
37  */
38 class FontManager {
39 public:
40     /*! Size of font : 1 is the smaller.*/
41     enum EFontSize {
42         SIZE_1 = 0,
43         SIZE_2 = 1,
44         SIZE_3 = 2,
45         SIZE_4 = 3
46     };
47 
48     FontManager();
49     ~FontManager();
50 
51     //! Creates all fonts
52     bool loadFonts(SpriteManager *pMenuSprites, SpriteManager *pIntroFontSprites_);
53 
54     /*!
55      * Returns the font used in menus.
56      * \param size Size of the font
57      */
getMenuFont(FontManager::EFontSize size)58     MenuFont * getMenuFont(FontManager::EFontSize size) { return menuFonts_[size]; }
59 
60     /*!
61      * Returns the font used in the gameplay menu.
62      */
gameFont()63     GameFont *gameFont() {
64         return pGameFont_;
65     }
66 
67     /*!
68      * Returns the font used in the intro animation.
69      */
introFont()70     Font * introFont() {
71         return pIntroFont_;
72     }
73 
74 protected:
75     //! Create a menu font for the given size
76     MenuFont * createMenuFontForSize(SpriteManager *sprites, EFontSize size, int darkOffset, int lightOffset,
77             char base, const std::string& valid_chars);
78 
79 protected:
80     /*!
81      * Menu fonts have different sizes.
82      */
83     MenuFont * menuFonts_[4];
84     GameFont *pGameFont_;
85     Font *pIntroFont_;
86 };
87 
88 #endif
89