Creates a justified line from an existing line.


func CTLineCreateJustifiedLine(_ line: CTLine, _ justificationFactor: CGFloat, _ justificationWidth: Double) -> CTLine?



The line from which to create a justified line.


Full or partial justification. When set to 1.0 or greater, full justification is performed. If this parameter is set to less than 1.0, varying degrees of partial justification are performed. If it is set to 0 or less, no justification is performed.


The width to which the resultant line is justified. If justificationWidth is less than the actual width of the line, then negative justification is performed (that is, glyphs are squeezed together).

Return Value

A reference to a justified CTLine object if the call was successful; otherwise, NULL.

See Also

Creating Lines

func CTLineCreateWithAttributedString(CFAttributedString) -> CTLine

Creates a single immutable line object directly from an attributed string.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software