6 #ifndef GUILIB_FONTMANAGER_H
7 #define GUILIB_FONTMANAGER_H
12 * Copyright (C) 2005-2013 Team XBMC
15 * This Program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
20 * This Program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with XBMC; see the file COPYING. If not, see
27 * <http://www.gnu.org/licenses/>.
31 #include "GraphicContext.h"
32 #include "IMsgTargetCallback.h"
33 #include "utils/GlobalsHandling.h"
37 class CGUIFontTTFBase;
46 CStdString fontFilePath;
48 RESOLUTION_INFO sourceRes;
57 class GUIFontManager : public IMsgTargetCallback
61 virtual ~GUIFontManager(void);
63 virtual bool OnMessage(CGUIMessage &message);
65 void Unload(const CStdString& strFontName);
66 void LoadFonts(const CStdString& strFontSet);
67 CGUIFont* LoadTTF(const CStdString& strFontName, const CStdString& strFilename, color_t textColor, color_t shadowColor, const int iSize, const int iStyle, bool border = false, float lineSpacing = 1.0f, float aspect = 1.0f, const RESOLUTION_INFO *res = NULL, bool preserveAspect = false);
68 CGUIFont* GetFont(const CStdString& strFontName, bool fallback = true);
70 /*! \brief return a default font
71 \param border whether the font should be a font with an outline
72 \return the font. NULL if no default font can be found.
74 CGUIFont* GetDefaultFont(bool border = false);
77 void FreeFontFile(CGUIFontTTFBase *pFont);
79 bool IsFontSetUnicode() const { return m_fontsetUnicode; }
80 bool IsFontSetUnicode(const CStdString& strFontSet);
81 bool GetFirstFontSetUnicode(CStdString& strFontSet);
83 static void SettingOptionsFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
86 void ReloadTTFFonts();
87 static void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect);
88 void LoadFonts(const TiXmlNode* fontNode);
89 CGUIFontTTFBase* GetFontFile(const CStdString& strFontFile);
90 bool OpenFontFile(CXBMCTinyXML& xmlDoc);
92 std::vector<CGUIFont*> m_vecFonts;
93 std::vector<CGUIFontTTFBase*> m_vecFontFiles;
94 std::vector<OrigFontInfo> m_vecFontInfo;
95 bool m_fontsetUnicode;
96 RESOLUTION_INFO m_skinResolution;
104 XBMC_GLOBAL_REF(GUIFontManager, g_fontManager);
105 #define g_fontManager XBMC_GLOBAL_USE(GUIFontManager)