Applied #8697 (Improve error detection for MacFindFont )
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@62122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -226,6 +226,8 @@ void wxFontRefData::MacFindFont()
|
||||
OSStatus status = noErr;
|
||||
Str255 qdFontName ;
|
||||
|
||||
wxCHECK_RET( m_pointSize > 0, wxT("Point size should not be zero.") );
|
||||
|
||||
#ifdef __LP64__
|
||||
if ( m_faceName.empty() && m_family == wxDEFAULT )
|
||||
{
|
||||
@@ -235,7 +237,7 @@ void wxFontRefData::MacFindFont()
|
||||
if ( m_macUIFontType != kCTFontNoFontType )
|
||||
{
|
||||
m_macFontRef = CTFontCreateUIFontForLanguage( m_macUIFontType, 0.0, NULL );
|
||||
wxMacCFStringHolder name( CTFontCopyFamilyName( m_macFontRef ) );
|
||||
wxMacCFStringHolder name( CTFontCopyFamilyName( m_macFontRef ) );
|
||||
m_faceName = name.AsString();
|
||||
}
|
||||
else
|
||||
@@ -305,17 +307,17 @@ void wxFontRefData::MacFindFont()
|
||||
Boolean kFalse = false ;
|
||||
|
||||
Fixed atsuSize = IntToFixed( m_pointSize );
|
||||
short m_macATSUAdditionalQDStyles = 0;
|
||||
short m_macATSUAdditionalQDStyles = 0;
|
||||
ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
|
||||
ATSUFontID atsuFontID = 0;
|
||||
int attributeCount = sizeof(atsuTags) / sizeof(ATSUAttributeTag) ;
|
||||
ATSUFontID atsuFontID = 0;
|
||||
int attributeCount = sizeof(atsuTags) / sizeof(ATSUAttributeTag) ;
|
||||
|
||||
// attempt to add atsu font
|
||||
status = ATSUFindFontFromName(m_faceName.c_str(), strlen(m_faceName.c_str()), kFontFamilyName, kFontNoPlatform, kFontNoScript, kFontNoLanguage, &atsuFontID);
|
||||
if ( status != noErr )
|
||||
{
|
||||
attributeCount--;
|
||||
}
|
||||
// attempt to add atsu font
|
||||
status = ATSUFindFontFromName(m_faceName.c_str(), strlen(m_faceName.c_str()), kFontFamilyName, kFontNoPlatform, kFontNoScript, kFontNoLanguage, &atsuFontID);
|
||||
if ( status != noErr )
|
||||
{
|
||||
attributeCount--;
|
||||
}
|
||||
|
||||
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
|
||||
{
|
||||
@@ -326,12 +328,11 @@ void wxFontRefData::MacFindFont()
|
||||
(m_macATSUAdditionalQDStyles & underline) ? &kTrue : &kFalse ,
|
||||
(m_macATSUAdditionalQDStyles & condense) ? &kTrue : &kFalse ,
|
||||
(m_macATSUAdditionalQDStyles & extend) ? &kTrue : &kFalse ,
|
||||
&atsuFontID ,
|
||||
&atsuFontID ,
|
||||
};
|
||||
|
||||
status = ::ATSUSetAttributes( (ATSUStyle)m_macATSUStyle, attributeCount, atsuTags, atsuSizes, atsuValues);
|
||||
|
||||
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
|
||||
wxASSERT_MSG( status == noErr , wxString::Format(wxT("couldn't modify ATSU style. Status was %d"), (int) status).c_str() );
|
||||
#else
|
||||
if ( m_macThemeFontID != kThemeCurrentPortFont )
|
||||
{
|
||||
@@ -547,7 +548,7 @@ bool wxFont::MacCreateUIFont(wxUint32 ctFontType )
|
||||
bool wxFont::MacCreateThemeFont(wxUint16 themeFontID)
|
||||
{
|
||||
#ifdef __LP64__
|
||||
return MacCreateUIFont(HIThemeGetUIFontType(themeFontID));
|
||||
return MacCreateUIFont(HIThemeGetUIFontType(themeFontID));
|
||||
#else
|
||||
UnRef();
|
||||
|
||||
|
Reference in New Issue
Block a user