Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

fontserver.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: fontserver.h,v 1.6 2004/03/04 16:12:39 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #ifndef KEROSIN_FONTSERVER_H
00023 #define KEROSIN_FONTSERVER_H
00024 
00025 #include <zeitgeist/leaf.h>
00026 #include <zeitgeist/class.h>
00027 // strange as this may seem
00028 #include <ft2build.h>
00029 #include FT_FREETYPE_H
00030 
00031 namespace kerosin
00032 {
00033 
00034 class Font;
00035 
00036 /*      The fontserver manages Font objects. It prevents a single font
00037         from being loaded several times by the runtime system.
00038 
00039         NOTE:
00040 
00041         HISTORY:
00042                 15.10.01 - MK
00043                         - Initial version
00044                 02.10.02 - MK
00045                         - Moved to Kerosin (major changes)
00046 
00047         TODO:
00048 
00049         TOFIX:
00050 */
00051 class FontServer : public zeitgeist::Leaf
00052 {
00053 public:
00054     FontServer();
00055     ~FontServer();
00056 
00058     boost::shared_ptr<Font> GetFont(const std::string &name,
00059                                     unsigned int size = 12);
00060 
00062     boost::shared_ptr<Font> FindFont(const std::string &name,
00063                                      unsigned int size) const;
00064 
00066     void Begin();
00067 
00069     void End();
00070 
00071 protected:
00072     bool LoadFont(const std::string &name, unsigned int size,
00073                   boost::shared_ptr<Font> &font);
00074 
00075 private:
00076     typedef std::list<boost::shared_ptr<kerosin::Font> > TFontList;
00077 
00079     TFontList       mFonts;
00080 
00082     FT_Library  mFreeTypeLib;
00083 };
00084 
00085 DECLARE_CLASS(FontServer);
00086 
00087 } //namespace kerosin
00088 
00089 #endif //KEROSIN_FONTSERVER_H
00090 

Generated on Thu Apr 6 15:25:38 2006 for rcssserver3d by  doxygen 1.4.4