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