fontmgr.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/dfb/private/fontmgr.h
  3. // Purpose: font management for wxDFB
  4. // Author: Vaclav Slavik
  5. // Created: 2006-11-18
  6. // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
  7. // (c) 2006 REA Elektronik GmbH
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_DFB_PRIVATE_FONTMGR_H_
  11. #define _WX_DFB_PRIVATE_FONTMGR_H_
  12. #include "wx/dfb/wrapdfb.h"
  13. class wxFileConfig;
  14. class wxFontInstance : public wxFontInstanceBase
  15. {
  16. public:
  17. wxFontInstance(float ptSize, bool aa, const wxString& filename);
  18. wxIDirectFBFontPtr GetDirectFBFont() const { return m_font; }
  19. private:
  20. wxIDirectFBFontPtr m_font;
  21. };
  22. class wxFontFace : public wxFontFaceBase
  23. {
  24. public:
  25. wxFontFace(const wxString& filename) : m_fileName(filename) {}
  26. protected:
  27. wxFontInstance *CreateFontInstance(float ptSize, bool aa);
  28. private:
  29. wxString m_fileName;
  30. };
  31. class wxFontBundle : public wxFontBundleBase
  32. {
  33. public:
  34. wxFontBundle(const wxString& name,
  35. const wxString& fileRegular,
  36. const wxString& fileBold,
  37. const wxString& fileItalic,
  38. const wxString& fileBoldItalic,
  39. bool isFixed);
  40. /// Returns name of the family
  41. virtual wxString GetName() const { return m_name; }
  42. virtual bool IsFixed() const { return m_isFixed; }
  43. private:
  44. wxString m_name;
  45. bool m_isFixed;
  46. };
  47. class wxFontsManager : public wxFontsManagerBase
  48. {
  49. public:
  50. wxFontsManager() { AddAllFonts(); }
  51. virtual wxString GetDefaultFacename(wxFontFamily family) const
  52. {
  53. return m_defaultFacenames[family];
  54. }
  55. private:
  56. // adds all fonts using AddBundle()
  57. void AddAllFonts();
  58. void AddFontsFromDir(const wxString& indexFile);
  59. void AddFont(const wxString& dir, const wxString& name, wxFileConfig& cfg);
  60. void SetDefaultFonts(wxFileConfig& cfg);
  61. private:
  62. // default facenames
  63. wxString m_defaultFacenames[wxFONTFAMILY_MAX];
  64. };
  65. #endif // _WX_DFB_PRIVATE_FONTMGR_H_