Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

BFontManager.h

Go to the documentation of this file.
00001 // BFontManager.h (this is -*- C++ -*-)
00002 // 
00003 // \author: Bjoern Giesler <bjoern@giesler.de>
00004 // 
00005 // 
00006 // 
00007 // $Author: giesler $
00008 // $Locker$
00009 // $Revision$
00010 // $Date: 2002-08-19 10:41:28 +0200 (Mon, 19 Aug 2002) $
00011 
00012 #ifndef BFONTMANAGER_H
00013 #define BFONTMANAGER_H
00014 
00015 /* system includes */
00016 /* (none) */
00017 
00018 /* my includes */
00019 #include "BFont.h"
00020 
00027 class BFontManager {
00028 public:
00029   static BFontManager* get();
00030   
00031   typedef struct {
00032     std::string name;
00033     bool bold;
00034     bool oblique;
00035     int height;
00036     BFont* font;
00037     std::string filename;
00038   } FontDescription;
00039 
00040   void addFont(BFont* font);
00041   void scanDirectory(const std::string& dir);
00042 
00043   int numFonts() { return _fonts.size(); }
00044 
00045   const std::vector<std::string>& fontNames() { return _names; }
00046   std::vector<int> sizesForFont(const std::string& name);
00047   bool hasFont(const std::string& name, int size, bool bold, bool oblique);
00048   BFont* font(const std::string& name, int size, bool bold, bool oblique);
00049 
00050 protected:
00051   friend class BFont;
00052   void fontIsDeleted(BFont* font);
00053   
00054 private:
00055   bool fontAlreadyIn(const FontDescription& descr);
00056   void addUniqueFontName(const std::string& name);
00057   
00058   std::vector<FontDescription> _fonts;
00059   std::vector<std::string> _names;
00060   static BFontManager* _fm;
00061 };
00062 
00063 #endif /* BFONTMANAGER_H */

Generated on Sat Dec 29 09:59:23 2007 for DSGUI by doxygen1.3-rc3