A set of character glyphs and layout information for drawing text.


A font is a set of shapes or glyphs associated with a character set. A glyph can represent a single character (such as ‘b’), more than one character (such as the “fi” ligature), or a special character such as a space. Core Graphics retrieves the glyphs for the font from ATS (Apple Type Services) and paints the glyphs based on the relevant parameters of the current graphics state.

Core Graphics provides a limited, low-level interface for drawing text. For information on text-drawing functions, see CGContext. For full Unicode and text-layout support, use the services provided by TextKit).


Creating a CGFont Object


Creates a font object from data supplied from a data provider.


Creates a font object corresponding to the font specified by a PostScript or full name.

func copy(withVariations: CFDictionary?)

Creates a copy of a font using a variation specification dictionary.

Working With PostScript Fonts

var postScriptName: CFString?

Obtains the PostScript name of a font.

func canCreatePostScriptSubset(CGFontPostScriptFormat)

Determines whether Core Graphics can create a subset of the font in PostScript format.

Working With Font Tables

var tableTags: CFArray?

Returns an array of tags that correspond to the font tables for a font.

func table(for: UInt32)

Returns the font table that corresponds to the provided tag.

Getting Font Information

class var typeID: CFTypeID

Returns the Core Foundation type identifier for Core Graphics fonts.

var variationAxes: CFArray?

Returns an array of the variation axis dictionaries for a font.

var variations: CFDictionary?

Returns the variation specification dictionary for a font.

var fullName: CFString?

Returns the full name associated with a font object.

var ascent: Int32

Returns the ascent of a font.

var descent: Int32

Returns the descent of a font.

var leading: Int32

Returns the leading of a font.

var capHeight: Int32

Returns the cap height of a font.

var xHeight: Int32

Returns the x-height of a font.

var fontBBox: CGRect

Returns the bounding box of a font.

var italicAngle: CGFloat

Returns the italic angle of a font.

var stemV: CGFloat

Returns the thickness of the dominant vertical stems of glyphs in a font.

func getGlyphWithGlyphName(name: CFString)

Returns the glyph for the glyph name associated with the specified font object.

func name(for: CGGlyph)

Returns the glyph name of the specified glyph in the specified font.

var numberOfGlyphs: Int

Returns the number of glyphs in a font.

var unitsPerEm: Int32

Returns the number of glyph space units per em for the provided font.

Data Types


A set of character glyphs and layout information for drawing text.


An index into a font table.


An index into the internal glyph table of a font.



Possible formats for a PostScript font subset.

Font Table Index Values

Possible values for an index into a font table.

Obsolete Font Table Index Values

Deprecated values for an index into a font table.

Font Variation Axis Keys

Keys used for a font variation axis dictionary.