]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mgl/private/fontmgr.h
moved wxMGL's font management code to common so that it can be reused by wxDFB; imple...
[wxWidgets.git] / include / wx / mgl / private / fontmgr.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mgl/private/fontmgr.h
3 // Purpose: font management for MGL
4 // Author: Vaclav Slavik
5 // Created: 2006-11-18
6 // RCS-ID: $Id$
7 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MGL_PRIVATE_FONTMGR_H_
12 #define _WX_MGL_PRIVATE_FONTMGR_H_
13
14 struct font_info_t;
15 struct font_lib_t;
16 struct font_t;
17
18 class wxFontInstance : public wxFontInstanceBase
19 {
20 public:
21 wxFontInstance(float ptSize, bool aa, font_lib_t *fontLib);
22 virtual ~wxFontInstance();
23
24 struct font_t *GetMGLfont_t() const { return m_font; }
25
26 private:
27 font_t *m_font;
28 };
29
30 class wxFontFace : public wxFontFaceBase
31 {
32 public:
33 wxFontFace(const wxString& filename)
34 : m_fontLib(NULL), m_fileName(filename) {}
35
36 virtual void Acquire();
37 virtual void Release();
38
39 virtual wxFontInstance *GetFontInstance(float ptSize, bool aa);
40
41 protected:
42 wxFontInstance *CreateFontInstance(float ptSize, bool aa);
43
44 private:
45 font_lib_t *m_fontLib;
46 wxString m_fileName;
47 };
48
49 class wxFontBundle : public wxFontBundleBase
50 {
51 public:
52 wxFontBundle(const font_info_t *fontInfo);
53
54 virtual wxString GetName() const
55 { return wxString::FromAscii(m_fontInfo->familyName); }
56
57 virtual bool IsFixed() const { return m_fontInfo->isFixed; }
58
59 const font_info_t *GetInfo() const { return m_fontInfo; }
60
61 private:
62 const font_info_t *m_fontInfo;
63 };
64
65 class wxFontsManager : public wxFontsManagerBase
66 {
67 public:
68 wxFontsManager() { AddAllFonts(); }
69
70 virtual wxString GetDefaultFacename(wxFontFamily family) const;
71
72 private:
73 // adds all fonts using AddBundle()
74 void AddAllFonts();
75 };
76
77 #endif // _WX_MGL_PRIVATE_FONTMGR_H_