+ if ( m_font.IsNull() )
+ return;
+
+ EnsureIsValid();
+#if wxMAC_USE_CORE_TEXT
+ if ( UMAGetSystemVersion() >= 0x1050 )
+ {
+ wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
+ wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
+ CTFontRef font = fref->GetCTFont();
+ CGColorRef col = wxMacCreateCGColor( fref->GetColour() );
+ CTUnderlineStyle ustyle = fref->GetUnderlined() ? kCTUnderlineStyleSingle : kCTUnderlineStyleNone ;
+ wxCFRef<CFNumberRef> underlined( CFNumberCreate(NULL, kCFNumberSInt32Type, &ustyle) );
+ CFStringRef keys[] = { kCTFontAttributeName , kCTForegroundColorAttributeName, kCTUnderlineStyleAttributeName };
+ CFTypeRef values[] = { font, col, underlined };
+ wxCFRef<CFDictionaryRef> attributes( CFDictionaryCreate(kCFAllocatorDefault, (const void**) &keys, (const void**) &values,
+ WXSIZEOF( keys ), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks) );
+ wxCFRef<CFAttributedStringRef> attrtext( CFAttributedStringCreate(kCFAllocatorDefault, text, attributes) );
+ wxCFRef<CTLineRef> line( CTLineCreateWithAttributedString(attrtext) );
+
+ y += CTFontGetAscent(font);
+
+ CGContextSaveGState(m_cgContext);
+ CGContextTranslateCTM(m_cgContext, x, y);
+ CGContextScaleCTM(m_cgContext, 1, -1);
+ CGContextSetTextPosition(m_cgContext, 0, 0);
+ CTLineDraw( line, m_cgContext );
+ CGContextRestoreGState(m_cgContext);
+ CFRelease( col );
+ return;
+ }
+#endif
+#if wxMAC_USE_ATSU_TEXT
+ {
+ DrawText(str, x, y, 0.0);
+ return;
+ }
+#endif
+#if wxMAC_USE_CG_TEXT
+ // TODO core graphics text implementation here
+#endif