Thanks to omz's comment I stumbled across CTLineCreateJustifiedLine
, which gives me just what I wanted. I'd still be interested if someone has a solution using a Cocoa Control (NSTextView), but i'd be surprised if there was anything tbh.
CTLineRef line = CTLineCreateWithAttributedString((__bridge CFAttributedStringRef)attString);
line = CTLineCreateJustifiedLine(line, 1.0, dirtyRect.size.width);
CTLineDraw(line, context);
CFRelease(line);