]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mgl/fontutil.h
changed wxUSE_MS_HTML_HELP to 1 by default
[wxWidgets.git] / include / wx / mgl / fontutil.h
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
f96f3362 2// Name: wx/mgl/fontutil.h
32b8ec41
VZ
3// Purpose: font-related helper functions for MGL
4// Author: Vaclav Slavik
5// Created: 2001/05/01
6// RCS-ID: $Id$
52750c2e 7// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
32b8ec41
VZ
8// Licence: wxWindows license
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_MGL_FONTUTIL_H_
12#define _WX_MGL_FONTUTIL_H_
13
32b8ec41
VZ
14#include "wx/list.h"
15
16struct font_info_t;
17struct font_lib_t;
18struct font_t;
19
20class wxMGLFontInstance;
21class wxMGLFontInstanceList;
22class wxMGLFontLibrary;
23class wxMGLFontFamily;
24
25enum
26{
27 wxFONTFACE_REGULAR = 0,
28 wxFONTFACE_ITALIC = 1,
29 wxFONTFACE_BOLD = 2, // = (regular | bold)
30 wxFONTFACE_BOLD_ITALIC = 3, // = (italic | bold)
31
32 wxFONTFACE_MAX
33};
34
35// structure representing particular loaded font instance:
36class wxMGLFontInstance
37{
38public:
39 wxMGLFontInstance(wxMGLFontLibrary *fontLib, float pt, bool slant, bool aa);
40 ~wxMGLFontInstance();
41
42 struct font_t *GetMGLfont_t() const { return m_font; }
43
44 float GetPt() const { return m_pt; }
45 bool GetSlant() const { return m_slant; }
46 bool GetAA() const { return m_aa; }
47
48private:
49 wxMGLFontLibrary *m_fontLib;
50 font_t *m_font;
51 float m_pt;
52 bool m_slant;
53 bool m_aa;
54};
55
56// structure representing loaded font library:
57class wxMGLFontLibrary
58{
59public:
f3437beb 60 wxMGLFontLibrary(const wxString& filename, int type, wxMGLFontFamily *parentFamily);
32b8ec41
VZ
61 ~wxMGLFontLibrary();
62
63 wxMGLFontInstance *GetFontInstance(wxFont *font, float scale, bool aa);
f3437beb 64 wxMGLFontFamily *GetFamily() const { return m_family; }
32b8ec41
VZ
65
66 void IncRef();
67 void DecRef();
68
69 struct font_lib_t *GetMGLfont_lib_t() const { return m_fontLib; }
70
71private:
72 font_lib_t *m_fontLib;
73 int m_type;
74 wxString m_fileName;
75 size_t m_refs;
76 wxMGLFontInstanceList *m_instances;
f3437beb 77 wxMGLFontFamily *m_family;
32b8ec41
VZ
78};
79
80// structure representing native MGL font family
81class wxMGLFontFamily : public wxObject
82{
83public:
84 wxMGLFontFamily(const font_info_t *info);
85 virtual ~wxMGLFontFamily();
86
87 wxString GetName() const { return m_name; }
88 const font_info_t *GetInfo() const { return m_fontInfo; }
89
90 bool HasFace(int type) const;
91 wxMGLFontLibrary *GetLibrary(int type) const
92 { return m_fontLibs[type]; }
93
94private:
95 wxString m_name;
96 const font_info_t *m_fontInfo;
97 wxMGLFontLibrary *m_fontLibs[wxFONTFACE_MAX];
98};
99
100WX_DECLARE_LIST(wxMGLFontFamily, wxMGLFontFamilyList);
101
102class wxFontsManager
103{
104 public:
105 wxFontsManager();
106 ~wxFontsManager();
107
108 void AddFamily(const font_info_t *info);
109
110 // return info about font with given name:
111 wxMGLFontFamily *GetFamily(const wxString& name) const;
112 // return list of all families
113 wxMGLFontFamilyList *GetFamilyList() { return m_list; }
114
115 wxMGLFontLibrary *GetFontLibrary(wxFont *font);
116
117 private:
118 wxHashTable *m_hash;
119 wxMGLFontFamilyList *m_list;
120};
121
122extern wxFontsManager *wxTheFontsManager;
123
32b8ec41 124#endif // _WX_MGL_FONTUTIL_H_