---
title: CGFont
framework: coregraphics
role: symbol
role_heading: Class
path: coregraphics/cgfont
---

# CGFont

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

## Declaration

```swift
class CGFont
```

## Overview

Overview A glyph can represent a single character (such as ‘b’), more than one character (such as the “ﬁ” 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).

## Topics

### Creating Font Objects

- [init(_:)](coregraphics/cgfont/init(_:)-9aour.md)
- [init(_:)](coregraphics/cgfont/init(_:)-1p4b.md)

### Examining Font Metadata

- [fullName](coregraphics/cgfont/fullname.md)

### Examining Font Metrics

- [ascent](coregraphics/cgfont/ascent.md)
- [capHeight](coregraphics/cgfont/capheight.md)
- [descent](coregraphics/cgfont/descent.md)
- [fontBBox](coregraphics/cgfont/fontbbox.md)
- [italicAngle](coregraphics/cgfont/italicangle.md)
- [leading](coregraphics/cgfont/leading.md)
- [stemV](coregraphics/cgfont/stemv.md)
- [unitsPerEm](coregraphics/cgfont/unitsperem.md)
- [xHeight](coregraphics/cgfont/xheight.md)

### Working with PostScript Fonts

- [postScriptName](coregraphics/cgfont/postscriptname.md)
- [canCreatePostScriptSubset(_:)](coregraphics/cgfont/cancreatepostscriptsubset(_:).md)
- [createPostScriptSubset(subsetName:format:glyphs:count:encoding:)](coregraphics/cgfont/createpostscriptsubset(subsetname:format:glyphs:count:encoding:).md)
- [CGFontPostScriptFormat](coregraphics/cgfontpostscriptformat.md)
- [createPostScriptEncoding(encoding:)](coregraphics/cgfont/createpostscriptencoding(encoding:).md)

### Working with Font Tables

- [tableTags](coregraphics/cgfont/tabletags.md)
- [table(for:)](coregraphics/cgfont/table(for:).md)
- [Font Table Index Values](coregraphics/font-table-index-values.md)
- [Obsolete Font Table Index Values](coregraphics/obsolete-font-table-index-values.md)

### Working with Variations

- [copy(withVariations:)](coregraphics/cgfont/copy(withvariations:).md)
- [variations](coregraphics/cgfont/variations.md)
- [variationAxes](coregraphics/cgfont/variationaxes.md)
- [Font Variation Axis Keys](coregraphics/font-variation-axis-keys.md)

### Working with Glyphs

- [numberOfGlyphs](coregraphics/cgfont/numberofglyphs.md)
- [name(for:)](coregraphics/cgfont/name(for:).md)
- [getGlyphWithGlyphName(name:)](coregraphics/cgfont/getglyphwithglyphname(name:).md)
- [getGlyphBBoxes(glyphs:count:bboxes:)](coregraphics/cgfont/getglyphbboxes(glyphs:count:bboxes:).md)
- [getGlyphAdvances(glyphs:count:advances:)](coregraphics/cgfont/getglyphadvances(glyphs:count:advances:).md)
- [CGGlyph](coregraphics/cgglyph.md)
- [kCGGlyphMax](coregraphics/kcgglyphmax.md)
- [CGFontIndex](coregraphics/cgfontindex.md)
- [kCGFontIndexMax](coregraphics/kcgfontindexmax.md)
- [kCGFontIndexInvalid](coregraphics/kcgfontindexinvalid.md)

### Working with Core Foundation Types

- [typeID](coregraphics/cgfont/typeid.md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)

## See Also

### Related Documentation

- [Quartz 2D Programming Guide](apple-archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction.md)

### Colors and Fonts

- [CGColor](coregraphics/cgcolor.md)
- [CGColorConversionInfo](coregraphics/cgcolorconversioninfo.md)
- [CGColorSpace](coregraphics/cgcolorspace.md)
