diff --git a/src/osx/carbon/graphics.cpp b/src/osx/carbon/graphics.cpp index 5d2492554b..ea9ed092ef 100644 --- a/src/osx/carbon/graphics.cpp +++ b/src/osx/carbon/graphics.cpp @@ -116,15 +116,6 @@ CGColorRef wxMacCreateCGColor( const wxColour& col ) 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 class wxMacCoreGraphicsPattern @@ -809,14 +800,6 @@ wxMacCoreGraphicsBrushData::CreateGradientFunction(const wxGraphicsGradientStops // 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 { public: @@ -840,7 +823,7 @@ private : wxCFRef< CTFontRef > m_ctFont; wxCFRef< CFDictionaryRef > m_ctFontAttributes; #if wxOSX_USE_IPHONE - UIFont* m_uiFont; + wxCFRef< WX_UIFont > m_uiFont; #endif }; @@ -850,19 +833,15 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere m_underlined = font.GetUnderlined(); m_strikethrough = font.GetStrikethrough(); - m_ctFont.reset( wxMacCreateCTFont( font ) ); + m_ctFont.reset( wxCFRetain( font.OSXGetCTFont() ) ); m_ctFontAttributes.reset( wxCFRetain( font.OSXGetCTFontAttributes() ) ); #if wxOSX_USE_IPHONE - m_uiFont = CreateUIFont(font); - wxMacCocoaRetain( m_uiFont ); + m_uiFont.reset( wxCFRetain( font.OSXGetUIFont() ) ); #endif } wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData() { -#if wxOSX_USE_IPHONE - wxMacCocoaRelease( m_uiFont ); -#endif } class wxMacCoreGraphicsBitmapData : public wxGraphicsBitmapData diff --git a/src/osx/iphone/utils.mm b/src/osx/iphone/utils.mm index 1ac79e3ebf..ee2380bab1 100644 --- a/src/osx/iphone/utils.mm +++ b/src/osx/iphone/utils.mm @@ -111,43 +111,11 @@ bool wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) // 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() { 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) { #if 0