LP64 additions

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-05-15 20:22:55 +00:00
parent ddb795e6ee
commit f853dd2a96
2 changed files with 173 additions and 24 deletions

View File

@@ -48,11 +48,14 @@ public:
, m_underlined(false)
, m_faceName(wxT("applicationfont"))
, m_encoding(wxFONTENCODING_DEFAULT)
#ifdef __LP64__
#else
, m_macFontFamily(0)
, m_macFontSize(0)
, m_macFontStyle(0)
, m_macATSUStyle(0)
, m_macATSUFontID(0)
#endif
, m_macATSUStyle(0)
{
Init(m_pointSize, m_family, m_style, m_weight,
m_underlined, m_faceName, m_encoding);
@@ -68,11 +71,14 @@ public:
, m_underlined(data.m_underlined)
, m_faceName(data.m_faceName)
, m_encoding(data.m_encoding)
#ifdef __LP64__
#else
, m_macFontFamily(data.m_macFontFamily)
, m_macFontSize(data.m_macFontSize)
, m_macFontStyle(data.m_macFontStyle)
, m_macATSUStyle(0)
, m_macATSUFontID(data.m_macATSUFontID)
#endif
, m_macATSUStyle(0)
{
Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
data.m_underlined, data.m_faceName, data.m_encoding);
@@ -93,11 +99,14 @@ public:
, m_underlined(underlined)
, m_faceName(faceName)
, m_encoding(encoding)
#ifdef __LP64__
#else
, m_macFontFamily(0)
, m_macFontSize(0)
, m_macFontStyle(0)
, m_macATSUStyle(0)
, m_macATSUFontID(0)
#endif
, m_macATSUStyle(0)
{
Init(size, family, style, weight, underlined, faceName, encoding);
}
@@ -134,6 +143,7 @@ protected:
bool m_noAA; // No anti-aliasing
public:
#ifndef __LP64__
FMFontFamily m_macFontFamily;
FMFontSize m_macFontSize;
FMFontStyle m_macFontStyle;
@@ -144,14 +154,17 @@ public:
// contain some styles (special bold fonts etc) and
// these are the additional qd styles that are not
// included in the ATSU font id
ATSUStyle m_macATSUStyle ;
ATSUFontID m_macATSUFontID;
FMFontStyle m_macATSUAdditionalQDStyles ;
// for true themeing support we must store the correct font
// information here, as this speeds up and optimizes rendering
ThemeFontID m_macThemeFontID ;
#else
CTFontRef m_macFontRef;
CTFontUIFontType m_macUIFontType;
#endif
ATSUStyle m_macATSUStyle ;
wxNativeFontInfo m_info;
};
@@ -182,15 +195,19 @@ void wxFontRefData::Init(int pointSize,
m_underlined = underlined;
m_faceName = faceName;
m_encoding = encoding;
#ifdef __LP64__
m_macUIFontType = kCTFontNoFontType;
m_macFontRef = 0;
#else
m_macFontFamily = 0 ;
m_macFontSize = 0;
m_macFontStyle = 0;
m_macATSUFontID = 0;
m_macATSUAdditionalQDStyles = 0 ;
m_macATSUStyle = NULL ;
m_macThemeFontID = kThemeCurrentPortFont ;
#endif
m_macATSUStyle = NULL ;
m_noAA = false;
}
@@ -205,9 +222,109 @@ wxFontRefData::~wxFontRefData()
void wxFontRefData::MacFindFont()
{
OSStatus status ;
OSStatus status = noErr;
Str255 qdFontName ;
#ifdef __LP64__
if ( m_faceName.empty() && m_family == wxDEFAULT )
{
m_macUIFontType = kCTFontSystemFontType;
}
if ( m_macUIFontType != kCTFontNoFontType )
{
m_macFontRef = CTFontCreateUIFontForLanguage( m_macUIFontType, 0.0, NULL );
wxMacCFStringHolder name( (CFStringRef) CTFontCopyAttribute( m_macFontRef, kCTFontFamilyNameKey) );
m_faceName = name.AsString();
}
else
{
if ( m_faceName.empty() )
{
switch ( m_family )
{
case wxSCRIPT :
case wxROMAN :
case wxDECORATIVE :
m_faceName = wxT("Times");
break ;
case wxSWISS :
m_faceName = wxT("Lucida Grande");
break ;
case wxMODERN :
case wxTELETYPE:
m_faceName = wxT("Monaco");
break ;
default:
m_faceName = wxT("Times");
break ;
}
}
wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
m_macFontRef = CTFontCreateWithName( cf, m_pointSize, NULL);
}
if ( m_macATSUStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUStyle);
m_macATSUStyle = NULL ;
}
status = ::ATSUCreateStyle((ATSUStyle *)&m_macATSUStyle);
wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") );
ATSUAttributeTag atsuTags[] =
{
// kATSUFontTag ,
kATSUSizeTag ,
kATSUVerticalCharacterTag,
kATSUQDBoldfaceTag ,
kATSUQDItalicTag ,
kATSUQDUnderlineTag ,
kATSUQDCondensedTag ,
kATSUQDExtendedTag ,
};
ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
{
// sizeof( ATSUFontID ) ,
sizeof( Fixed ) ,
sizeof( ATSUVerticalCharacterType),
sizeof( Boolean ) ,
sizeof( Boolean ) ,
sizeof( Boolean ) ,
sizeof( Boolean ) ,
sizeof( Boolean ) ,
};
Boolean kTrue = true ;
Boolean kFalse = false ;
Fixed atsuSize = IntToFixed( m_macFontSize );
ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
{
// &m_macATSUFontID ,
&atsuSize ,
&kHorizontal,
(m_macATSUAdditionalQDStyles & bold) ? &kTrue : &kFalse ,
(m_macATSUAdditionalQDStyles & italic) ? &kTrue : &kFalse ,
(m_macATSUAdditionalQDStyles & underline) ? &kTrue : &kFalse ,
(m_macATSUAdditionalQDStyles & condense) ? &kTrue : &kFalse ,
(m_macATSUAdditionalQDStyles & extend) ? &kTrue : &kFalse ,
};
status = ::ATSUSetAttributes(
(ATSUStyle)m_macATSUStyle,
sizeof(atsuTags) / sizeof(ATSUAttributeTag) ,
atsuTags, atsuSizes, atsuValues);
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
#endif
#else
if ( m_macThemeFontID != kThemeCurrentPortFont )
{
Style style ;
@@ -223,9 +340,7 @@ void wxFontRefData::MacFindFont()
if ( m_macFontStyle & underline )
m_underlined = true ;
m_pointSize = m_macFontSize ;
#ifndef __LP64__
m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
#endif
}
else
{
@@ -233,11 +348,9 @@ void wxFontRefData::MacFindFont()
{
if ( m_family == wxDEFAULT )
{
#ifndef __LP64__
m_macFontFamily = GetAppFont();
FMGetFontFamilyName(m_macFontFamily,qdFontName);
m_faceName = wxMacMakeStringFromPascal( qdFontName );
#endif
}
else
{
@@ -262,7 +375,6 @@ void wxFontRefData::MacFindFont()
m_faceName = wxT("Times");
break ;
}
#ifndef __LP64__
wxMacStringToPascal( m_faceName , qdFontName );
m_macFontFamily = FMGetFontFamilyFromName( qdFontName );
if ( m_macFontFamily == kInvalidFontFamily )
@@ -270,23 +382,15 @@ void wxFontRefData::MacFindFont()
wxLogDebug( wxT("ATSFontFamilyFindFromName failed for %s"), m_faceName.c_str() );
m_macFontFamily = GetAppFont();
}
#endif
}
}
else
{
#ifndef __LP64__
if ( m_faceName == wxT("systemfont") )
m_macFontFamily = GetSysFont();
else if ( m_faceName == wxT("applicationfont") )
m_macFontFamily = GetAppFont();
else
#else
if ( m_faceName == wxT("systemfont") )
m_faceName = wxT("Lucida Grande");
else if ( m_faceName == wxT("applicationfont") )
m_faceName = wxT("Lucida Grande");
#endif
{
wxMacCFStringHolder cf( m_faceName, wxLocale::GetSystemEncoding() );
ATSFontFamilyRef atsfamily = ATSFontFamilyFindFromName( cf , kATSOptionFlagsDefault );
@@ -315,10 +419,8 @@ void wxFontRefData::MacFindFont()
// ATSUFontID and FMFont are equivalent
FMFontStyle intrinsicStyle = 0 ;
#ifndef __LP64__
status = FMGetFontFromFontFamilyInstance( m_macFontFamily , m_macFontStyle , &m_macATSUFontID , &intrinsicStyle);
wxASSERT_MSG( status == noErr , wxT("couldn't get an ATSUFont from font family") );
#endif
m_macATSUAdditionalQDStyles = m_macFontStyle & (~intrinsicStyle );
if ( m_macATSUStyle )
@@ -376,6 +478,7 @@ void wxFontRefData::MacFindFont()
atsuTags, atsuSizes, atsuValues);
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
#endif
}
// ----------------------------------------------------------------------------
@@ -415,8 +518,29 @@ bool wxFont::Create(int pointSize,
return true;
}
#ifdef __LP64__
bool wxFont::MacCreateUIFont(wxUint32 ctFontType )
{
UnRef();
m_refData = new wxFontRefData(
12, wxDEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false, wxEmptyString, wxFONTENCODING_DEFAULT );
M_FONTDATA->m_macUIFontType = ctFontType ;
RealizeResource();
return true;
}
#endif
bool wxFont::MacCreateThemeFont(wxUint16 themeFontID)
{
#ifdef __LP64__
return MacCreateUIFont(HIThemeGetUIFontType(themeFontID));
#else
UnRef();
m_refData = new wxFontRefData(
@@ -427,8 +551,11 @@ bool wxFont::MacCreateThemeFont(wxUint16 themeFontID)
RealizeResource();
return true;
#endif
}
wxFont::~wxFont()
{
}
@@ -605,6 +732,8 @@ bool wxFont::GetNoAntiAliasing() const
return M_FONTDATA->m_noAA;
}
#ifndef __LP64__
short wxFont::MacGetFontNum() const
{
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
@@ -653,6 +782,14 @@ wxUint16 wxFont::MacGetThemeFontID() const
return M_FONTDATA->m_macThemeFontID;
}
#else
const void * wxFont::MacGetCTFont() const
{
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") );
return M_FONTDATA->m_macFontRef;
}
#endif
const wxNativeFontInfo * wxFont::GetNativeFontInfo() const
{

View File

@@ -157,16 +157,28 @@ wxString wxStandardPathsCF::GetExecutablePath() const
#ifdef __WXMAC__
ProcessInfoRec processinfo;
ProcessSerialNumber procno ;
#ifdef __LP64__
FSRef fsRef;
#else
FSSpec fsSpec;
#endif
procno.highLongOfPSN = 0 ;
procno.lowLongOfPSN = kCurrentProcess ;
processinfo.processInfoLength = sizeof(ProcessInfoRec);
processinfo.processName = NULL;
#ifdef __LP64__
processinfo.processAppRef = &fsRef;
#else
processinfo.processAppSpec = &fsSpec;
#endif
GetProcessInformation( &procno , &processinfo ) ;
#ifdef __LP64__
return wxMacFSRefToPath(&fsRef);
#else
return wxMacFSSpec2MacFilename(&fsSpec);
#endif
#else
return wxStandardPathsBase::GetExecutablePath();
#endif