 		CGContextSetAllowsAntialiasing(context, true)
 		CGContextSetShouldAntialias(context, true)
 		
-		CGContextSetInterpolationQuality(context, kCGInterpolationHigh)
+		CGContextSetInterpolationQuality(context, CGInterpolationQuality.High)
 		
 		let line = CTLineCreateWithAttributedString(string)
-		let runs = CTLineGetGlyphRuns(line) as! Array<CTRun>
-		
+        let runs: CFArrayRef = CTLineGetGlyphRuns(line)
+        
 		var linePos: CGFloat = 0
 		let charSpacing: CGFloat
 		let align: NSTextAlignment

		
		var glyphOffset:CGFloat = 0
		
		for run in runs {
			
			let runCount = CTRunGetGlyphCount(run)
			
			var advances = UnsafeMutablePointer<CGSize>(malloc((sizeof(CGSize))*runCount))

		
		UIGraphicsBeginImageContextWithOptions(imageSize, false, 0)
		
		self.drawAttributedString(string, toContext: UIGraphicsGetCurrentContext()!, align: alignment, yOffset: yOffset)
		
		let image = UIGraphicsGetImageFromCurrentImageContext()
		UIGraphicsEndImageContext()
