Contents

kCTForegroundColorFromContextAttributeName

Sets a foreground color using the context’s fill color.

Declaration

let kCTForegroundColorFromContextAttributeName: CFString

Discussion

Value must be a CFBoolean object. Default is kCFBooleanFalse. The reason this exists is because an NSAttributedString object defaults to a black color if no color attribute is set. This forces Core Text to set the color in the context. This attribute allows developers to sidestep this, making Core Text set nothing but font information in the CGContext. If set, this attribute also determines the color used by kCTUnderlineStyleAttributeName, in which case it overrides the foreground color.

See Also

Constants