I'm trying to draw text using CoreText and CoreGraphics. The text draws and positions fine, however I can't seem to be able to change font size. Or font for that matter. I tried setting attributed text with CFAttributedString directly and I tried changing the CGContext font size setting. Here's my code
//... (create CGContext)
let textAttrs = [
kCTFontSizeAttribute as String : 18 as NSNumber
] as CFDictionary
let attrString = CFAttributedStringCreate(kCFAllocatorDefault,
NSString(string: "Hello, world!"),
textAttrs)
let textLine = CTLineCreateWithAttributedString(attrString!)
context.textPosition = CGPoint.zero
CTLineDraw(textLine, context.textPosition)