1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/font.cpp
3 // Purpose: wxFont class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
17 #include "wx/string.h"
20 #include "wx/gdicmn.h"
24 #include "wx/fontutil.h"
25 #include "wx/graphics.h"
27 #include "wx/mac/uma.h"
30 #include <ATSUnicode.h>
34 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
)
37 class WXDLLEXPORT wxFontRefData
: public wxGDIRefData
42 Init(10, wxDEFAULT
, wxNORMAL
, wxNORMAL
,
43 false, wxT("applicationfont"), wxFONTENCODING_DEFAULT
);
46 wxFontRefData(const wxFontRefData
& data
)
48 Init(data
.m_pointSize
, data
.m_family
, data
.m_style
, data
.m_weight
,
49 data
.m_underlined
, data
.m_faceName
, data
.m_encoding
);
52 wxFontRefData(int size
,
57 const wxString
& faceName
,
58 wxFontEncoding encoding
)
60 Init(size
, family
, style
, weight
, underlined
, faceName
, encoding
);
63 #if wxMAC_USE_CORE_TEXT
64 wxFontRefData( wxUint32 coreTextFontType
);
65 wxFontRefData( CTFontRef font
);
66 wxFontRefData( CTFontDescriptorRef fontdescriptor
, int size
);
69 virtual ~wxFontRefData();
71 void SetNoAntiAliasing( bool no
= true ) { m_noAA
= no
; }
73 bool GetNoAntiAliasing() const { return m_noAA
; }
75 void SetPointSize( int size
)
78 MacInvalidateNativeFont();
81 int GetPointSize() const { return m_pointSize
; }
83 void SetFamily( int family
)
86 MacInvalidateNativeFont();
90 int GetFamily() const { return m_family
; }
92 void SetStyle( int style
)
95 MacInvalidateNativeFont();
99 int GetStyle() const { return m_style
; }
101 void SetWeight( int weight
)
104 MacInvalidateNativeFont();
108 int GetWeight() const { return m_weight
; }
110 void SetUnderlined( bool u
)
113 MacInvalidateNativeFont();
116 bool GetUnderlined() const { return m_underlined
; }
118 void SetFaceName( const wxString
& facename
)
120 m_faceName
= facename
;
121 MacInvalidateNativeFont();
124 const wxString
& GetFaceName() const { return m_faceName
; }
126 void SetEncoding( wxFontEncoding encoding
)
128 m_encoding
= encoding
;
129 MacInvalidateNativeFont();
132 wxFontEncoding
GetEncoding() const { return m_encoding
; }
134 void MacInvalidateNativeFont();
139 // common part of all ctors
145 const wxString
& faceName
,
146 wxFontEncoding encoding
);
148 #if wxMAC_USE_CORE_TEXT
149 void Init( CTFontRef font
);
151 // font characterstics
158 wxFontEncoding m_encoding
;
159 bool m_noAA
; // No anti-aliasing
162 #if wxMAC_USE_ATSU_TEXT
163 FMFontFamily m_macFontFamily
;
164 FMFontSize m_macFontSize
;
165 FMFontStyle m_macFontStyle
;
167 // ATSU Font Information
169 // this is split into an ATSU font id that may
170 // contain some styles (special bold fonts etc) and
171 // these are the additional qd styles that are not
172 // included in the ATSU font id
173 ATSUFontID m_macATSUFontID
;
174 FMFontStyle m_macATSUAdditionalQDStyles
;
176 // for true themeing support we must store the correct font
177 // information here, as this speeds up and optimizes rendering
178 ThemeFontID m_macThemeFontID
;
180 #if wxMAC_USE_CORE_TEXT
181 wxCFRef
<CTFontRef
> m_ctFont
;
182 wxCFRef
<CTFontDescriptorRef
> m_ctFontDescriptor
;
184 #if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
185 ATSUStyle m_macATSUStyle
;
187 wxNativeFontInfo m_info
;
190 #define M_FONTDATA ((wxFontRefData*)m_refData)
193 // ============================================================================
195 // ============================================================================
197 // ----------------------------------------------------------------------------
199 // ----------------------------------------------------------------------------
201 void wxFontRefData::Init(int pointSize
,
206 const wxString
& faceName
,
207 wxFontEncoding encoding
)
210 m_pointSize
= pointSize
;
214 m_underlined
= underlined
;
215 m_faceName
= faceName
;
216 m_encoding
= encoding
;
218 #if wxMAC_USE_ATSU_TEXT
219 m_macFontFamily
= 0 ;
223 m_macATSUAdditionalQDStyles
= 0 ;
224 m_macThemeFontID
= kThemeCurrentPortFont
;
226 #if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
227 m_macATSUStyle
= NULL
;
231 wxFontRefData::~wxFontRefData()
233 #if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
234 if ( m_macATSUStyle
)
236 ::ATSUDisposeStyle((ATSUStyle
)m_macATSUStyle
);
237 m_macATSUStyle
= NULL
;
242 void wxFontRefData::MacInvalidateNativeFont()
244 #if wxMAC_USE_CORE_TEXT
246 m_ctFontDescriptor
.reset();
248 #if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
249 if ( m_macATSUStyle
)
251 ::ATSUDisposeStyle((ATSUStyle
)m_macATSUStyle
);
252 m_macATSUStyle
= NULL
;
257 #if wxMAC_USE_CORE_TEXT
259 /* from Core Text Manual Common Operations */
261 static CTFontDescriptorRef
wxMacCreateCTFontDescriptor(CFStringRef iFamilyName
, CTFontSymbolicTraits iTraits
)
263 CTFontDescriptorRef descriptor
= NULL
;
264 CFMutableDictionaryRef attributes
;
266 assert(iFamilyName
!= NULL
);
267 // Create a mutable dictionary to hold our attributes.
268 attributes
= CFDictionaryCreateMutable(kCFAllocatorDefault
, 0,
269 &kCFTypeDictionaryKeyCallBacks
, &kCFTypeDictionaryValueCallBacks
);
270 check(attributes
!= NULL
);
272 if (attributes
!= NULL
) {
273 // Add a family name to our attributes.
274 CFDictionaryAddValue(attributes
, kCTFontFamilyNameAttribute
, iFamilyName
);
278 CFMutableDictionaryRef traits
;
279 CFNumberRef symTraits
;
281 // Create the traits dictionary.
282 symTraits
= CFNumberCreate(kCFAllocatorDefault
, kCFNumberSInt32Type
,
284 check(symTraits
!= NULL
);
286 if (symTraits
!= NULL
) {
287 // Create a dictionary to hold our traits values.
288 traits
= CFDictionaryCreateMutable(kCFAllocatorDefault
, 0,
289 &kCFTypeDictionaryKeyCallBacks
, &kCFTypeDictionaryValueCallBacks
);
290 check(traits
!= NULL
);
292 if (traits
!= NULL
) {
293 // Add the symbolic traits value to the traits dictionary.
294 CFDictionaryAddValue(traits
, kCTFontSymbolicTrait
, symTraits
);
296 // Add the traits attribute to our attributes.
297 CFDictionaryAddValue(attributes
, kCTFontTraitsAttribute
, traits
);
300 CFRelease(symTraits
);
303 // Create the font descriptor with our attributes and input size.
304 descriptor
= CTFontDescriptorCreateWithAttributes(attributes
);
305 check(descriptor
!= NULL
);
307 CFRelease(attributes
);
309 // Return our font descriptor.
313 wxFontRefData::wxFontRefData( wxUint32 coreTextFontType
)
315 CTFontRef font
= CTFontCreateUIFontForLanguage( coreTextFontType
, 0.0, NULL
) ;
316 if ( CTFontGetSize(m_ctFont
) == 0 )
319 font
= CTFontCreateUIFontForLanguage( coreTextFontType
, 12.0, NULL
);
324 wxFontRefData::wxFontRefData( CTFontRef font
)
329 wxFontRefData::wxFontRefData( CTFontDescriptorRef fontdescriptor
, int size
)
333 wxCFRef
< CFNumberRef
> value( (CFNumberRef
) CTFontDescriptorCopyAttribute( fontdescriptor
, kCTFontSizeAttribute
) );
336 if ( CFNumberGetValue( value
, kCFNumberFloatType
, &fsize
) )
338 size
= (int) fsize
+ 0.5 ;
341 Init( CTFontCreateWithFontDescriptor(fontdescriptor
, size
,NULL
) );
344 void wxFontRefData::Init( CTFontRef font
)
346 Init(10, wxDEFAULT
, wxNORMAL
, wxNORMAL
,
347 false, wxT("applicationfont"), wxFONTENCODING_DEFAULT
);
349 m_ctFont
.reset( font
);
354 void wxFontRefData::MacFindFont()
357 #if wxMAC_USE_CORE_TEXT
358 if ( UMAGetSystemVersion() >= 0x1050 )
360 if ( m_faceName
.empty() && m_family
== wxDEFAULT
)
362 m_ctFont
.reset(CTFontCreateUIFontForLanguage( kCTFontSystemFontType
, 0.0, NULL
));
365 if ( m_ctFont
.get() )
367 wxMacCFStringHolder
name( CTFontCopyFamilyName( m_ctFont
) );
368 m_faceName
= name
.AsString();
369 m_pointSize
= CTFontGetSize(m_ctFont
) ;
370 CTFontSymbolicTraits traits
= CTFontGetSymbolicTraits( m_ctFont
);
371 if ( traits
& kCTFontItalicTrait
)
373 if ( traits
& kCTFontBoldTrait
)
375 if ( !m_ctFontDescriptor
.get() )
376 m_ctFontDescriptor
.reset( CTFontCopyFontDescriptor( m_ctFont
) );
380 if ( m_faceName
.empty() )
387 m_faceName
= wxT("Times");
391 m_faceName
= wxT("Lucida Grande");
396 m_faceName
= wxT("Monaco");
400 m_faceName
= wxT("Times");
405 wxMacCFStringHolder
cf( m_faceName
, wxLocale::GetSystemEncoding() );
406 CTFontSymbolicTraits traits
= 0;
408 if (m_weight
== wxBOLD
)
409 traits
|= kCTFontBoldTrait
;
410 if (m_style
== wxITALIC
|| m_style
== wxSLANT
)
411 traits
|= kCTFontItalicTrait
;
413 m_ctFontDescriptor
.reset( wxMacCreateCTFontDescriptor( cf
, traits
) );
415 m_ctFont
.reset( CTFontCreateWithFontDescriptor( m_ctFontDescriptor
, m_pointSize
, NULL
) );
417 #if wxMAC_USE_ATSU_TEXT == 0
418 OSStatus status
= noErr
;
419 CTFontDescriptorRef desc
= m_ctFontDescriptor
;
420 ATSFontRef atsfont
= CTFontGetPlatformFont( m_ctFont
, &desc
);
421 FMFont fmfont
= FMGetFontFromATSFontRef( atsfont
);
422 ATSUAttributeTag atsuTags
[] =
426 kATSUVerticalCharacterTag
,
429 kATSUQDUnderlineTag
,
431 ByteCount atsuSizes
[sizeof(atsuTags
) / sizeof(ATSUAttributeTag
)] =
433 sizeof( ATSUFontID
) ,
435 sizeof( ATSUVerticalCharacterType
),
440 Boolean kTrue
= true ;
441 Boolean kFalse
= false ;
443 Fixed atsuSize
= IntToFixed( m_pointSize
);
444 ATSUVerticalCharacterType kHorizontal
= kATSUStronglyHorizontal
;
445 ATSUAttributeValuePtr atsuValues
[sizeof(atsuTags
) / sizeof(ATSUAttributeTag
)] =
450 (m_weight
== wxBOLD
) ? &kTrue
: &kFalse
,
451 (m_style
== wxITALIC
|| m_style
== wxSLANT
) ? &kTrue
: &kFalse
,
452 (m_underlined
) ? &kTrue
: &kFalse
,
455 if ( m_macATSUStyle
)
457 ::ATSUDisposeStyle((ATSUStyle
)m_macATSUStyle
);
458 m_macATSUStyle
= NULL
;
460 status
= ::ATSUCreateStyle((ATSUStyle
*)&m_macATSUStyle
);
461 wxASSERT_MSG( status
== noErr
, wxT("couldn't create ATSU style") );
462 status
= ::ATSUSetAttributes(
463 (ATSUStyle
)m_macATSUStyle
,
464 sizeof(atsuTags
) / sizeof(ATSUAttributeTag
) ,
465 atsuTags
, atsuSizes
, atsuValues
);
469 #if wxMAC_USE_ATSU_TEXT
471 OSStatus status
= noErr
;
473 if ( m_macThemeFontID
!= kThemeCurrentPortFont
)
476 GetThemeFont( m_macThemeFontID
, GetApplicationScript(), qdFontName
, &m_macFontSize
, &style
);
477 if ( m_macFontSize
== 0 )
479 m_macFontStyle
= style
;
480 m_faceName
= wxMacMakeStringFromPascal( qdFontName
);
481 if ( m_macFontStyle
& bold
)
484 m_weight
= wxNORMAL
;
485 if ( m_macFontStyle
& italic
)
487 if ( m_macFontStyle
& underline
)
488 m_underlined
= true ;
489 m_pointSize
= m_macFontSize
;
490 m_macFontFamily
= FMGetFontFamilyFromName( qdFontName
);
494 if ( m_faceName
.empty() )
496 if ( m_family
== wxDEFAULT
)
498 m_macFontFamily
= GetAppFont();
499 FMGetFontFamilyName(m_macFontFamily
,qdFontName
);
500 m_faceName
= wxMacMakeStringFromPascal( qdFontName
);
509 m_faceName
= wxT("Times");
513 m_faceName
= wxT("Lucida Grande");
518 m_faceName
= wxT("Monaco");
522 m_faceName
= wxT("Times");
525 wxMacStringToPascal( m_faceName
, qdFontName
);
526 m_macFontFamily
= FMGetFontFamilyFromName( qdFontName
);
527 if ( m_macFontFamily
== kInvalidFontFamily
)
529 wxLogDebug( wxT("ATSFontFamilyFindFromName failed for %s"), m_faceName
.c_str() );
530 m_macFontFamily
= GetAppFont();
536 if ( m_faceName
== wxT("systemfont") )
537 m_macFontFamily
= GetSysFont();
538 else if ( m_faceName
== wxT("applicationfont") )
539 m_macFontFamily
= GetAppFont();
542 wxMacCFStringHolder
cf( m_faceName
, wxLocale::GetSystemEncoding() );
543 ATSFontFamilyRef atsfamily
= ATSFontFamilyFindFromName( cf
, kATSOptionFlagsDefault
);
544 if ( atsfamily
== (ATSFontFamilyRef
) -1 )
546 wxLogDebug( wxT("ATSFontFamilyFindFromName failed for ") + m_faceName
);
547 m_macFontFamily
= GetAppFont();
550 m_macFontFamily
= FMGetFontFamilyFromATSFontFamilyRef( atsfamily
);
555 if (m_weight
== wxBOLD
)
556 m_macFontStyle
|= bold
;
557 if (m_style
== wxITALIC
|| m_style
== wxSLANT
)
558 m_macFontStyle
|= italic
;
560 m_macFontStyle
|= underline
;
561 m_macFontSize
= m_pointSize
;
564 // we try to get as much styles as possible into ATSU
567 // ATSUFontID and FMFont are equivalent
568 FMFontStyle intrinsicStyle
= 0 ;
569 status
= FMGetFontFromFontFamilyInstance( m_macFontFamily
, m_macFontStyle
, &m_macATSUFontID
, &intrinsicStyle
);
570 wxASSERT_MSG( status
== noErr
, wxT("couldn't get an ATSUFont from font family") );
571 m_macATSUAdditionalQDStyles
= m_macFontStyle
& (~intrinsicStyle
);
573 if ( m_macATSUStyle
)
575 ::ATSUDisposeStyle((ATSUStyle
)m_macATSUStyle
);
576 m_macATSUStyle
= NULL
;
579 status
= ::ATSUCreateStyle((ATSUStyle
*)&m_macATSUStyle
);
580 wxASSERT_MSG( status
== noErr
, wxT("couldn't create ATSU style") );
582 ATSUAttributeTag atsuTags
[] =
586 kATSUVerticalCharacterTag
,
589 kATSUQDUnderlineTag
,
590 kATSUQDCondensedTag
,
593 ByteCount atsuSizes
[sizeof(atsuTags
) / sizeof(ATSUAttributeTag
)] =
595 sizeof( ATSUFontID
) ,
597 sizeof( ATSUVerticalCharacterType
),
605 Boolean kTrue
= true ;
606 Boolean kFalse
= false ;
608 Fixed atsuSize
= IntToFixed( m_macFontSize
);
609 ATSUVerticalCharacterType kHorizontal
= kATSUStronglyHorizontal
;
610 ATSUAttributeValuePtr atsuValues
[sizeof(atsuTags
) / sizeof(ATSUAttributeTag
)] =
615 (m_macATSUAdditionalQDStyles
& bold
) ? &kTrue
: &kFalse
,
616 (m_macATSUAdditionalQDStyles
& italic
) ? &kTrue
: &kFalse
,
617 (m_macATSUAdditionalQDStyles
& underline
) ? &kTrue
: &kFalse
,
618 (m_macATSUAdditionalQDStyles
& condense
) ? &kTrue
: &kFalse
,
619 (m_macATSUAdditionalQDStyles
& extend
) ? &kTrue
: &kFalse
,
622 status
= ::ATSUSetAttributes(
623 (ATSUStyle
)m_macATSUStyle
,
624 sizeof(atsuTags
) / sizeof(ATSUAttributeTag
) ,
625 atsuTags
, atsuSizes
, atsuValues
);
627 wxASSERT_MSG( status
== noErr
, wxT("couldn't modify ATSU style") );
633 // ----------------------------------------------------------------------------
635 // ----------------------------------------------------------------------------
637 bool wxFont::Create(const wxNativeFontInfo
& info
)
640 info
.pointSize
, info
.family
, info
.style
, info
.weight
,
641 info
.underlined
, info
.faceName
, info
.encoding
);
644 wxFont::wxFont(const wxString
& fontdesc
)
646 wxNativeFontInfo info
;
647 if ( info
.FromString(fontdesc
) )
651 bool wxFont::Create(int pointSize
,
656 const wxString
& faceName
,
657 wxFontEncoding encoding
)
661 m_refData
= new wxFontRefData(
662 pointSize
, family
, style
, weight
,
663 underlined
, faceName
, encoding
);
670 #if wxMAC_USE_CORE_TEXT
672 bool wxFont::MacCreateFromUIFont(wxUint32 ctFontType
)
676 m_refData
= new wxFontRefData(ctFontType
);
682 bool wxFont::MacCreateFromCTFontDescriptor( const void * ctFontDescriptor
, int size
)
686 m_refData
= new wxFontRefData((CTFontDescriptorRef
)ctFontDescriptor
, size
);;
695 bool wxFont::MacCreateFromThemeFont(wxUint16 themeFontID
)
697 #if wxMAC_USE_CORE_TEXT
698 if ( UMAGetSystemVersion() >= 0x1050)
700 return MacCreateFromUIFont(HIThemeGetUIFontType(themeFontID
));
703 #if wxMAC_USE_ATSU_TEXT
707 m_refData
= new wxFontRefData(
708 12, wxDEFAULT
, wxFONTSTYLE_NORMAL
, wxFONTWEIGHT_NORMAL
,
709 false, wxEmptyString
, wxFONTENCODING_DEFAULT
);
711 M_FONTDATA
->m_macThemeFontID
= themeFontID
;
723 bool wxFont::RealizeResource()
725 M_FONTDATA
->MacFindFont();
730 void wxFont::SetEncoding(wxFontEncoding encoding
)
734 M_FONTDATA
->SetEncoding( encoding
);
739 void wxFont::Unshare()
741 // Don't change shared data
744 m_refData
= new wxFontRefData();
748 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
754 void wxFont::SetPointSize(int pointSize
)
756 if ( M_FONTDATA
->GetPointSize() == pointSize
)
761 M_FONTDATA
->SetPointSize( pointSize
);
766 void wxFont::SetFamily(int family
)
770 M_FONTDATA
->SetFamily( family
);
775 void wxFont::SetStyle(int style
)
779 M_FONTDATA
->SetStyle( style
);
784 void wxFont::SetWeight(int weight
)
788 M_FONTDATA
->SetWeight( weight
);
793 bool wxFont::SetFaceName(const wxString
& faceName
)
797 M_FONTDATA
->SetFaceName( faceName
);
801 return wxFontBase::SetFaceName(faceName
);
804 void wxFont::SetUnderlined(bool underlined
)
808 M_FONTDATA
->SetUnderlined( underlined
);
813 void wxFont::SetNoAntiAliasing( bool no
)
817 M_FONTDATA
->SetNoAntiAliasing( no
);
822 // ----------------------------------------------------------------------------
824 // ----------------------------------------------------------------------------
826 // TODO: insert checks everywhere for M_FONTDATA == NULL!
828 int wxFont::GetPointSize() const
830 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
832 return M_FONTDATA
->GetPointSize();
835 wxSize
wxFont::GetPixelSize() const
837 #if wxUSE_GRAPHICS_CONTEXT
838 // TODO: consider caching the value
839 wxGraphicsContext
* dc
= wxGraphicsContext::CreateFromNative((CGContextRef
) NULL
);
840 dc
->SetFont(*(wxFont
*)this,*wxBLACK
);
841 wxDouble width
, height
= 0;
842 dc
->GetTextExtent( wxT("g"), &width
, &height
, NULL
, NULL
);
844 return wxSize((int)width
, (int)height
);
846 return wxFontBase::GetPixelSize();
850 int wxFont::GetFamily() const
852 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
854 return M_FONTDATA
->GetFamily();
857 int wxFont::GetStyle() const
859 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
861 return M_FONTDATA
->GetStyle() ;
864 int wxFont::GetWeight() const
866 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
868 return M_FONTDATA
->GetWeight();
871 bool wxFont::GetUnderlined() const
873 wxCHECK_MSG( M_FONTDATA
!= NULL
, false, wxT("invalid font") );
875 return M_FONTDATA
->GetUnderlined();
878 wxString
wxFont::GetFaceName() const
880 wxCHECK_MSG( M_FONTDATA
!= NULL
, wxEmptyString
, wxT("invalid font") );
882 return M_FONTDATA
->GetFaceName() ;
885 wxFontEncoding
wxFont::GetEncoding() const
887 wxCHECK_MSG( M_FONTDATA
!= NULL
, wxFONTENCODING_DEFAULT
, wxT("invalid font") );
889 return M_FONTDATA
->GetEncoding() ;
892 bool wxFont::GetNoAntiAliasing() const
894 wxCHECK_MSG( M_FONTDATA
!= NULL
, false, wxT("invalid font") );
896 return M_FONTDATA
->GetNoAntiAliasing();
899 #if wxMAC_USE_ATSU_TEXT
901 short wxFont::MacGetFontNum() const
903 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
905 return M_FONTDATA
->m_macFontFamily
;
908 short wxFont::MacGetFontSize() const
910 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
912 return M_FONTDATA
->m_macFontSize
;
915 wxByte
wxFont::MacGetFontStyle() const
917 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
919 return M_FONTDATA
->m_macFontStyle
;
922 wxUint32
wxFont::MacGetATSUFontID() const
924 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
926 return M_FONTDATA
->m_macATSUFontID
;
929 wxUint32
wxFont::MacGetATSUAdditionalQDStyles() const
931 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
933 return M_FONTDATA
->m_macATSUAdditionalQDStyles
;
936 wxUint16
wxFont::MacGetThemeFontID() const
938 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
940 return M_FONTDATA
->m_macThemeFontID
;
944 #if wxMAC_USE_CORE_TEXT || wxMAC_USE_ATSU_TEXT
945 void * wxFont::MacGetATSUStyle() const
947 wxCHECK_MSG( M_FONTDATA
!= NULL
, NULL
, wxT("invalid font") );
949 return M_FONTDATA
->m_macATSUStyle
;
953 #if wxMAC_USE_CORE_TEXT
955 const void * wxFont::MacGetCTFont() const
957 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
959 return (CTFontRef
)(M_FONTDATA
->m_ctFont
);
962 const void * wxFont::MacGetCTFontDescriptor() const
964 wxCHECK_MSG( M_FONTDATA
!= NULL
, 0, wxT("invalid font") );
966 return (CTFontDescriptorRef
)(M_FONTDATA
->m_ctFontDescriptor
);
971 const wxNativeFontInfo
* wxFont::GetNativeFontInfo() const
973 wxCHECK_MSG( M_FONTDATA
!= NULL
, NULL
, wxT("invalid font") );
974 wxCHECK_MSG( Ok(), NULL
, wxT("invalid font") );
976 M_FONTDATA
->m_info
.InitFromFont(*this);
978 return &(M_FONTDATA
->m_info
);