#include "wx/icon.h"
#endif
+
#ifdef __MSL__
#if __MSL__ >= 0x6000
#include "math.h"
#ifdef __WXMAC__
#include "wx/mac/uma.h"
+ #include "wx/mac/dcprint.h"
#else
#include "CoreServices/CoreServices.h"
#include "ApplicationServices/ApplicationServices.h"
status = ::ATSUSetTransientFontMatching( atsuLayout , true );
wxASSERT_MSG( status == noErr , wxT("couldn't setup transient font matching") );
+// new implementation from JS, keep old one just in case
+#if 0
for ( int pos = 0; pos < (int)chars; pos ++ )
{
unsigned long actualNumberOfBounds = 0;
widths[pos] = FixedToInt( glyphBounds.upperRight.x - glyphBounds.upperLeft.x );
//unsigned char uch = s[i];
}
-
+#else
+ ATSLayoutRecord *layoutRecords = NULL;
+ ItemCount glyphCount = 0;
+
+ // Get the glyph extents
+ OSStatus err = ::ATSUDirectGetLayoutDataArrayPtrFromTextLayout(atsuLayout,
+ 0,
+ kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
+ (void **)
+ &layoutRecords,
+ &glyphCount);
+ wxASSERT(glyphCount == (text.length()+1));
+
+ if ( err == noErr && glyphCount == (text.length()+1))
+ {
+ for ( int pos = 1; pos < (int)glyphCount ; pos ++ )
+ {
+ widths[pos-1] = FixedToInt( layoutRecords[pos].realPos );
+ }
+ }
+
+ ::ATSUDirectReleaseLayoutDataArrayPtr(NULL,
+ kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
+ (void **) &layoutRecords);
+#endif
::ATSUDisposeTextLayout(atsuLayout);
}
#endif
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc);
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc);
+ virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc);
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
return NULL;
}
+wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxPrinterDC& dc )
+{
+#ifdef __WXMAC__
+ const wxDCImpl* impl = dc.GetImpl();
+ wxPrinterDCImpl *print_impl = wxDynamicCast( impl, wxPrinterDCImpl );
+ if (print_impl)
+ {
+ int w, h;
+ print_impl->GetSize( &w, &h );
+ return new wxMacCoreGraphicsContext( this,
+ (CGContextRef)(print_impl->GetGraphicsContext()->GetNativeContext()), (wxDouble) w, (wxDouble) h );
+ }
+#endif
+ return NULL;
+}
+
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( void * context )
{
return new wxMacCoreGraphicsContext(this,(CGContextRef)context);