]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/font.cpp
removed deprecated wxADJUST_MINSIZE
[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 :
257 m_faceName = wxT("Monaco");
258 break ;
259
260 default:
261 m_faceName = wxT("Times");
262 break ;
263 }
4913272f 264#ifndef __LP64__
2a0155df
SC
265 wxMacStringToPascal( m_faceName , qdFontName );
266 m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
dedf5d9f
SC
267 if ( m_macFontFamily == kInvalidFontFamily )
268 {
f08b7bec 269 wxLogDebug( wxT("ATSFontFamilyFindFromName failed for %s"), m_faceName.c_str() );
dedf5d9f
SC
270 m_macFontFamily = GetAppFont();
271 }
4913272f 272#endif
facd6764 273 }
facd6764 274 }
e40298d5
JS
275 else
276 {
4913272f 277#ifndef __LP64__
facd6764 278 if ( m_faceName == wxT("systemfont") )
2a0155df 279 m_macFontFamily = GetSysFont();
facd6764 280 else if ( m_faceName == wxT("applicationfont") )
2a0155df 281 m_macFontFamily = GetAppFont();
facd6764 282 else
4913272f
SC
283#else
284 if ( m_faceName == wxT("systemfont") )
285 m_faceName = wxT("Lucida Grande");
286 else if ( m_faceName == wxT("applicationfont") )
287 m_faceName = wxT("Lucida Grande");
288#endif
facd6764 289 {
2a0155df
SC
290 wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
291 ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
5d2ad2f1
KO
292
293 // ATSFontFamilyRef is an unsigned type, so check against max
294 // for an invalid value, not -1.
295 if ( atsfamily == 0xffffffff )
dedf5d9f 296 {
5d2ad2f1 297 wxLogDebug( wxT("ATSFontFamilyFindFromName failed for ") + m_faceName );
dedf5d9f
SC
298 m_macFontFamily = GetAppFont();
299 }
300 else
301 m_macFontFamily = FMGetFontFamilyFromATSFontFamilyRef( atsfamily );
facd6764 302 }
e40298d5 303 }
facd6764
SC
304
305 m_macFontStyle = 0;
306 if (m_weight == wxBOLD)
307 m_macFontStyle |= bold;
6eaa4426 308 if (m_style == wxITALIC || m_style == wxSLANT)
facd6764 309 m_macFontStyle |= italic;
6eaa4426 310 if (m_underlined)
facd6764
SC
311 m_macFontStyle |= underline;
312 m_macFontSize = m_pointSize ;
e40298d5
JS
313 }
314
facd6764 315 // we try to get as much styles as possible into ATSU
3e527073 316
6eaa4426 317
2a0155df
SC
318 // ATSUFontID and FMFont are equivalent
319 FMFontStyle intrinsicStyle = 0 ;
4913272f 320#ifndef __LP64__
2a0155df
SC
321 status = FMGetFontFromFontFamilyInstance( m_macFontFamily , m_macFontStyle , &m_macATSUFontID , &intrinsicStyle);
322 wxASSERT_MSG( status == noErr , wxT("couldn't get an ATSUFont from font family") );
4913272f 323#endif
2a0155df 324 m_macATSUAdditionalQDStyles = m_macFontStyle & (~intrinsicStyle );
de6185e2 325
3e527073
SC
326 if ( m_macATSUStyle )
327 {
328 ::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
329 m_macATSUStyle = NULL ;
330 }
6eaa4426 331
2a0155df
SC
332 status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUStyle);
333 wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") );
6eaa4426 334
3e527073
SC
335 ATSUAttributeTag atsuTags[] =
336 {
2a0155df
SC
337 kATSUFontTag ,
338 kATSUSizeTag ,
339 kATSUVerticalCharacterTag,
340 kATSUQDBoldfaceTag ,
341 kATSUQDItalicTag ,
342 kATSUQDUnderlineTag ,
343 kATSUQDCondensedTag ,
344 kATSUQDExtendedTag ,
6eaa4426
DS
345 };
346 ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
3e527073 347 {
2a0155df
SC
348 sizeof( ATSUFontID ) ,
349 sizeof( Fixed ) ,
350 sizeof( ATSUVerticalCharacterType),
351 sizeof( Boolean ) ,
352 sizeof( Boolean ) ,
353 sizeof( Boolean ) ,
354 sizeof( Boolean ) ,
355 sizeof( Boolean ) ,
6eaa4426
DS
356 };
357
3e527073
SC
358 Boolean kTrue = true ;
359 Boolean kFalse = false ;
360
2a0155df 361 Fixed atsuSize = IntToFixed( m_macFontSize );
3e527073 362 ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
6eaa4426 363 ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
3e527073
SC
364 {
365 &m_macATSUFontID ,
366 &atsuSize ,
367 &kHorizontal,
368 (m_macATSUAdditionalQDStyles & bold) ? &kTrue : &kFalse ,
369 (m_macATSUAdditionalQDStyles & italic) ? &kTrue : &kFalse ,
370 (m_macATSUAdditionalQDStyles & underline) ? &kTrue : &kFalse ,
371 (m_macATSUAdditionalQDStyles & condense) ? &kTrue : &kFalse ,
372 (m_macATSUAdditionalQDStyles & extend) ? &kTrue : &kFalse ,
6eaa4426
DS
373 };
374
375 status = ::ATSUSetAttributes(
376 (ATSUStyle)m_macATSUStyle,
377 sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
3e527073
SC
378 atsuTags, atsuSizes, atsuValues);
379
2a0155df 380 wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
519cb848
SC
381}
382
e7549107
SC
383// ----------------------------------------------------------------------------
384// wxFont
385// ----------------------------------------------------------------------------
e9576ca5 386
5b781a67
SC
387bool wxFont::Create(const wxNativeFontInfo& info)
388{
6eaa4426
DS
389 return Create(
390 info.pointSize, info.family, info.style, info.weight,
391 info.underlined, info.faceName, info.encoding );
5b781a67
SC
392}
393
3b7e6277
GD
394wxFont::wxFont(const wxString& fontdesc)
395{
396 wxNativeFontInfo info;
397 if ( info.FromString(fontdesc) )
398 (void)Create(info);
399}
400
e7549107 401bool wxFont::Create(int pointSize,
6eaa4426
DS
402 int family,
403 int style,
404 int weight,
405 bool underlined,
406 const wxString& faceName,
407 wxFontEncoding encoding)
e9576ca5
SC
408{
409 UnRef();
6eaa4426
DS
410
411 m_refData = new wxFontRefData(
412 pointSize, family, style, weight,
413 underlined, faceName, encoding);
e9576ca5
SC
414
415 RealizeResource();
416
6eaa4426 417 return true;
e9576ca5
SC
418}
419
6eaa4426 420bool wxFont::MacCreateThemeFont(wxUint16 themeFontID)
facd6764
SC
421{
422 UnRef();
6eaa4426
DS
423
424 m_refData = new wxFontRefData(
425 12, wxDEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
426 false, wxEmptyString, wxFONTENCODING_DEFAULT );
427
facd6764
SC
428 M_FONTDATA->m_macThemeFontID = themeFontID ;
429 RealizeResource();
430
6eaa4426 431 return true;
facd6764
SC
432}
433
e9576ca5
SC
434wxFont::~wxFont()
435{
e9576ca5
SC
436}
437
438bool wxFont::RealizeResource()
439{
2a0155df 440 M_FONTDATA->MacFindFont();
6eaa4426
DS
441
442 return true;
e9576ca5
SC
443}
444
51abe921
SC
445void wxFont::SetEncoding(wxFontEncoding encoding)
446{
f08b7bec 447 AllocExclusive();
51abe921
SC
448
449 M_FONTDATA->m_encoding = encoding;
450
451 RealizeResource();
452}
453
f08b7bec 454wxObjectRefData* wxFont::CreateRefData() const
e9576ca5 455{
f08b7bec
PC
456 return new wxFontRefData;
457}
458
459wxObjectRefData* wxFont::CloneRefData(const wxObjectRefData* data) const
460{
461 return new wxFontRefData(*wx_static_cast(const wxFontRefData*, data));
e9576ca5
SC
462}
463
464void wxFont::SetPointSize(int pointSize)
465{
f08b7bec 466 AllocExclusive();
e9576ca5
SC
467
468 M_FONTDATA->m_pointSize = pointSize;
469
470 RealizeResource();
471}
472
473void wxFont::SetFamily(int family)
474{
f08b7bec 475 AllocExclusive();
e9576ca5
SC
476
477 M_FONTDATA->m_family = family;
478
479 RealizeResource();
480}
481
482void wxFont::SetStyle(int style)
483{
f08b7bec 484 AllocExclusive();
e9576ca5
SC
485
486 M_FONTDATA->m_style = style;
487
488 RealizeResource();
489}
490
491void wxFont::SetWeight(int weight)
492{
f08b7bec 493 AllocExclusive();
e9576ca5
SC
494
495 M_FONTDATA->m_weight = weight;
496
497 RealizeResource();
498}
499
85ab460e 500bool wxFont::SetFaceName(const wxString& faceName)
e9576ca5 501{
f08b7bec 502 AllocExclusive();
e9576ca5
SC
503
504 M_FONTDATA->m_faceName = faceName;
505
506 RealizeResource();
85ab460e
VZ
507
508 return wxFontBase::SetFaceName(faceName);
e9576ca5
SC
509}
510
511void wxFont::SetUnderlined(bool underlined)
512{
f08b7bec 513 AllocExclusive();
e9576ca5
SC
514
515 M_FONTDATA->m_underlined = underlined;
516
517 RealizeResource();
518}
519
ac17f9b1
SC
520void wxFont::SetNoAntiAliasing( bool no )
521{
f08b7bec 522 AllocExclusive();
ac17f9b1
SC
523
524 M_FONTDATA->SetNoAntiAliasing( no );
525
526 RealizeResource();
527}
528
e7549107
SC
529// ----------------------------------------------------------------------------
530// accessors
531// ----------------------------------------------------------------------------
532
fcb35beb
VZ
533// TODO: insert checks everywhere for M_FONTDATA == NULL!
534
e7549107 535int wxFont::GetPointSize() const
e9576ca5 536{
77eddfb7 537 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 538
e7549107 539 return M_FONTDATA->m_pointSize;
e9576ca5
SC
540}
541
ccd67a6a
KO
542wxSize wxFont::GetPixelSize() const
543{
544#if wxUSE_GRAPHICS_CONTEXT
545 // TODO: consider caching the value
546 wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef) NULL);
40503c98 547 dc->SetFont(*(wxFont *)this,*wxBLACK);
ccd67a6a 548 wxDouble width, height = 0;
8a438f46
VZ
549 dc->GetTextExtent( wxT("g"), &width, &height, NULL, NULL);
550 return wxSize((int)width, (int)height);
ccd67a6a
KO
551#else
552 wxFontBase::GetPixelSize();
553#endif
554}
555
e7549107 556int wxFont::GetFamily() const
e9576ca5 557{
77eddfb7 558 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 559
e7549107 560 return M_FONTDATA->m_family;
e9576ca5
SC
561}
562
e7549107 563int wxFont::GetStyle() const
e9576ca5 564{
77eddfb7 565 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 566
e7549107
SC
567 return M_FONTDATA->m_style;
568}
569
570int wxFont::GetWeight() const
571{
77eddfb7 572 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 573
e7549107
SC
574 return M_FONTDATA->m_weight;
575}
576
577bool wxFont::GetUnderlined() const
578{
77eddfb7 579 wxCHECK_MSG( M_FONTDATA != NULL , false, wxT("invalid font") );
6eaa4426 580
e7549107
SC
581 return M_FONTDATA->m_underlined;
582}
583
584wxString wxFont::GetFaceName() const
585{
facd6764 586 wxCHECK_MSG( M_FONTDATA != NULL , wxEmptyString , wxT("invalid font") );
6eaa4426 587
facd6764 588 return M_FONTDATA->m_faceName;
e7549107
SC
589}
590
591wxFontEncoding wxFont::GetEncoding() const
592{
facd6764 593 wxCHECK_MSG( M_FONTDATA != NULL , wxFONTENCODING_DEFAULT , wxT("invalid font") );
6eaa4426 594
e7549107 595 return M_FONTDATA->m_encoding;
e9576ca5
SC
596}
597
5ac2e80c 598bool wxFont::GetNoAntiAliasing() const
ac17f9b1 599{
77eddfb7 600 wxCHECK_MSG( M_FONTDATA != NULL , false, wxT("invalid font") );
6eaa4426 601
ac17f9b1
SC
602 return M_FONTDATA->m_noAA;
603}
604
facd6764 605short wxFont::MacGetFontNum() const
fcb35beb 606{
77eddfb7 607 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 608
2a0155df 609 return M_FONTDATA->m_macFontFamily;
fcb35beb
VZ
610}
611
facd6764 612short wxFont::MacGetFontSize() const
fcb35beb 613{
77eddfb7 614 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 615
fcb35beb
VZ
616 return M_FONTDATA->m_macFontSize;
617}
618
facd6764 619wxByte wxFont::MacGetFontStyle() const
fcb35beb 620{
77eddfb7 621 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 622
fcb35beb
VZ
623 return M_FONTDATA->m_macFontStyle;
624}
625
facd6764 626wxUint32 wxFont::MacGetATSUFontID() const
fcb35beb 627{
77eddfb7 628 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 629
fcb35beb
VZ
630 return M_FONTDATA->m_macATSUFontID;
631}
632
6eaa4426 633void * wxFont::MacGetATSUStyle() const
3e527073
SC
634{
635 wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
6eaa4426 636
3e527073
SC
637 return M_FONTDATA->m_macATSUStyle;
638}
639
facd6764
SC
640wxUint32 wxFont::MacGetATSUAdditionalQDStyles() const
641{
77eddfb7 642 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 643
facd6764
SC
644 return M_FONTDATA->m_macATSUAdditionalQDStyles;
645}
646
6eaa4426 647wxUint16 wxFont::MacGetThemeFontID() const
facd6764 648{
77eddfb7 649 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
6eaa4426 650
facd6764
SC
651 return M_FONTDATA->m_macThemeFontID;
652}
653
6eaa4426 654const wxNativeFontInfo * wxFont::GetNativeFontInfo() const
3bf5a59b 655{
facd6764 656 wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
3bf5a59b
VZ
657 wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );
658
659 M_FONTDATA->m_info.InitFromFont(*this);
660
661 return &(M_FONTDATA->m_info);
662}