]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/font.cpp
cleanup:
[wxWidgets.git] / src / mac / carbon / font.cpp
CommitLineData
e9576ca5 1/////////////////////////////////////////////////////////////////////////////
df91131c 2// Name: src/mac/carbon/font.cpp
e9576ca5 3// Purpose: wxFont class
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3e527073
SC
12#include "wx/wxprec.h"
13
e9576ca5 14#include "wx/font.h"
df91131c
WS
15
16#ifndef WX_PRECOMP
17 #include "wx/string.h"
de6185e2 18 #include "wx/utils.h"
987e9419 19 #include "wx/intl.h"
dd05139a 20 #include "wx/gdicmn.h"
df91131c
WS
21#endif
22
5b781a67 23#include "wx/fontutil.h"
ccd67a6a 24#include "wx/graphics.h"
3b7e6277 25
76a5e5d2 26#include "wx/mac/private.h"
6eaa4426 27
768c6e8b 28#ifndef __DARWIN__
7f0c3a63 29#include <ATSUnicode.h>
768c6e8b 30#endif
76a5e5d2 31
6eaa4426 32
e9576ca5 33IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
e9576ca5 34
6eaa4426 35
3bf5a59b
VZ
36class WXDLLEXPORT wxFontRefData: public wxGDIRefData
37{
38 friend class WXDLLEXPORT wxFont;
6eaa4426 39
3bf5a59b
VZ
40public:
41 wxFontRefData()
42 : m_fontId(0)
43 , m_pointSize(10)
44 , m_family(wxDEFAULT)
45 , m_style(wxNORMAL)
46 , m_weight(wxNORMAL)
df91131c 47 , m_underlined(false)
c277569a 48 , m_faceName(wxT("applicationfont"))
3bf5a59b 49 , m_encoding(wxFONTENCODING_DEFAULT)
2a0155df 50 , m_macFontFamily(0)
3bf5a59b
VZ
51 , m_macFontSize(0)
52 , m_macFontStyle(0)
3e527073 53 , m_macATSUStyle(0)
e369bddb 54 , m_macATSUFontID(0)
3bf5a59b 55 {
c277569a
SC
56 Init(m_pointSize, m_family, m_style, m_weight,
57 m_underlined, m_faceName, m_encoding);
3bf5a59b
VZ
58 }
59
60 wxFontRefData(const wxFontRefData& data)
61 : wxGDIRefData()
62 , m_fontId(data.m_fontId)
63 , m_pointSize(data.m_pointSize)
64 , m_family(data.m_family)
65 , m_style(data.m_style)
66 , m_weight(data.m_weight)
67 , m_underlined(data.m_underlined)
68 , m_faceName(data.m_faceName)
69 , m_encoding(data.m_encoding)
2a0155df 70 , m_macFontFamily(data.m_macFontFamily)
3bf5a59b
VZ
71 , m_macFontSize(data.m_macFontSize)
72 , m_macFontStyle(data.m_macFontStyle)
3e527073 73 , m_macATSUStyle(0)
e369bddb 74 , m_macATSUFontID(data.m_macATSUFontID)
3bf5a59b
VZ
75 {
76 Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
77 data.m_underlined, data.m_faceName, data.m_encoding);
78 }
79
80 wxFontRefData(int size,
81 int family,
82 int style,
83 int weight,
84 bool underlined,
85 const wxString& faceName,
86 wxFontEncoding encoding)
87 : m_fontId(0)
88 , m_pointSize(size)
89 , m_family(family)
90 , m_style(style)
91 , m_weight(weight)
92 , m_underlined(underlined)
93 , m_faceName(faceName)
94 , m_encoding(encoding)
2a0155df 95 , m_macFontFamily(0)
3bf5a59b
VZ
96 , m_macFontSize(0)
97 , m_macFontStyle(0)
3e527073 98 , m_macATSUStyle(0)
e369bddb 99 , m_macATSUFontID(0)
3bf5a59b
VZ
100 {
101 Init(size, family, style, weight, underlined, faceName, encoding);
102 }
103
104 virtual ~wxFontRefData();
6eaa4426
DS
105
106 void SetNoAntiAliasing( bool no = true )
107 { m_noAA = no; }
108
109 bool GetNoAntiAliasing() const
110 { return m_noAA; }
111
2a0155df 112 void MacFindFont();
6eaa4426 113
3bf5a59b
VZ
114protected:
115 // common part of all ctors
116 void Init(int size,
117 int family,
118 int style,
119 int weight,
120 bool underlined,
121 const wxString& faceName,
122 wxFontEncoding encoding);
123
124 // font characterstics
e369bddb
GD
125 int m_fontId;
126 int m_pointSize;
127 int m_family;
128 int m_style;
129 int m_weight;
130 bool m_underlined;
131 wxString m_faceName;
132 wxFontEncoding m_encoding;
3bf5a59b 133 bool m_noAA; // No anti-aliasing
6eaa4426 134
3bf5a59b 135public:
2a0155df
SC
136 FMFontFamily m_macFontFamily;
137 FMFontSize m_macFontSize;
138 FMFontStyle m_macFontStyle;
6eaa4426 139
facd6764 140 // ATSU Font Information
6eaa4426 141
3103e8a9 142 // this is split into an ATSU font id that may
facd6764
SC
143 // contain some styles (special bold fonts etc) and
144 // these are the additional qd styles that are not
145 // included in the ATSU font id
3e527073 146 ATSUStyle m_macATSUStyle ;
facd6764 147 ATSUFontID m_macATSUFontID;
2a0155df 148 FMFontStyle m_macATSUAdditionalQDStyles ;
6eaa4426 149
facd6764
SC
150 // for true themeing support we must store the correct font
151 // information here, as this speeds up and optimizes rendering
152 ThemeFontID m_macThemeFontID ;
3bf5a59b 153
6eaa4426 154 wxNativeFontInfo m_info;
3bf5a59b 155};
6eaa4426 156
68c95704 157#define M_FONTDATA ((wxFontRefData*)m_refData)
873fd4af 158
6eaa4426 159
e7549107
SC
160// ============================================================================
161// implementation
162// ============================================================================
163
164// ----------------------------------------------------------------------------
165// wxFontRefData
166// ----------------------------------------------------------------------------
167
168void wxFontRefData::Init(int pointSize,
6eaa4426
DS
169 int family,
170 int style,
171 int weight,
172 bool underlined,
173 const wxString& faceName,
174 wxFontEncoding encoding)
e9576ca5 175{
e7549107
SC
176 m_style = style;
177 m_pointSize = pointSize;
178 m_family = family;
179 m_style = style;
180 m_weight = weight;
181 m_underlined = underlined;
182 m_faceName = faceName;
183 m_encoding = encoding;
184
2a0155df 185 m_macFontFamily = 0 ;
d84afea9
GD
186 m_macFontSize = 0;
187 m_macFontStyle = 0;
facd6764
SC
188 m_macATSUFontID = 0;
189 m_macATSUAdditionalQDStyles = 0 ;
3e527073 190 m_macATSUStyle = NULL ;
6eaa4426 191
facd6764 192 m_macThemeFontID = kThemeCurrentPortFont ;
6eaa4426 193 m_noAA = false;
e9576ca5
SC
194}
195
196wxFontRefData::~wxFontRefData()
197{
3e527073
SC
198 if ( m_macATSUStyle )
199 {
200 ::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
201 m_macATSUStyle = NULL ;
202 }
e9576ca5
SC
203}
204
519cb848
SC
205void wxFontRefData::MacFindFont()
206{
2a0155df 207 OSStatus status ;
de6185e2 208
2a0155df 209 Str255 qdFontName ;
6eaa4426 210 if ( m_macThemeFontID != kThemeCurrentPortFont )
e40298d5 211 {
2a0155df
SC
212 Style style ;
213 GetThemeFont( m_macThemeFontID, GetApplicationScript(), qdFontName, &m_macFontSize, &style );
214 m_macFontStyle = style ;
215 m_faceName = wxMacMakeStringFromPascal( qdFontName );
facd6764
SC
216 if ( m_macFontStyle & bold )
217 m_weight = wxBOLD ;
218 else
219 m_weight = wxNORMAL ;
220 if ( m_macFontStyle & italic )
221 m_style = wxITALIC ;
222 if ( m_macFontStyle & underline )
223 m_underlined = true ;
facd6764 224 m_pointSize = m_macFontSize ;
4913272f 225#ifndef __LP64__
2a0155df 226 m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
4913272f 227#endif
e40298d5
JS
228 }
229 else
230 {
df91131c 231 if ( m_faceName.empty() )
facd6764 232 {
2a0155df 233 if ( m_family == wxDEFAULT )
facd6764 234 {
4913272f 235#ifndef __LP64__
2a0155df
SC
236 m_macFontFamily = GetAppFont();
237 FMGetFontFamilyName(m_macFontFamily,qdFontName);
238 m_faceName = wxMacMakeStringFromPascal( qdFontName );
4913272f 239#endif
2a0155df
SC
240 }
241 else
242 {
243 switch ( m_family )
244 {
245 case wxSCRIPT :
246 case wxROMAN :
247 case wxDECORATIVE :
248 m_faceName = wxT("Times");
249 break ;
250
251 case wxSWISS :
252 m_faceName = wxT("Lucida Grande");
253 break ;
254
255 case wxMODERN :
256 m_faceName = wxT("Monaco");
257 break ;
258
259 default:
260 m_faceName = wxT("Times");
261 break ;
262 }
4913272f 263#ifndef __LP64__
2a0155df
SC
264 wxMacStringToPascal( m_faceName , qdFontName );
265 m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
4913272f 266#endif
facd6764 267 }
facd6764 268 }
e40298d5
JS
269 else
270 {
4913272f 271#ifndef __LP64__
facd6764 272 if ( m_faceName == wxT("systemfont") )
2a0155df 273 m_macFontFamily = GetSysFont();
facd6764 274 else if ( m_faceName == wxT("applicationfont") )
2a0155df 275 m_macFontFamily = GetAppFont();
facd6764 276 else
4913272f
SC
277#else
278 if ( m_faceName == wxT("systemfont") )
279 m_faceName = wxT("Lucida Grande");
280 else if ( m_faceName == wxT("applicationfont") )
281 m_faceName = wxT("Lucida Grande");
282#endif
facd6764 283 {
2a0155df
SC
284 wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
285 ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
45d5159f 286 wxASSERT_MSG( atsfamily != (ATSFontFamilyRef) -1 , wxT("ATSFontFamilyFindFromName failed") );
2a0155df 287 m_macFontFamily = FMGetFontFamilyFromATSFontFamilyRef( atsfamily );
facd6764 288 }
e40298d5 289 }
facd6764
SC
290
291 m_macFontStyle = 0;
292 if (m_weight == wxBOLD)
293 m_macFontStyle |= bold;
6eaa4426 294 if (m_style == wxITALIC || m_style == wxSLANT)
facd6764 295 m_macFontStyle |= italic;
6eaa4426 296 if (m_underlined)
facd6764
SC
297 m_macFontStyle |= underline;
298 m_macFontSize = m_pointSize ;
e40298d5
JS
299 }
300
facd6764 301 // we try to get as much styles as possible into ATSU
3e527073 302
6eaa4426 303
2a0155df
SC
304 // ATSUFontID and FMFont are equivalent
305 FMFontStyle intrinsicStyle = 0 ;
4913272f 306#ifndef __LP64__
2a0155df
SC
307 status = FMGetFontFromFontFamilyInstance( m_macFontFamily , m_macFontStyle , &m_macATSUFontID , &intrinsicStyle);
308 wxASSERT_MSG( status == noErr , wxT("couldn't get an ATSUFont from font family") );
4913272f 309#endif
2a0155df 310 m_macATSUAdditionalQDStyles = m_macFontStyle & (~intrinsicStyle );
de6185e2 311
3e527073
SC
312 if ( m_macATSUStyle )
313 {
314 ::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
315 m_macATSUStyle = NULL ;
316 }
6eaa4426 317
2a0155df
SC
318 status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUStyle);
319 wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") );
6eaa4426 320
3e527073
SC
321 ATSUAttributeTag atsuTags[] =
322 {
2a0155df
SC
323 kATSUFontTag ,
324 kATSUSizeTag ,
325 kATSUVerticalCharacterTag,
326 kATSUQDBoldfaceTag ,
327 kATSUQDItalicTag ,
328 kATSUQDUnderlineTag ,
329 kATSUQDCondensedTag ,
330 kATSUQDExtendedTag ,
6eaa4426
DS
331 };
332 ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
3e527073 333 {
2a0155df
SC
334 sizeof( ATSUFontID ) ,
335 sizeof( Fixed ) ,
336 sizeof( ATSUVerticalCharacterType),
337 sizeof( Boolean ) ,
338 sizeof( Boolean ) ,
339 sizeof( Boolean ) ,
340 sizeof( Boolean ) ,
341 sizeof( Boolean ) ,
6eaa4426
DS
342 };
343
3e527073
SC
344 Boolean kTrue = true ;
345 Boolean kFalse = false ;
346
2a0155df 347 Fixed atsuSize = IntToFixed( m_macFontSize );
3e527073 348 ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
6eaa4426 349 ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
3e527073
SC
350 {
351 &m_macATSUFontID ,
352 &atsuSize ,
353 &kHorizontal,
354 (m_macATSUAdditionalQDStyles & bold) ? &kTrue : &kFalse ,
355 (m_macATSUAdditionalQDStyles & italic) ? &kTrue : &kFalse ,
356 (m_macATSUAdditionalQDStyles & underline) ? &kTrue : &kFalse ,
357 (m_macATSUAdditionalQDStyles & condense) ? &kTrue : &kFalse ,
358 (m_macATSUAdditionalQDStyles & extend) ? &kTrue : &kFalse ,
6eaa4426
DS
359 };
360
361 status = ::ATSUSetAttributes(
362 (ATSUStyle)m_macATSUStyle,
363 sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
3e527073
SC
364 atsuTags, atsuSizes, atsuValues);
365
2a0155df 366 wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
519cb848
SC
367}
368
e7549107
SC
369// ----------------------------------------------------------------------------
370// wxFont
371// ----------------------------------------------------------------------------
e9576ca5 372
5b781a67
SC
373bool wxFont::Create(const wxNativeFontInfo& info)
374{
6eaa4426
DS
375 return Create(
376 info.pointSize, info.family, info.style, info.weight,
377 info.underlined, info.faceName, info.encoding );
5b781a67
SC
378}
379
3b7e6277
GD
380wxFont::wxFont(const wxString& fontdesc)
381{
382 wxNativeFontInfo info;
383 if ( info.FromString(fontdesc) )
384 (void)Create(info);
385}
386
e7549107 387bool wxFont::Create(int pointSize,
6eaa4426
DS
388 int family,
389 int style,
390 int weight,
391 bool underlined,
392 const wxString& faceName,
393 wxFontEncoding encoding)
e9576ca5
SC
394{
395 UnRef();
6eaa4426
DS
396
397 m_refData = new wxFontRefData(
398 pointSize, family, style, weight,
399 underlined, faceName, encoding);
e9576ca5
SC
400
401 RealizeResource();
402
6eaa4426 403 return true;
e9576ca5
SC
404}
405
6eaa4426 406bool wxFont::MacCreateThemeFont(wxUint16 themeFontID)
facd6764
SC
407{
408 UnRef();
6eaa4426
DS
409
410 m_refData = new wxFontRefData(
411 12, wxDEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
412 false, wxEmptyString, wxFONTENCODING_DEFAULT );
413
facd6764
SC
414 M_FONTDATA->m_macThemeFontID = themeFontID ;
415 RealizeResource();
416
6eaa4426 417 return true;
facd6764
SC
418}
419
e9576ca5
SC
420wxFont::~wxFont()
421{
e9576ca5
SC
422}
423
424bool wxFont::RealizeResource()
425{
2a0155df 426 M_FONTDATA->MacFindFont();
6eaa4426
DS
427
428 return true;
e9576ca5
SC
429}
430
51abe921
SC
431void wxFont::SetEncoding(wxFontEncoding encoding)
432{
433 Unshare();
434
435 M_FONTDATA->m_encoding = encoding;
436
437 RealizeResource();
438}
439
e9576ca5
SC
440void wxFont::Unshare()
441{
e40298d5
JS
442 // Don't change shared data
443 if (!m_refData)
e9576ca5 444 {
e40298d5
JS
445 m_refData = new wxFontRefData();
446 }
e9576ca5
SC
447 else
448 {
e40298d5
JS
449 wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
450 UnRef();
451 m_refData = ref;
452 }
e9576ca5
SC
453}
454
455void wxFont::SetPointSize(int pointSize)
456{
457 Unshare();
458
459 M_FONTDATA->m_pointSize = pointSize;
460
461 RealizeResource();
462}
463
464void wxFont::SetFamily(int family)
465{
466 Unshare();
467
468 M_FONTDATA->m_family = family;
469
470 RealizeResource();
471}
472
473void wxFont::SetStyle(int style)
474{
475 Unshare();
476
477 M_FONTDATA->m_style = style;
478
479 RealizeResource();
480}
481
482void wxFont::SetWeight(int weight)
483{
484 Unshare();
485
486 M_FONTDATA->m_weight = weight;
487
488 RealizeResource();
489}
490
85ab460e 491bool wxFont::SetFaceName(const wxString& faceName)
e9576ca5
SC
492{
493 Unshare();
494
495 M_FONTDATA->m_faceName = faceName;
496
497 RealizeResource();
85ab460e
VZ
498
499 return wxFontBase::SetFaceName(faceName);
e9576ca5
SC
500}
501
502void wxFont::SetUnderlined(bool underlined)
503{
504 Unshare();
505
506 M_FONTDATA->m_underlined = underlined;
507
508 RealizeResource();
509}
510
ac17f9b1
SC
511void wxFont::SetNoAntiAliasing( bool no )
512{
513 Unshare();
514
515 M_FONTDATA->SetNoAntiAliasing( no );
516
517 RealizeResource();
518}
519
e7549107
SC
520// ----------------------------------------------------------------------------
521// accessors
522// ----------------------------------------------------------------------------
523
fcb35beb
VZ
524// TODO: insert checks everywhere for M_FONTDATA == NULL!
525
e7549107 526int wxFont::GetPointSize() const
e9576ca5 527{
77eddfb7 528 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 529
e7549107 530 return M_FONTDATA->m_pointSize;
e9576ca5
SC
531}
532
ccd67a6a
KO
533wxSize wxFont::GetPixelSize() const
534{
535#if wxUSE_GRAPHICS_CONTEXT
536 // TODO: consider caching the value
537 wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef) NULL);
40503c98 538 dc->SetFont(*(wxFont *)this,*wxBLACK);
ccd67a6a 539 wxDouble width, height = 0;
8a438f46
VZ
540 dc->GetTextExtent( wxT("g"), &width, &height, NULL, NULL);
541 return wxSize((int)width, (int)height);
ccd67a6a
KO
542#else
543 wxFontBase::GetPixelSize();
544#endif
545}
546
e7549107 547int wxFont::GetFamily() const
e9576ca5 548{
77eddfb7 549 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 550
e7549107 551 return M_FONTDATA->m_family;
e9576ca5
SC
552}
553
e7549107 554int wxFont::GetStyle() const
e9576ca5 555{
77eddfb7 556 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 557
e7549107
SC
558 return M_FONTDATA->m_style;
559}
560
561int wxFont::GetWeight() const
562{
77eddfb7 563 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 564
e7549107
SC
565 return M_FONTDATA->m_weight;
566}
567
568bool wxFont::GetUnderlined() const
569{
77eddfb7 570 wxCHECK_MSG( M_FONTDATA != NULL , false, wxT("invalid font") );
6eaa4426 571
e7549107
SC
572 return M_FONTDATA->m_underlined;
573}
574
575wxString wxFont::GetFaceName() const
576{
facd6764 577 wxCHECK_MSG( M_FONTDATA != NULL , wxEmptyString , wxT("invalid font") );
6eaa4426 578
facd6764 579 return M_FONTDATA->m_faceName;
e7549107
SC
580}
581
582wxFontEncoding wxFont::GetEncoding() const
583{
facd6764 584 wxCHECK_MSG( M_FONTDATA != NULL , wxFONTENCODING_DEFAULT , wxT("invalid font") );
6eaa4426 585
e7549107 586 return M_FONTDATA->m_encoding;
e9576ca5
SC
587}
588
5ac2e80c 589bool wxFont::GetNoAntiAliasing() const
ac17f9b1 590{
77eddfb7 591 wxCHECK_MSG( M_FONTDATA != NULL , false, wxT("invalid font") );
6eaa4426 592
ac17f9b1
SC
593 return M_FONTDATA->m_noAA;
594}
595
facd6764 596short wxFont::MacGetFontNum() const
fcb35beb 597{
77eddfb7 598 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 599
2a0155df 600 return M_FONTDATA->m_macFontFamily;
fcb35beb
VZ
601}
602
facd6764 603short wxFont::MacGetFontSize() const
fcb35beb 604{
77eddfb7 605 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 606
fcb35beb
VZ
607 return M_FONTDATA->m_macFontSize;
608}
609
facd6764 610wxByte wxFont::MacGetFontStyle() const
fcb35beb 611{
77eddfb7 612 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 613
fcb35beb
VZ
614 return M_FONTDATA->m_macFontStyle;
615}
616
facd6764 617wxUint32 wxFont::MacGetATSUFontID() const
fcb35beb 618{
77eddfb7 619 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 620
fcb35beb
VZ
621 return M_FONTDATA->m_macATSUFontID;
622}
623
6eaa4426 624void * wxFont::MacGetATSUStyle() const
3e527073
SC
625{
626 wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
6eaa4426 627
3e527073
SC
628 return M_FONTDATA->m_macATSUStyle;
629}
630
facd6764
SC
631wxUint32 wxFont::MacGetATSUAdditionalQDStyles() const
632{
77eddfb7 633 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 634
facd6764
SC
635 return M_FONTDATA->m_macATSUAdditionalQDStyles;
636}
637
6eaa4426 638wxUint16 wxFont::MacGetThemeFontID() const
facd6764 639{
77eddfb7 640 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 641
facd6764
SC
642 return M_FONTDATA->m_macThemeFontID;
643}
644
6eaa4426 645const wxNativeFontInfo * wxFont::GetNativeFontInfo() const
3bf5a59b 646{
facd6764 647 wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
3bf5a59b
VZ
648 wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );
649
650 M_FONTDATA->m_info.InitFromFont(*this);
651
652 return &(M_FONTDATA->m_info);
653}