myBitmapContext = CGBitmapContextCreate(	destImageSurface->data, destImageSurface->width, destImageSurface->height, destImageSurface->depth / 4, destImageSurface->stride, colorSpace, kCGImageAlphaPremultipliedFirst);   ATSFontRef	atsFont	= FMGetATSFontRefFromFont(font->fontID); CGFontRef	cgFont	= CGFontCreateWithPlatformFont(&atsFont);  CGContextSetFont(myBitmapContext, cgFont);   CGAffineTransform	textTransform = CGAffineTransformMakeWithCairoFontScale(*sc); CGSize				textSize = CGSizeMake(1.0, 1.0);  textSize = CGSizeApplyAffineTransform(textSize, textTransform);  CGContextSetFontSize(myBitmapContext, textSize.width);          for (i = 0; i < num_glyphs; i++) { CGGlyph		theGlyph = glyphs[i].index;  CGContextShowGlyphsAtPoint(myBitmapContext, source_x + glyphs[i].x, destImageSurface->height - (source_y + glyphs[i].y), &theGlyph, 1); }   CGColorSpaceRelease(colorSpace); CGContextRelease(myBitmapContext);   return CAIRO_STATUS_SUCCESS;
myBitmapContext = CGBitmapContextCreate(destImageSurface->data, destImageSurface->width, destImageSurface->height, destImageSurface->depth / 4, destImageSurface->stride, colorSpace, kCGImageAlphaPremultipliedFirst); CGContextTranslateCTM(myBitmapContext, 0, destImageSurface->height); CGContextScaleCTM(myBitmapContext, 1.0f, -1.0f);  ATSFontRef atsFont = FMGetATSFontRefFromFont(font->fontID); CGFontRef cgFont = CGFontCreateWithPlatformFont(&atsFont);  CGContextSetFont(myBitmapContext, cgFont);  CGAffineTransform textTransform = CGAffineTransformMakeWithCairoFontScale(font->scale);  textTransform = CGAffineTransformScale(textTransform, 1.0f, -1.0f);  CGContextSetFontSize(myBitmapContext, 1.0); CGContextSetTextMatrix(myBitmapContext, textTransform);  if (pattern->type == CAIRO_PATTERN_SOLID && _cairo_pattern_is_opaque(pattern)) { cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *)pattern; CGContextSetRGBFillColor(myBitmapContext, solid->red, solid->green, solid->blue, 1.0f); } else CGContextSetRGBFillColor(myBitmapContext, 0.0f, 0.0f, 0.0f, 0.0f);         for (i = 0; i < num_glyphs; i++) { CGGlyph theGlyph = glyphs[i].index;  CGContextShowGlyphsAtPoint(myBitmapContext, glyphs[i].x, glyphs[i].y, &theGlyph, 1); }   CGColorSpaceRelease(colorSpace); CGContextRelease(myBitmapContext);  _cairo_surface_release_dest_image(generic_surface, &rect, destImageSurface, &rect, NULL);  return CAIRO_STATUS_SUCCESS;
_cairo_atsui_font_show_glyphs(	void				*abstract_font,								cairo_font_scale_t 	*sc,								cairo_operator_t	operator,								cairo_surface_t 	*source,								cairo_surface_t 	*surface,								int					source_x,								int					source_y,								const cairo_glyph_t	*glyphs,								int					num_glyphs){	cairo_atsui_font_t		*font = abstract_font;	CGContextRef			myBitmapContext;    CGColorSpaceRef			colorSpace;	cairo_image_surface_t	*destImageSurface;	int						i;			destImageSurface = _cairo_surface_get_image(surface);    		// Create a CGBitmapContext for the dest surface for drawing into    colorSpace = CGColorSpaceCreateDeviceRGB();		myBitmapContext = CGBitmapContextCreate(	destImageSurface->data,												destImageSurface->width,												destImageSurface->height,												destImageSurface->depth / 4,												destImageSurface->stride,												colorSpace,												kCGImageAlphaPremultipliedFirst);			ATSFontRef	atsFont	= FMGetATSFontRefFromFont(font->fontID);	CGFontRef	cgFont	= CGFontCreateWithPlatformFont(&atsFont);		CGContextSetFont(myBitmapContext, cgFont);			CGAffineTransform	textTransform = CGAffineTransformMakeWithCairoFontScale(*sc);    CGSize				textSize = CGSizeMake(1.0, 1.0);		textSize = CGSizeApplyAffineTransform(textSize, textTransform);		CGContextSetFontSize(myBitmapContext, textSize.width);			// TODO - bold and italic text	//	// We could draw the text using ATSUI and get bold, italics	// etc. for free, but ATSUI does a lot of text layout work	// that we don't really need...			for (i = 0; i < num_glyphs; i++)	{		CGGlyph		theGlyph = glyphs[i].index;				CGContextShowGlyphsAtPoint(myBitmapContext, source_x + glyphs[i].x, destImageSurface->height - (source_y + glyphs[i].y), &theGlyph, 1);	}			CGColorSpaceRelease(colorSpace);	CGContextRelease(myBitmapContext);			return CAIRO_STATUS_SUCCESS;}