Calculates the image bounds for a glyph range.


func CTRunGetImageBounds(_ run: CTRun, _ context: CGContext?, _ range: CFRange) -> CGRect



The run for which to calculate the image bounds.


The context for the image bounds being calculated. This is required because the context could have settings in it that would cause changes in the image bounds.


The portion of the run to measure. If the length of the range is set to 0, then the measure operation continues from the start index of the range to the end of the run.

Return Value

A rectangle that tightly encloses the paths of the run's glyphs, or, if run, context, or range is invalid, null.

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