Removing unnecessary font related code

The bridging API for native fonts allow for further removal of code.
This commit is contained in:
Stefan Csomor
2017-06-25 11:38:16 +02:00
parent 7104ed845d
commit 81dfa2ae04
2 changed files with 3 additions and 56 deletions

View File

@@ -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

View File

@@ -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