Calculates the optical bounds for an array of glyphs and returns the overall optical bounds for the run.


func CTFontGetOpticalBoundsForGlyphs(_ font: CTFont, _ glyphs: UnsafePointer<CGGlyph>, _ boundingRects: UnsafeMutablePointer<CGRect>?, _ count: CFIndex, _ options: CFOptionFlags) -> CGRect



The font reference.


An array of glyphs.


An array of CGRects to receive the computed glyph bounds. This parameter can be NULL, in which case the function only calculates the overall bounding rectangle.


The capacity of the glyphs and boundingRects buffers.


Reserved, set to zero.

Return Value

This function returns the overall bounding rectangle for an array of glyphs. The boundingRects parameter returns the bounding rectangles of the individual glyphs. These rectangles are the design metrics from the font transformed in font space.


Fonts may specify the optical edges of glyphs that can be used to make the edges of lines of text line up in a more visually pleasing way. This function returns bounding rectangles that correspond to these specifications if the font provides them; otherwise, it returns typographic bounding rectangles, composed of the font’s ascender and descender and a glyph’s advance width.

See Also

Getting Glyph Data

func CTFontGetGlyphWithName(CTFont, CFString) -> CGGlyph

Returns the CGGlyph value for the specified glyph name in the given font.

func CTFontGetBoundingRectsForGlyphs(CTFont, CTFontOrientation, UnsafePointer<CGGlyph>, UnsafeMutablePointer<CGRect>?, CFIndex) -> CGRect

Calculates the bounding rects for an array of glyphs and returns the overall bounding rectangle for the glyph run.

func CTFontGetVerticalTranslationsForGlyphs(CTFont, UnsafePointer<CGGlyph>, UnsafeMutablePointer<CGSize>, CFIndex)

Calculates the offset from the default (horizontal) origin to the vertical origin for an array of glyphs.