wg_fontengine.h

00001 // wg_font.h
00002 //
00003 // CFontEngine interface
00004 // CFontEngine uses the FreeType 2 library
00005 //
00006 //
00007 // Copyright (c) 2002-2004 Rob Wiskow
00008 // rob-dev@boxedchaos.com
00009 //
00010 // This library is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU Lesser General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2.1 of the License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00023 //
00024 
00025 
00026 #ifndef _WG_FONTENGINE_H_
00027 #define _WG_FONTENGINE_H_
00028 
00029 #include <ft2build.h>
00030 #include FT_FREETYPE_H
00031 #include FT_GLYPH_H
00032 #include <string>
00033 #include <map>
00034 
00035 
00036 namespace wGui
00037 {
00038 
00042 
00043 class CFontEngine
00044 {
00045 public:
00051      CFontEngine(const std::wstring& sFontFileName, unsigned char FontSize);
00052 
00054      virtual ~CFontEngine(void);
00055 
00059      FT_BitmapGlyphRec* RenderGlyph(wchar_t Char);
00060 
00064      FT_Glyph_Metrics* GetMetrics(wchar_t Char);
00065 
00066 
00067 protected:
00068      static FT_Library m_FTLibrary;  
00069      static bool m_bFTLibraryLoaded;  
00070      FT_Face m_FontFace;  
00071      std::map<wchar_t, FT_BitmapGlyphRec> m_CachedGlyphMap;  
00072      std::map<wchar_t, FT_Glyph_Metrics> m_CachedMetricsMap;  
00073 };
00074 
00075 }
00076 
00077 #endif  // _WG_FONTENGINE_

Generated on Wed May 16 23:11:25 2007 for wGui by  doxygen 1.5.1