]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mgl/font.cpp
Remove some out of date comments.
[wxWidgets.git] / src / mgl / font.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/mgl/font.cpp
3// Author: Vaclav Slavik
4// Id: $Id$
5// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
6// Licence: wxWindows licence
7/////////////////////////////////////////////////////////////////////////////
8
9// ============================================================================
10// declarations
11// ============================================================================
12
13// ----------------------------------------------------------------------------
14// headers
15// ----------------------------------------------------------------------------
16
17// For compilers that support precompilation, includes "wx.h".
18#include "wx/wxprec.h"
19
20#ifdef __BORLANDC__
21 #pragma hdrstop
22#endif
23
24#include "wx/font.h"
25
26#include "wx/private/fontmgr.h"
27
28// ============================================================================
29// implementation
30// ============================================================================
31
32typedef wxFontMgrFontRefData wxFontRefData;
33#define M_FONTDATA ((wxFontRefData*)m_refData)
34
35// ----------------------------------------------------------------------------
36// wxFont
37// ----------------------------------------------------------------------------
38
39bool wxFont::Create(const wxNativeFontInfo& info)
40{
41 return Create(info.pointSize, info.family, info.style, info.weight,
42 info.underlined, info.faceName, info.encoding);
43}
44
45bool wxFont::Create(int pointSize,
46 wxFontFamily family,
47 wxFontStyle style,
48 wxFontWeight weight,
49 bool underlined,
50 const wxString& face,
51 wxFontEncoding encoding)
52{
53 m_refData = new wxFontRefData(pointSize, family, style, weight,
54 underlined, face, encoding);
55 return true;
56}
57
58wxGDIRefData *wxFont::CreateGDIRefData() const
59{
60 return new wxFontRefData;
61}
62
63wxGDIRefData *wxFont::CloneGDIRefData(const wxGDIRefData *data) const
64{
65 return new wxFontRefData(*(wxFontRefData *)data);
66}
67
68
69// ----------------------------------------------------------------------------
70// accessors
71// ----------------------------------------------------------------------------
72
73struct font_t *wxFont::GetMGLfont_t(float scale, bool antialiased)
74{
75 wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") );
76
77 // we don't support DC scaling yet, so use scale=1
78 wxFontInstance *i = M_FONTDATA->GetFontInstance(1.0, antialiased);
79 return i ? i->GetMGLfont_t() : NULL;
80}
81
82int wxFont::GetPointSize() const
83{
84 wxCHECK_MSG( IsOk(), 0, wxT("invalid font") );
85
86 return M_FONTDATA->GetPointSize();
87}
88
89wxString wxFont::GetFaceName() const
90{
91 wxCHECK_MSG( IsOk(), wxEmptyString, wxT("invalid font") );
92
93 return M_FONTDATA->GetFaceName();
94}
95
96wxFontFamily wxFont::DoGetFamily() const
97{
98 return M_FONTDATA->GetFamily();
99}
100
101wxFontStyle wxFont::GetStyle() const
102{
103 wxCHECK_MSG( IsOk(), wxFONTSTYLE_MAX, wxT("invalid font") );
104
105 return M_FONTDATA->GetStyle();
106}
107
108wxFontWeight wxFont::GetWeight() const
109{
110 wxCHECK_MSG( IsOk(), wxFONTWEIGHT_MAX, wxT("invalid font") );
111
112 return M_FONTDATA->GetWeight();
113}
114
115bool wxFont::GetUnderlined() const
116{
117 wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
118
119 return M_FONTDATA->GetUnderlined();
120}
121
122
123wxFontEncoding wxFont::GetEncoding() const
124{
125 wxCHECK_MSG( IsOk(), wxFONTENCODING_DEFAULT, wxT("invalid font") );
126
127 return M_FONTDATA->GetEncoding();
128}
129
130bool wxFont::IsFixedWidth() const
131{
132 wxCHECK_MSG( IsOk(), false, wxT("invalid font") );
133
134 return M_FONTDATA->IsFixedWidth();
135}
136
137const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
138{
139 wxCHECK_MSG( IsOk(), NULL, wxT("invalid font") );
140
141 return M_FONTDATA->GetNativeFontInfo();
142}
143
144// ----------------------------------------------------------------------------
145// change font attributes
146// ----------------------------------------------------------------------------
147
148void wxFont::SetPointSize(int pointSize)
149{
150 AllocExclusive();
151 M_FONTDATA->SetPointSize(pointSize);
152}
153
154void wxFont::SetFamily(wxFontFamily family)
155{
156 AllocExclusive();
157 M_FONTDATA->SetFamily(family);
158}
159
160void wxFont::SetStyle(wxFontStyle style)
161{
162 AllocExclusive();
163 M_FONTDATA->SetStyle(style);
164}
165
166void wxFont::SetWeight(wxFontWeight weight)
167{
168 AllocExclusive();
169 M_FONTDATA->SetWeight(weight);
170}
171
172bool wxFont::SetFaceName(const wxString& faceName)
173{
174 AllocExclusive();
175 M_FONTDATA->SetFaceName(faceName);
176 return wxFontBase::SetFaceName(faceName);
177}
178
179void wxFont::SetUnderlined(bool underlined)
180{
181 AllocExclusive();
182 M_FONTDATA->SetUnderlined(underlined);
183}
184
185void wxFont::SetEncoding(wxFontEncoding encoding)
186{
187 AllocExclusive();
188 M_FONTDATA->SetEncoding(encoding);
189}
190