]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/font.cpp
fixing 10.5 only compiles
[wxWidgets.git] / src / mac / carbon / font.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/font.cpp
3 // Purpose: wxFont class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #include "wx/font.h"
15
16 #ifndef WX_PRECOMP
17 #include "wx/string.h"
18 #include "wx/utils.h"
19 #include "wx/intl.h"
20 #include "wx/gdicmn.h"
21 #include "wx/log.h"
22 #endif
23
24 #include "wx/fontutil.h"
25 #include "wx/graphics.h"
26
27 #include "wx/mac/uma.h"
28
29 #ifndef __DARWIN__
30 #include <ATSUnicode.h>
31 #endif
32
33
34 IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
35
36
37 class WXDLLEXPORT wxFontRefData: public wxGDIRefData
38 {
39 friend class wxFont;
40
41 public:
42 wxFontRefData()
43 {
44 Init(10, wxDEFAULT, wxNORMAL, wxNORMAL,
45 false, wxT("applicationfont"), wxFONTENCODING_DEFAULT);
46 }
47
48 wxFontRefData(const wxFontRefData& data)
49 {
50 Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
51 data.m_underlined, data.m_faceName, data.m_encoding);
52 }
53
54 wxFontRefData(int size,
55 int family,
56 int style,
57 int weight,
58 bool underlined,
59 const wxString& faceName,
60 wxFontEncoding encoding)
61 {
62 Init(size, family, style, weight, underlined, faceName, encoding);
63 }
64
65 virtual ~wxFontRefData();
66
67 void SetNoAntiAliasing( bool no = true )
68 { m_noAA = no; }
69
70 bool GetNoAntiAliasing() const
71 { return m_noAA; }
72
73 void MacFindFont();
74
75 protected:
76 // common part of all ctors
77 void Init(int size,
78 int family,
79 int style,
80 int weight,
81 bool underlined,
82 const wxString& faceName,
83 wxFontEncoding encoding);
84
85 // font characterstics
86 int m_pointSize;
87 int m_family;
88 int m_style;
89 int m_weight;
90 bool m_underlined;
91 wxString m_faceName;
92 wxFontEncoding m_encoding;
93 bool m_noAA; // No anti-aliasing
94
95 public:
96 #if wxMAC_USE_ATSU_TEXT
97 FMFontFamily m_macFontFamily;
98 FMFontSize m_macFontSize;
99 FMFontStyle m_macFontStyle;
100
101 // ATSU Font Information
102
103 // this is split into an ATSU font id that may
104 // contain some styles (special bold fonts etc) and
105 // these are the additional qd styles that are not
106 // included in the ATSU font id
107 ATSUFontID m_macATSUFontID;
108 FMFontStyle m_macATSUAdditionalQDStyles ;
109
110 // for true themeing support we must store the correct font
111 // information here, as this speeds up and optimizes rendering
112 ThemeFontID m_macThemeFontID ;
113 ATSUStyle m_macATSUStyle ;
114 #endif
115 #if wxMAC_USE_CORE_TEXT
116 wxCFRef<CTFontRef> m_ctFont;
117 CTFontUIFontType m_macUIFontType;
118 #endif
119 wxNativeFontInfo m_info;
120 };
121
122 #define M_FONTDATA ((wxFontRefData*)m_refData)
123
124
125 // ============================================================================
126 // implementation
127 // ============================================================================
128
129 // ----------------------------------------------------------------------------
130 // wxFontRefData
131 // ----------------------------------------------------------------------------
132
133 void wxFontRefData::Init(int pointSize,
134 int family,
135 int style,
136 int weight,
137 bool underlined,
138 const wxString& faceName,
139 wxFontEncoding encoding)
140 {
141 m_style = style;
142 m_pointSize = pointSize;
143 m_family = family;
144 m_style = style;
145 m_weight = weight;
146 m_underlined = underlined;
147 m_faceName = faceName;
148 m_encoding = encoding;
149 m_noAA = false;
150 #if wxMAC_USE_CORE_TEXT
151 m_macUIFontType = kCTFontNoFontType;
152 #endif
153 #if wxMAC_USE_ATSU_TEXT
154 m_macFontFamily = 0 ;
155 m_macFontSize = 0;
156 m_macFontStyle = 0;
157 m_macATSUFontID = 0;
158 m_macATSUAdditionalQDStyles = 0 ;
159 m_macThemeFontID = kThemeCurrentPortFont ;
160 m_macATSUStyle = NULL ;
161 #endif
162 }
163
164 wxFontRefData::~wxFontRefData()
165 {
166 if ( m_macATSUStyle )
167 {
168 ::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
169 m_macATSUStyle = NULL ;
170 }
171 }
172
173 #if wxMAC_USE_CORE_TEXT
174
175 /* code mixed together from 2 different routines from Core Text Manual Common Operations */
176
177 static CTFontRef wxMacCreateCTFont(CFStringRef iFamilyName, CTFontSymbolicTraits iTraits, CGFloat iSize )
178 {
179 CTFontDescriptorRef descriptor = NULL;
180 CFMutableDictionaryRef attributes;
181
182 assert(iFamilyName != NULL);
183 // Create a mutable dictionary to hold our attributes.
184 attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
185 &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
186 check(attributes != NULL);
187
188 if (attributes != NULL) {
189 // Add a family name to our attributes.
190 CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, iFamilyName);
191
192
193 if ( iTraits ) {
194 CFMutableDictionaryRef traits;
195 CFNumberRef symTraits;
196
197 // Create the traits dictionary.
198 symTraits = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type,
199 &iTraits);
200 check(symTraits != NULL);
201
202 if (symTraits != NULL) {
203 // Create a dictionary to hold our traits values.
204 traits = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
205 &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
206 check(traits != NULL);
207
208 if (traits != NULL) {
209 // Add the symbolic traits value to the traits dictionary.
210 CFDictionaryAddValue(traits, kCTFontSymbolicTrait, symTraits);
211
212 // Add the traits attribute to our attributes.
213 CFDictionaryAddValue(attributes, kCTFontTraitsAttribute, traits);
214 CFRelease(traits);
215 }
216 CFRelease(symTraits);
217 }
218 }
219 // Create the font descriptor with our attributes and input size.
220 descriptor = CTFontDescriptorCreateWithAttributes(attributes);
221 check(descriptor != NULL);
222
223 CFRelease(attributes);
224 }
225 // Return our font descriptor.
226 CTFontRef font = CTFontCreateWithFontDescriptor( descriptor, iSize, NULL);
227 CFRelease( descriptor );
228 return font ;
229 }
230
231 #endif
232
233 void wxFontRefData::MacFindFont()
234 {
235 OSStatus status = noErr;
236
237 #if wxMAC_USE_CORE_TEXT
238 if ( UMAGetSystemVersion() >= 0x1050 )
239 {
240 if ( m_faceName.empty() && m_family == wxDEFAULT && m_macUIFontType == kCTFontNoFontType )
241 {
242 m_macUIFontType = kCTFontSystemFontType;
243 }
244
245 if ( m_macUIFontType != kCTFontNoFontType )
246 {
247 m_ctFont.reset(CTFontCreateUIFontForLanguage( m_macUIFontType, 0.0, NULL ));
248
249 wxMacCFStringHolder name( CTFontCopyFamilyName( m_ctFont ) );
250 m_faceName = name.AsString();
251 if ( CTFontGetSize(m_ctFont) == 0 )
252 {
253 m_ctFont.reset(CTFontCreateUIFontForLanguage( m_macUIFontType, 12, NULL ));
254 }
255
256 m_pointSize = CTFontGetSize(m_ctFont) ;
257 // reset this so that future manipulation don't fall back
258 m_macUIFontType = kCTFontNoFontType;
259 }
260 else
261 {
262 if ( m_faceName.empty() )
263 {
264 switch ( m_family )
265 {
266 case wxSCRIPT :
267 case wxROMAN :
268 case wxDECORATIVE :
269 m_faceName = wxT("Times");
270 break ;
271
272 case wxSWISS :
273 m_faceName = wxT("Lucida Grande");
274 break ;
275
276 case wxMODERN :
277 case wxTELETYPE:
278 m_faceName = wxT("Monaco");
279 break ;
280
281 default:
282 m_faceName = wxT("Times");
283 break ;
284 }
285 }
286
287 wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
288 CTFontSymbolicTraits traits = 0;
289
290 if (m_weight == wxBOLD)
291 traits |= kCTFontBoldTrait;
292 if (m_style == wxITALIC || m_style == wxSLANT)
293 traits |= kCTFontItalicTrait;
294
295 m_ctFont.reset( wxMacCreateCTFont( cf, traits, m_pointSize ) );
296 }
297 }
298 #endif
299 #if wxMAC_USE_ATSU_TEXT
300 {
301 Str255 qdFontName ;
302 if ( m_macThemeFontID != kThemeCurrentPortFont )
303 {
304 Style style ;
305 GetThemeFont( m_macThemeFontID, GetApplicationScript(), qdFontName, &m_macFontSize, &style );
306 if ( m_macFontSize == 0 )
307 m_macFontSize = 12;
308 m_macFontStyle = style ;
309 m_faceName = wxMacMakeStringFromPascal( qdFontName );
310 if ( m_macFontStyle & bold )
311 m_weight = wxBOLD ;
312 else
313 m_weight = wxNORMAL ;
314 if ( m_macFontStyle & italic )
315 m_style = wxITALIC ;
316 if ( m_macFontStyle & underline )
317 m_underlined = true ;
318 m_pointSize = m_macFontSize ;
319 m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
320 }
321 else
322 {
323 if ( m_faceName.empty() )
324 {
325 if ( m_family == wxDEFAULT )
326 {
327 m_macFontFamily = GetAppFont();
328 FMGetFontFamilyName(m_macFontFamily,qdFontName);
329 m_faceName = wxMacMakeStringFromPascal( qdFontName );
330 }
331 else
332 {
333 switch ( m_family )
334 {
335 case wxSCRIPT :
336 case wxROMAN :
337 case wxDECORATIVE :
338 m_faceName = wxT("Times");
339 break ;
340
341 case wxSWISS :
342 m_faceName = wxT("Lucida Grande");
343 break ;
344
345 case wxMODERN :
346 case wxTELETYPE:
347 m_faceName = wxT("Monaco");
348 break ;
349
350 default:
351 m_faceName = wxT("Times");
352 break ;
353 }
354 wxMacStringToPascal( m_faceName , qdFontName );
355 m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
356 if ( m_macFontFamily == kInvalidFontFamily )
357 {
358 wxLogDebug( wxT("ATSFontFamilyFindFromName failed for %s"), m_faceName.c_str() );
359 m_macFontFamily = GetAppFont();
360 }
361 }
362 }
363 else
364 {
365 if ( m_faceName == wxT("systemfont") )
366 m_macFontFamily = GetSysFont();
367 else if ( m_faceName == wxT("applicationfont") )
368 m_macFontFamily = GetAppFont();
369 else
370 {
371 wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
372 ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
373 if ( atsfamily == (ATSFontFamilyRef) -1 )
374 {
375 wxLogDebug( wxT("ATSFontFamilyFindFromName failed for ") + m_faceName );
376 m_macFontFamily = GetAppFont();
377 }
378 else
379 m_macFontFamily = FMGetFontFamilyFromATSFontFamilyRef( atsfamily );
380 }
381 }
382
383 m_macFontStyle = 0;
384 if (m_weight == wxBOLD)
385 m_macFontStyle |= bold;
386 if (m_style == wxITALIC || m_style == wxSLANT)
387 m_macFontStyle |= italic;
388 if (m_underlined)
389 m_macFontStyle |= underline;
390 m_macFontSize = m_pointSize ;
391 }
392
393 // we try to get as much styles as possible into ATSU
394
395
396 // ATSUFontID and FMFont are equivalent
397 FMFontStyle intrinsicStyle = 0 ;
398 status = FMGetFontFromFontFamilyInstance( m_macFontFamily , m_macFontStyle , &m_macATSUFontID , &intrinsicStyle);
399 wxASSERT_MSG( status == noErr , wxT("couldn't get an ATSUFont from font family") );
400 m_macATSUAdditionalQDStyles = m_macFontStyle & (~intrinsicStyle );
401
402 if ( m_macATSUStyle )
403 {
404 ::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
405 m_macATSUStyle = NULL ;
406 }
407
408 status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUStyle);
409 wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") );
410
411 ATSUAttributeTag atsuTags[] =
412 {
413 kATSUFontTag ,
414 kATSUSizeTag ,
415 kATSUVerticalCharacterTag,
416 kATSUQDBoldfaceTag ,
417 kATSUQDItalicTag ,
418 kATSUQDUnderlineTag ,
419 kATSUQDCondensedTag ,
420 kATSUQDExtendedTag ,
421 };
422 ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
423 {
424 sizeof( ATSUFontID ) ,
425 sizeof( Fixed ) ,
426 sizeof( ATSUVerticalCharacterType),
427 sizeof( Boolean ) ,
428 sizeof( Boolean ) ,
429 sizeof( Boolean ) ,
430 sizeof( Boolean ) ,
431 sizeof( Boolean ) ,
432 };
433
434 Boolean kTrue = true ;
435 Boolean kFalse = false ;
436
437 Fixed atsuSize = IntToFixed( m_macFontSize );
438 ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
439 ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
440 {
441 &m_macATSUFontID ,
442 &atsuSize ,
443 &kHorizontal,
444 (m_macATSUAdditionalQDStyles & bold) ? &kTrue : &kFalse ,
445 (m_macATSUAdditionalQDStyles & italic) ? &kTrue : &kFalse ,
446 (m_macATSUAdditionalQDStyles & underline) ? &kTrue : &kFalse ,
447 (m_macATSUAdditionalQDStyles & condense) ? &kTrue : &kFalse ,
448 (m_macATSUAdditionalQDStyles & extend) ? &kTrue : &kFalse ,
449 };
450
451 status = ::ATSUSetAttributes(
452 (ATSUStyle)m_macATSUStyle,
453 sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
454 atsuTags, atsuSizes, atsuValues);
455
456 wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
457 return;
458 }
459 #endif
460 }
461
462 // ----------------------------------------------------------------------------
463 // wxFont
464 // ----------------------------------------------------------------------------
465
466 bool wxFont::Create(const wxNativeFontInfo& info)
467 {
468 return Create(
469 info.pointSize, info.family, info.style, info.weight,
470 info.underlined, info.faceName, info.encoding );
471 }
472
473 wxFont::wxFont(const wxString& fontdesc)
474 {
475 wxNativeFontInfo info;
476 if ( info.FromString(fontdesc) )
477 (void)Create(info);
478 }
479
480 bool wxFont::Create(int pointSize,
481 int family,
482 int style,
483 int weight,
484 bool underlined,
485 const wxString& faceName,
486 wxFontEncoding encoding)
487 {
488 UnRef();
489
490 m_refData = new wxFontRefData(
491 pointSize, family, style, weight,
492 underlined, faceName, encoding);
493
494 RealizeResource();
495
496 return true;
497 }
498
499 #if wxMAC_USE_CORE_TEXT
500
501 bool wxFont::MacCreateUIFont(wxUint32 ctFontType )
502 {
503 UnRef();
504
505 m_refData = new wxFontRefData(
506 12, wxDEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
507 false, wxEmptyString, wxFONTENCODING_DEFAULT );
508
509 M_FONTDATA->m_macUIFontType = ctFontType ;
510 RealizeResource();
511
512 return true;
513 }
514
515 #endif
516
517 bool wxFont::MacCreateThemeFont(wxUint16 themeFontID)
518 {
519 #if wxMAC_USE_CORE_TEXT
520 if ( UMAGetSystemVersion() >= 0x1050)
521 {
522 return MacCreateUIFont(HIThemeGetUIFontType(themeFontID));
523 }
524 #endif
525 #if wxMAC_USE_CORE_TEXT
526 {
527 UnRef();
528
529 m_refData = new wxFontRefData(
530 12, wxDEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
531 false, wxEmptyString, wxFONTENCODING_DEFAULT );
532
533 M_FONTDATA->m_macThemeFontID = themeFontID ;
534 RealizeResource();
535 }
536 return true;
537 #endif
538 }
539
540 wxFont::~wxFont()
541 {
542 }
543
544 bool wxFont::RealizeResource()
545 {
546 M_FONTDATA->MacFindFont();
547
548 return true;
549 }
550
551 void wxFont::SetEncoding(wxFontEncoding encoding)
552 {
553 Unshare();
554
555 M_FONTDATA->m_encoding = encoding;
556
557 RealizeResource();
558 }
559
560 void wxFont::Unshare()
561 {
562 // Don't change shared data
563 if (!m_refData)
564 {
565 m_refData = new wxFontRefData();
566 }
567 else
568 {
569 wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
570 UnRef();
571 m_refData = ref;
572 }
573 }
574
575 void wxFont::SetPointSize(int pointSize)
576 {
577 if ( M_FONTDATA->m_pointSize == pointSize )
578 return;
579
580 Unshare();
581
582 M_FONTDATA->m_pointSize = pointSize;
583
584 RealizeResource();
585 }
586
587 void wxFont::SetFamily(int family)
588 {
589 Unshare();
590
591 M_FONTDATA->m_family = family;
592
593 RealizeResource();
594 }
595
596 void wxFont::SetStyle(int style)
597 {
598 Unshare();
599
600 M_FONTDATA->m_style = style;
601
602 RealizeResource();
603 }
604
605 void wxFont::SetWeight(int weight)
606 {
607 Unshare();
608
609 M_FONTDATA->m_weight = weight;
610
611 RealizeResource();
612 }
613
614 bool wxFont::SetFaceName(const wxString& faceName)
615 {
616 Unshare();
617
618 M_FONTDATA->m_faceName = faceName;
619
620 RealizeResource();
621
622 return wxFontBase::SetFaceName(faceName);
623 }
624
625 void wxFont::SetUnderlined(bool underlined)
626 {
627 Unshare();
628
629 M_FONTDATA->m_underlined = underlined;
630
631 RealizeResource();
632 }
633
634 void wxFont::SetNoAntiAliasing( bool no )
635 {
636 Unshare();
637
638 M_FONTDATA->SetNoAntiAliasing( no );
639
640 RealizeResource();
641 }
642
643 // ----------------------------------------------------------------------------
644 // accessors
645 // ----------------------------------------------------------------------------
646
647 // TODO: insert checks everywhere for M_FONTDATA == NULL!
648
649 int wxFont::GetPointSize() const
650 {
651 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
652
653 return M_FONTDATA->m_pointSize;
654 }
655
656 wxSize wxFont::GetPixelSize() const
657 {
658 #if wxUSE_GRAPHICS_CONTEXT
659 // TODO: consider caching the value
660 wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef) NULL);
661 dc->SetFont(*(wxFont *)this,*wxBLACK);
662 wxDouble width, height = 0;
663 dc->GetTextExtent( wxT("g"), &width, &height, NULL, NULL);
664 delete dc;
665 return wxSize((int)width, (int)height);
666 #else
667 return wxFontBase::GetPixelSize();
668 #endif
669 }
670
671 int wxFont::GetFamily() const
672 {
673 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
674
675 return M_FONTDATA->m_family;
676 }
677
678 int wxFont::GetStyle() const
679 {
680 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
681
682 return M_FONTDATA->m_style;
683 }
684
685 int wxFont::GetWeight() const
686 {
687 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
688
689 return M_FONTDATA->m_weight;
690 }
691
692 bool wxFont::GetUnderlined() const
693 {
694 wxCHECK_MSG( M_FONTDATA != NULL , false, wxT("invalid font") );
695
696 return M_FONTDATA->m_underlined;
697 }
698
699 wxString wxFont::GetFaceName() const
700 {
701 wxCHECK_MSG( M_FONTDATA != NULL , wxEmptyString , wxT("invalid font") );
702
703 return M_FONTDATA->m_faceName;
704 }
705
706 wxFontEncoding wxFont::GetEncoding() const
707 {
708 wxCHECK_MSG( M_FONTDATA != NULL , wxFONTENCODING_DEFAULT , wxT("invalid font") );
709
710 return M_FONTDATA->m_encoding;
711 }
712
713 bool wxFont::GetNoAntiAliasing() const
714 {
715 wxCHECK_MSG( M_FONTDATA != NULL , false, wxT("invalid font") );
716
717 return M_FONTDATA->m_noAA;
718 }
719
720 #if wxMAC_USE_ATSU_TEXT
721
722 short wxFont::MacGetFontNum() const
723 {
724 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
725
726 return M_FONTDATA->m_macFontFamily;
727 }
728
729 short wxFont::MacGetFontSize() const
730 {
731 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
732
733 return M_FONTDATA->m_macFontSize;
734 }
735
736 wxByte wxFont::MacGetFontStyle() const
737 {
738 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
739
740 return M_FONTDATA->m_macFontStyle;
741 }
742
743 wxUint32 wxFont::MacGetATSUFontID() const
744 {
745 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
746
747 return M_FONTDATA->m_macATSUFontID;
748 }
749
750 void * wxFont::MacGetATSUStyle() const
751 {
752 wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
753
754 return M_FONTDATA->m_macATSUStyle;
755 }
756
757 wxUint32 wxFont::MacGetATSUAdditionalQDStyles() const
758 {
759 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
760
761 return M_FONTDATA->m_macATSUAdditionalQDStyles;
762 }
763
764 wxUint16 wxFont::MacGetThemeFontID() const
765 {
766 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
767
768 return M_FONTDATA->m_macThemeFontID;
769 }
770 #endif
771
772 #if wxMAC_USE_CORE_TEXT
773
774 const void * wxFont::MacGetCTFont() const
775 {
776 wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
777
778 return (CTFontRef)(M_FONTDATA->m_ctFont);
779 }
780
781 #endif
782
783 const wxNativeFontInfo * wxFont::GetNativeFontInfo() const
784 {
785 wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
786 wxCHECK_MSG( Ok(), NULL, wxT("invalid font") );
787
788 M_FONTDATA->m_info.InitFromFont(*this);
789
790 return &(M_FONTDATA->m_info);
791 }