Remove ATSU-related dead code from wxOSX
ATSU was deprecated for a long time and was finally removed from OS X SDK in 10.11. wxOSX_USE_ATSU_TEXT was unconditionally disabled already, so the code was never used and can be safely removed.
This commit is contained in:
@@ -158,21 +158,10 @@ public:
|
|||||||
wxFontEncoding encoding);
|
wxFontEncoding encoding);
|
||||||
|
|
||||||
void Free();
|
void Free();
|
||||||
void EnsureValid();
|
|
||||||
|
|
||||||
static void UpdateNamesMap(const wxString& familyname, CTFontDescriptorRef descr);
|
static void UpdateNamesMap(const wxString& familyname, CTFontDescriptorRef descr);
|
||||||
static void UpdateNamesMap(const wxString& familyname, CTFontRef font);
|
static void UpdateNamesMap(const wxString& familyname, CTFontRef font);
|
||||||
|
|
||||||
bool m_descriptorValid;
|
|
||||||
|
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
bool m_atsuFontValid;
|
|
||||||
// the atsu font ID
|
|
||||||
wxUint32 m_atsuFontID;
|
|
||||||
// the qd styles that are not intrinsic to the font above
|
|
||||||
wxInt16 m_atsuAdditionalQDStyles;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int m_pointSize;
|
int m_pointSize;
|
||||||
wxFontFamily m_family;
|
wxFontFamily m_family;
|
||||||
wxFontStyle m_style;
|
wxFontStyle m_style;
|
||||||
|
@@ -26,12 +26,6 @@
|
|||||||
#define wxOSX_USE_NATIVE_FLIPPED 1
|
#define wxOSX_USE_NATIVE_FLIPPED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* text rendering system
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define wxOSX_USE_ATSU_TEXT 0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Audio System
|
* Audio System
|
||||||
*/
|
*/
|
||||||
|
@@ -145,15 +145,6 @@ public:
|
|||||||
|
|
||||||
CTFontRef OSXGetCTFont() const;
|
CTFontRef OSXGetCTFont() const;
|
||||||
|
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
// Returns an ATSUStyle not ATSUStyle*
|
|
||||||
void* MacGetATSUStyle() const ;
|
|
||||||
void* OSXGetATSUStyle() const { return MacGetATSUStyle() ; }
|
|
||||||
|
|
||||||
wxDEPRECATED( wxUint32 MacGetATSUFontID() const );
|
|
||||||
wxDEPRECATED( wxUint32 MacGetATSUAdditionalQDStyles() const );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
WX_NSFont OSXGetNSFont() const;
|
WX_NSFont OSXGetNSFont() const;
|
||||||
static WX_NSFont OSXCreateNSFont(wxOSXSystemFont font, wxNativeFontInfo* info);
|
static WX_NSFont OSXCreateNSFont(wxOSXSystemFont font, wxNativeFontInfo* info);
|
||||||
|
@@ -19,7 +19,6 @@
|
|||||||
* under a certain platform
|
* under a certain platform
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define wxOSX_USE_ATSU_TEXT 0
|
|
||||||
#define wxHAS_OPENGL_ES
|
#define wxHAS_OPENGL_ES
|
||||||
|
|
||||||
#define wxOSX_USE_QUICKTIME 0
|
#define wxOSX_USE_QUICKTIME 0
|
||||||
|
@@ -158,11 +158,6 @@ protected:
|
|||||||
public:
|
public:
|
||||||
bool m_fontValid;
|
bool m_fontValid;
|
||||||
wxCFRef<CTFontRef> m_ctFont;
|
wxCFRef<CTFontRef> m_ctFont;
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
void CreateATSUFont();
|
|
||||||
|
|
||||||
ATSUStyle m_macATSUStyle ;
|
|
||||||
#endif
|
|
||||||
wxCFRef<CGFontRef> m_cgFont;
|
wxCFRef<CGFontRef> m_cgFont;
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
WX_NSFont m_nsFont;
|
WX_NSFont m_nsFont;
|
||||||
@@ -182,13 +177,6 @@ wxFontRefData::wxFontRefData(const wxFontRefData& data) : wxGDIRefData()
|
|||||||
m_fontValid = data.m_fontValid;
|
m_fontValid = data.m_fontValid;
|
||||||
m_ctFont = data.m_ctFont;
|
m_ctFont = data.m_ctFont;
|
||||||
m_cgFont = data.m_cgFont;
|
m_cgFont = data.m_cgFont;
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
if ( data.m_macATSUStyle != NULL )
|
|
||||||
{
|
|
||||||
ATSUCreateStyle(&m_macATSUStyle) ;
|
|
||||||
ATSUCopyAttributes(data.m_macATSUStyle, m_macATSUStyle);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
m_nsFont = (NSFont*) wxMacCocoaRetain(data.m_nsFont);
|
m_nsFont = (NSFont*) wxMacCocoaRetain(data.m_nsFont);
|
||||||
#endif
|
#endif
|
||||||
@@ -211,9 +199,6 @@ static CTFontDescriptorRef wxMacCreateCTFontDescriptor(CFStringRef iFamilyName,
|
|||||||
|
|
||||||
void wxFontRefData::Init()
|
void wxFontRefData::Init()
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
m_macATSUStyle = NULL ;
|
|
||||||
#endif
|
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
m_nsFont = NULL;
|
m_nsFont = NULL;
|
||||||
#endif
|
#endif
|
||||||
@@ -232,13 +217,6 @@ void wxFontRefData::Free()
|
|||||||
{
|
{
|
||||||
m_ctFont.reset();
|
m_ctFont.reset();
|
||||||
m_cgFont.reset();
|
m_cgFont.reset();
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
if ( m_macATSUStyle )
|
|
||||||
{
|
|
||||||
::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
|
|
||||||
m_macATSUStyle = NULL ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
if (m_nsFont != NULL)
|
if (m_nsFont != NULL)
|
||||||
{
|
{
|
||||||
@@ -297,151 +275,17 @@ wxFontRefData::wxFontRefData(wxOSXSystemFont font, int size)
|
|||||||
descr.reset( CTFontCopyFontDescriptor( m_ctFont ) );
|
descr.reset( CTFontCopyFontDescriptor( m_ctFont ) );
|
||||||
m_info.Init(descr);
|
m_info.Init(descr);
|
||||||
}
|
}
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
{
|
|
||||||
// not needed outside
|
|
||||||
ThemeFontID m_macThemeFontID = kThemeSystemFont;
|
|
||||||
switch( font )
|
|
||||||
{
|
|
||||||
case wxOSX_SYSTEM_FONT_NORMAL:
|
|
||||||
m_macThemeFontID = kThemeSystemFont;
|
|
||||||
break;
|
|
||||||
case wxOSX_SYSTEM_FONT_BOLD:
|
|
||||||
m_macThemeFontID = kThemeEmphasizedSystemFont;
|
|
||||||
break;
|
|
||||||
case wxOSX_SYSTEM_FONT_SMALL:
|
|
||||||
m_macThemeFontID = kThemeSmallSystemFont;
|
|
||||||
break;
|
|
||||||
case wxOSX_SYSTEM_FONT_SMALL_BOLD:
|
|
||||||
m_macThemeFontID = kThemeSmallEmphasizedSystemFont;
|
|
||||||
break;
|
|
||||||
case wxOSX_SYSTEM_FONT_MINI:
|
|
||||||
m_macThemeFontID = kThemeMiniSystemFont;
|
|
||||||
break;
|
|
||||||
case wxOSX_SYSTEM_FONT_MINI_BOLD:
|
|
||||||
// bold not available under theming
|
|
||||||
m_macThemeFontID = kThemeMiniSystemFont;
|
|
||||||
break;
|
|
||||||
case wxOSX_SYSTEM_FONT_LABELS:
|
|
||||||
m_macThemeFontID = kThemeLabelFont;
|
|
||||||
break;
|
|
||||||
case wxOSX_SYSTEM_FONT_VIEWS:
|
|
||||||
m_macThemeFontID = kThemeViewsFont;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( m_info.m_faceName.empty() )
|
|
||||||
{
|
|
||||||
Style style ;
|
|
||||||
FMFontSize fontSize;
|
|
||||||
Str255 qdFontName ;
|
|
||||||
|
|
||||||
GetThemeFont( m_macThemeFontID, GetApplicationScript(), qdFontName, &fontSize, &style );
|
|
||||||
if ( size != 0 )
|
|
||||||
fontSize = size;
|
|
||||||
|
|
||||||
wxFontStyle fontstyle = wxFONTSTYLE_NORMAL;
|
|
||||||
wxFontWeight fontweight = wxFONTWEIGHT_NORMAL;
|
|
||||||
bool underlined = false;
|
|
||||||
bool strikethrough = false;
|
|
||||||
|
|
||||||
if ( style & bold )
|
|
||||||
fontweight = wxFONTWEIGHT_BOLD ;
|
|
||||||
else
|
|
||||||
fontweight = wxFONTWEIGHT_NORMAL ;
|
|
||||||
if ( style & italic )
|
|
||||||
fontstyle = wxFONTSTYLE_ITALIC ;
|
|
||||||
if ( style & underline )
|
|
||||||
underlined = true ;
|
|
||||||
|
|
||||||
m_info.Init(fontSize,wxFONTFAMILY_DEFAULT,fontstyle,
|
|
||||||
fontweight,underlined, strikethrough,
|
|
||||||
wxMacMakeStringFromPascal( qdFontName ), wxFONTENCODING_DEFAULT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
m_nsFont = wxFont::OSXCreateNSFont( font, &m_info );
|
m_nsFont = wxFont::OSXCreateNSFont( font, &m_info );
|
||||||
#endif
|
#endif
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
m_uiFont = wxFont::OSXCreateUIFont( font, &m_info );
|
m_uiFont = wxFont::OSXCreateUIFont( font, &m_info );
|
||||||
#endif
|
#endif
|
||||||
m_info.EnsureValid();
|
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
CreateATSUFont();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_fontValid = true;
|
m_fontValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
void wxFontRefData::CreateATSUFont()
|
|
||||||
{
|
|
||||||
// we try to get as much styles as possible into ATSU
|
|
||||||
|
|
||||||
OSStatus status = ::ATSUCreateStyle(&m_macATSUStyle);
|
|
||||||
wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") );
|
|
||||||
|
|
||||||
ATSUAttributeTag atsuTags[] =
|
|
||||||
{
|
|
||||||
kATSUFontTag ,
|
|
||||||
kATSUSizeTag ,
|
|
||||||
kATSUVerticalCharacterTag,
|
|
||||||
kATSUQDBoldfaceTag ,
|
|
||||||
kATSUQDItalicTag ,
|
|
||||||
kATSUQDUnderlineTag ,
|
|
||||||
kATSUQDCondensedTag ,
|
|
||||||
kATSUQDExtendedTag ,
|
|
||||||
kATSUStyleStrikeThroughTag
|
|
||||||
};
|
|
||||||
ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
|
|
||||||
{
|
|
||||||
sizeof( ATSUFontID ) ,
|
|
||||||
sizeof( Fixed ) ,
|
|
||||||
sizeof( ATSUVerticalCharacterType),
|
|
||||||
sizeof( Boolean ) ,
|
|
||||||
sizeof( Boolean ) ,
|
|
||||||
sizeof( Boolean ) ,
|
|
||||||
sizeof( Boolean ) ,
|
|
||||||
sizeof( Boolean ) ,
|
|
||||||
sizeof( Boolean )
|
|
||||||
};
|
|
||||||
|
|
||||||
Boolean kTrue = true ;
|
|
||||||
Boolean kFalse = false ;
|
|
||||||
|
|
||||||
Fixed atsuSize = IntToFixed( m_info.m_pointSize );
|
|
||||||
ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
|
|
||||||
FMFontStyle addQDStyle = m_info.m_atsuAdditionalQDStyles;
|
|
||||||
ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
|
|
||||||
{
|
|
||||||
&m_info.m_atsuFontID ,
|
|
||||||
&atsuSize ,
|
|
||||||
&kHorizontal,
|
|
||||||
(addQDStyle & bold) ? &kTrue : &kFalse ,
|
|
||||||
(addQDStyle & italic) ? &kTrue : &kFalse ,
|
|
||||||
(addQDStyle & underline) ? &kTrue : &kFalse ,
|
|
||||||
(addQDStyle & condense) ? &kTrue : &kFalse ,
|
|
||||||
(addQDStyle & extend) ? &kTrue : &kFalse ,
|
|
||||||
m_info.m_strikethrough ? & kTrue : &kFalse
|
|
||||||
};
|
|
||||||
|
|
||||||
status = ::ATSUSetAttributes(
|
|
||||||
(ATSUStyle)m_macATSUStyle,
|
|
||||||
WXSIZEOF(atsuTags),
|
|
||||||
atsuTags, atsuSizes, atsuValues);
|
|
||||||
|
|
||||||
wxASSERT_MSG( status == noErr , wxString::Format(wxT("couldn't modify ATSU style. Status was %d"), (int) status).c_str() );
|
|
||||||
|
|
||||||
if ( m_cgFont.get() == NULL )
|
|
||||||
{
|
|
||||||
ATSFontRef fontRef = FMGetATSFontRefFromFont(m_info.m_atsuFontID);
|
|
||||||
m_cgFont.reset( CGFontCreateWithPlatformFont( &fontRef ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const CGAffineTransform kSlantTransform = CGAffineTransformMake( 1, 0, tan(wxDegToRad(11)), 1, 0, 0 );
|
static const CGAffineTransform kSlantTransform = CGAffineTransformMake( 1, 0, tan(wxDegToRad(11)), 1, 0, 0 );
|
||||||
|
|
||||||
void wxFontRefData::MacFindFont()
|
void wxFontRefData::MacFindFont()
|
||||||
@@ -451,8 +295,6 @@ void wxFontRefData::MacFindFont()
|
|||||||
|
|
||||||
wxCHECK_RET( m_info.m_pointSize > 0, wxT("Point size should not be zero.") );
|
wxCHECK_RET( m_info.m_pointSize > 0, wxT("Point size should not be zero.") );
|
||||||
|
|
||||||
m_info.EnsureValid();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
CTFontSymbolicTraits traits = 0;
|
CTFontSymbolicTraits traits = 0;
|
||||||
|
|
||||||
@@ -528,9 +370,6 @@ void wxFontRefData::MacFindFont()
|
|||||||
|
|
||||||
m_cgFont.reset(CTFontCopyGraphicsFont(m_ctFont, NULL));
|
m_cgFont.reset(CTFontCopyGraphicsFont(m_ctFont, NULL));
|
||||||
}
|
}
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
CreateATSUFont();
|
|
||||||
#endif
|
|
||||||
#if wxOSX_USE_COCOA
|
#if wxOSX_USE_COCOA
|
||||||
m_nsFont = wxFont::OSXCreateNSFont( &m_info );
|
m_nsFont = wxFont::OSXCreateNSFont( &m_info );
|
||||||
#endif
|
#endif
|
||||||
@@ -810,38 +649,6 @@ wxFontEncoding wxFont::GetEncoding() const
|
|||||||
return M_FONTDATA->GetEncoding() ;
|
return M_FONTDATA->GetEncoding() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
void * wxFont::MacGetATSUStyle() const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( M_FONTDATA != NULL , NULL, wxT("invalid font") );
|
|
||||||
|
|
||||||
// cast away constness otherwise lazy font resolution is not possible
|
|
||||||
const_cast<wxFont *>(this)->RealizeResource();
|
|
||||||
|
|
||||||
return M_FONTDATA->m_macATSUStyle;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxUint32 wxFont::MacGetATSUFontID() const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( M_FONTDATA != NULL, 0, wxT("invalid font") );
|
|
||||||
|
|
||||||
// cast away constness otherwise lazy font resolution is not possible
|
|
||||||
const_cast<wxFont *>(this)->RealizeResource();
|
|
||||||
|
|
||||||
return M_FONTDATA->m_info.m_atsuFontID;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxUint32 wxFont::MacGetATSUAdditionalQDStyles() const
|
|
||||||
{
|
|
||||||
wxCHECK_MSG( M_FONTDATA != NULL, 0, wxT("invalid font") );
|
|
||||||
|
|
||||||
// cast away constness otherwise lazy font resolution is not possible
|
|
||||||
const_cast<wxFont *>(this)->RealizeResource();
|
|
||||||
|
|
||||||
return M_FONTDATA->m_info.m_atsuAdditionalQDStyles;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CTFontRef wxFont::OSXGetCTFont() const
|
CTFontRef wxFont::OSXGetCTFont() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
|
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
|
||||||
@@ -969,11 +776,6 @@ static CTFontDescriptorRef wxMacCreateCTFontDescriptor(CFStringRef iFamilyName,
|
|||||||
|
|
||||||
void wxNativeFontInfo::Init()
|
void wxNativeFontInfo::Init()
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
m_atsuFontID = 0 ;
|
|
||||||
m_atsuAdditionalQDStyles = 0;
|
|
||||||
m_atsuFontValid = false;
|
|
||||||
#endif
|
|
||||||
m_pointSize = 0;
|
m_pointSize = 0;
|
||||||
m_family = wxFONTFAMILY_DEFAULT;
|
m_family = wxFONTFAMILY_DEFAULT;
|
||||||
m_style = wxFONTSTYLE_NORMAL;
|
m_style = wxFONTSTYLE_NORMAL;
|
||||||
@@ -982,7 +784,6 @@ void wxNativeFontInfo::Init()
|
|||||||
m_strikethrough = false;
|
m_strikethrough = false;
|
||||||
m_faceName.clear();
|
m_faceName.clear();
|
||||||
m_encoding = wxFont::GetDefaultEncoding();
|
m_encoding = wxFont::GetDefaultEncoding();
|
||||||
m_descriptorValid = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNativeFontInfo::Init(CTFontDescriptorRef descr)
|
void wxNativeFontInfo::Init(CTFontDescriptorRef descr)
|
||||||
@@ -1010,62 +811,9 @@ void wxNativeFontInfo::Init(CTFontDescriptorRef descr)
|
|||||||
UpdateNamesMap(m_faceName, descr);
|
UpdateNamesMap(m_faceName, descr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNativeFontInfo::EnsureValid()
|
|
||||||
{
|
|
||||||
if ( m_descriptorValid )
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
if ( !m_atsuFontValid )
|
|
||||||
{
|
|
||||||
// not needed outside
|
|
||||||
wxInt16 m_qdFontFamily;
|
|
||||||
wxInt16 m_qdFontStyle;
|
|
||||||
wxCFStringRef cf( m_faceName, wxLocale::GetSystemEncoding() );
|
|
||||||
ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
|
|
||||||
if ( atsfamily == (ATSFontFamilyRef) -1 )
|
|
||||||
{
|
|
||||||
wxLogDebug( wxT("ATSFontFamilyFindFromName failed for ") + m_faceName );
|
|
||||||
m_qdFontFamily = GetAppFont();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_qdFontFamily = FMGetFontFamilyFromATSFontFamilyRef( atsfamily );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_qdFontStyle = 0;
|
|
||||||
if (m_weight == wxFONTWEIGHT_BOLD)
|
|
||||||
m_qdFontStyle |= bold;
|
|
||||||
if (m_style == wxFONTSTYLE_ITALIC || m_style == wxFONTSTYLE_SLANT)
|
|
||||||
m_qdFontStyle |= italic;
|
|
||||||
if (m_underlined)
|
|
||||||
m_qdFontStyle |= underline;
|
|
||||||
|
|
||||||
|
|
||||||
// we try to get as much styles as possible into ATSU
|
|
||||||
|
|
||||||
// ATSUFontID and FMFont are equivalent
|
|
||||||
FMFontStyle intrinsicStyle = 0 ;
|
|
||||||
OSStatus status = FMGetFontFromFontFamilyInstance( m_qdFontFamily , m_qdFontStyle , (FMFont*)&m_atsuFontID , &intrinsicStyle);
|
|
||||||
if ( status != noErr )
|
|
||||||
{
|
|
||||||
wxFAIL_MSG( wxT("couldn't get an ATSUFont from font family") );
|
|
||||||
}
|
|
||||||
m_atsuAdditionalQDStyles = m_qdFontStyle & (~intrinsicStyle );
|
|
||||||
m_atsuFontValid = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
m_descriptorValid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxNativeFontInfo::Init(const wxNativeFontInfo& info)
|
void wxNativeFontInfo::Init(const wxNativeFontInfo& info)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
m_atsuFontValid = info.m_atsuFontValid;
|
|
||||||
m_atsuFontID = info.m_atsuFontID ;
|
|
||||||
m_atsuAdditionalQDStyles = info.m_atsuAdditionalQDStyles;
|
|
||||||
#endif
|
|
||||||
m_pointSize = info.m_pointSize;
|
m_pointSize = info.m_pointSize;
|
||||||
m_family = info.m_family;
|
m_family = info.m_family;
|
||||||
m_style = info.m_style;
|
m_style = info.m_style;
|
||||||
@@ -1074,7 +822,6 @@ void wxNativeFontInfo::Init(const wxNativeFontInfo& info)
|
|||||||
m_strikethrough = info.m_strikethrough;
|
m_strikethrough = info.m_strikethrough;
|
||||||
m_faceName = info.m_faceName;
|
m_faceName = info.m_faceName;
|
||||||
m_encoding = info.m_encoding;
|
m_encoding = info.m_encoding;
|
||||||
m_descriptorValid = info.m_descriptorValid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNativeFontInfo::Init(int size,
|
void wxNativeFontInfo::Init(int size,
|
||||||
@@ -1111,12 +858,6 @@ void wxNativeFontInfo::Init(int size,
|
|||||||
|
|
||||||
void wxNativeFontInfo::Free()
|
void wxNativeFontInfo::Free()
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
m_atsuFontID = 0 ;
|
|
||||||
m_atsuAdditionalQDStyles = 0;
|
|
||||||
m_atsuFontValid = false;
|
|
||||||
#endif
|
|
||||||
m_descriptorValid = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNativeFontInfo::FromString(const wxString& s)
|
bool wxNativeFontInfo::FromString(const wxString& s)
|
||||||
|
@@ -823,9 +823,6 @@ public:
|
|||||||
wxMacCoreGraphicsFontData( wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col );
|
wxMacCoreGraphicsFontData( wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col );
|
||||||
~wxMacCoreGraphicsFontData();
|
~wxMacCoreGraphicsFontData();
|
||||||
|
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
virtual ATSUStyle GetATSUStyle() { return m_macATSUIStyle; }
|
|
||||||
#endif
|
|
||||||
CTFontRef OSXGetCTFont() const { return m_ctFont ; }
|
CTFontRef OSXGetCTFont() const { return m_ctFont ; }
|
||||||
wxColour GetColour() const { return m_colour ; }
|
wxColour GetColour() const { return m_colour ; }
|
||||||
|
|
||||||
@@ -839,9 +836,6 @@ private :
|
|||||||
wxColour m_colour;
|
wxColour m_colour;
|
||||||
bool m_underlined,
|
bool m_underlined,
|
||||||
m_strikethrough;
|
m_strikethrough;
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
ATSUStyle m_macATSUIStyle;
|
|
||||||
#endif
|
|
||||||
wxCFRef< CTFontRef > m_ctFont;
|
wxCFRef< CTFontRef > m_ctFont;
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
UIFont* m_uiFont;
|
UIFont* m_uiFont;
|
||||||
@@ -859,52 +853,10 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
|
|||||||
m_uiFont = CreateUIFont(font);
|
m_uiFont = CreateUIFont(font);
|
||||||
wxMacCocoaRetain( m_uiFont );
|
wxMacCocoaRetain( m_uiFont );
|
||||||
#endif
|
#endif
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
OSStatus status = noErr;
|
|
||||||
m_macATSUIStyle = NULL;
|
|
||||||
|
|
||||||
status = ATSUCreateAndCopyStyle( (ATSUStyle) font.MacGetATSUStyle() , &m_macATSUIStyle );
|
|
||||||
|
|
||||||
wxASSERT_MSG( status == noErr, wxT("couldn't create ATSU style") );
|
|
||||||
|
|
||||||
// we need the scale here ...
|
|
||||||
|
|
||||||
Fixed atsuSize = IntToFixed( int( 1 * font.GetPointSize()) );
|
|
||||||
RGBColor atsuColor ;
|
|
||||||
col.GetRGBColor( &atsuColor );
|
|
||||||
ATSUAttributeTag atsuTags[] =
|
|
||||||
{
|
|
||||||
kATSUSizeTag ,
|
|
||||||
kATSUColorTag ,
|
|
||||||
};
|
|
||||||
ByteCount atsuSizes[WXSIZEOF(atsuTags)] =
|
|
||||||
{
|
|
||||||
sizeof( Fixed ) ,
|
|
||||||
sizeof( RGBColor ) ,
|
|
||||||
};
|
|
||||||
ATSUAttributeValuePtr atsuValues[WXSIZEOF(atsuTags)] =
|
|
||||||
{
|
|
||||||
&atsuSize ,
|
|
||||||
&atsuColor ,
|
|
||||||
};
|
|
||||||
|
|
||||||
status = ::ATSUSetAttributes(
|
|
||||||
m_macATSUIStyle, WXSIZEOF(atsuTags),
|
|
||||||
atsuTags, atsuSizes, atsuValues);
|
|
||||||
|
|
||||||
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
|
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_ATSU_TEXT
|
|
||||||
if ( m_macATSUIStyle )
|
|
||||||
{
|
|
||||||
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
|
|
||||||
m_macATSUIStyle = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
wxMacCocoaRelease( m_uiFont );
|
wxMacCocoaRelease( m_uiFont );
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user