Removing unnecessary font related code
The bridging API for native fonts allow for further removal of code.
This commit is contained in:
@@ -116,15 +116,6 @@ CGColorRef wxMacCreateCGColor( const wxColour& col )
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
CTFontRef wxMacCreateCTFont( const wxFont& font )
|
|
||||||
{
|
|
||||||
#ifdef __WXMAC__
|
|
||||||
return wxCFRetain((CTFontRef) font.OSXGetCTFont());
|
|
||||||
#else
|
|
||||||
return CTFontCreateWithName( wxCFStringRef( font.GetFaceName(), wxLocale::GetSystemEncoding() ) , font.GetPointSize() , NULL );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// CGPattern wrapper class: always allocate on heap, never call destructor
|
// CGPattern wrapper class: always allocate on heap, never call destructor
|
||||||
|
|
||||||
class wxMacCoreGraphicsPattern
|
class wxMacCoreGraphicsPattern
|
||||||
@@ -809,14 +800,6 @@ wxMacCoreGraphicsBrushData::CreateGradientFunction(const wxGraphicsGradientStops
|
|||||||
// Font
|
// Font
|
||||||
//
|
//
|
||||||
|
|
||||||
#if wxOSX_USE_IPHONE
|
|
||||||
|
|
||||||
extern UIFont* CreateUIFont( const wxFont& font );
|
|
||||||
extern void DrawTextInContext( CGContextRef context, CGPoint where, UIFont *font, NSString* text );
|
|
||||||
extern CGSize MeasureTextInContext( UIFont *font, NSString* text );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class wxMacCoreGraphicsFontData : public wxGraphicsObjectRefData
|
class wxMacCoreGraphicsFontData : public wxGraphicsObjectRefData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -840,7 +823,7 @@ private :
|
|||||||
wxCFRef< CTFontRef > m_ctFont;
|
wxCFRef< CTFontRef > m_ctFont;
|
||||||
wxCFRef< CFDictionaryRef > m_ctFontAttributes;
|
wxCFRef< CFDictionaryRef > m_ctFontAttributes;
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
UIFont* m_uiFont;
|
wxCFRef< WX_UIFont > m_uiFont;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -850,19 +833,15 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
|
|||||||
m_underlined = font.GetUnderlined();
|
m_underlined = font.GetUnderlined();
|
||||||
m_strikethrough = font.GetStrikethrough();
|
m_strikethrough = font.GetStrikethrough();
|
||||||
|
|
||||||
m_ctFont.reset( wxMacCreateCTFont( font ) );
|
m_ctFont.reset( wxCFRetain( font.OSXGetCTFont() ) );
|
||||||
m_ctFontAttributes.reset( wxCFRetain( font.OSXGetCTFontAttributes() ) );
|
m_ctFontAttributes.reset( wxCFRetain( font.OSXGetCTFontAttributes() ) );
|
||||||
#if wxOSX_USE_IPHONE
|
#if wxOSX_USE_IPHONE
|
||||||
m_uiFont = CreateUIFont(font);
|
m_uiFont.reset( wxCFRetain( font.OSXGetUIFont() ) );
|
||||||
wxMacCocoaRetain( m_uiFont );
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
|
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
|
||||||
{
|
{
|
||||||
#if wxOSX_USE_IPHONE
|
|
||||||
wxMacCocoaRelease( m_uiFont );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class wxMacCoreGraphicsBitmapData : public wxGraphicsBitmapData
|
class wxMacCoreGraphicsBitmapData : public wxGraphicsBitmapData
|
||||||
|
@@ -111,43 +111,11 @@ bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params)
|
|||||||
|
|
||||||
// TODO : reorganize
|
// TODO : reorganize
|
||||||
|
|
||||||
extern wxFont* CreateNormalFont()
|
|
||||||
{
|
|
||||||
return new wxFont([UIFont systemFontSize] , wxSWISS, wxNORMAL, wxNORMAL, FALSE, "Helvetica" );
|
|
||||||
}
|
|
||||||
|
|
||||||
extern wxFont* CreateSmallFont()
|
|
||||||
{
|
|
||||||
return new wxFont([UIFont smallSystemFontSize] , wxSWISS, wxNORMAL, wxNORMAL, FALSE, "Helvetica" );
|
|
||||||
}
|
|
||||||
|
|
||||||
extern UIFont* CreateUIFont( const wxFont& font )
|
|
||||||
{
|
|
||||||
return [UIFont fontWithName:wxCFStringRef(font.GetFaceName() ).AsNSString() size:font.GetPointSize()];
|
|
||||||
}
|
|
||||||
|
|
||||||
CFArrayRef CopyAvailableFontFamilyNames()
|
CFArrayRef CopyAvailableFontFamilyNames()
|
||||||
{
|
{
|
||||||
return (CFArrayRef) [[UIFont familyNames] retain];
|
return (CFArrayRef) [[UIFont familyNames] retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void DrawTextInContext( CGContextRef context, CGPoint where, UIFont *font, NSString* text )
|
|
||||||
{
|
|
||||||
bool contextChanged = ( UIGraphicsGetCurrentContext() != context );
|
|
||||||
if ( contextChanged )
|
|
||||||
UIGraphicsPushContext(context);
|
|
||||||
|
|
||||||
[text drawAtPoint:where withFont:font];
|
|
||||||
|
|
||||||
if ( contextChanged )
|
|
||||||
UIGraphicsPopContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern CGSize MeasureTextInContext( UIFont *font, NSString* text )
|
|
||||||
{
|
|
||||||
return [text sizeWithFont:font];
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
Reference in New Issue
Block a user