CGFont

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

Overview

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).

Topics

Retaining and Releasing a CGFont Object

CGFontRelease

Decrements the retain count of a font.

CGFontRetain

Increments the retain count of a font.

Creating a CGFont Object

CGFontCreateWithDataProvider

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

CGFontCreateWithFontName

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

CGFontCreateCopyWithVariations

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

CGFontCreateWithPlatformFont

Creates a font object from an Apple Type Services (ATS) font.

Deprecated

Working With PostScript Fonts

CGFontCopyPostScriptName

Obtains the PostScript name of a font.

CGFontCanCreatePostScriptSubset

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

CGFontCreatePostScriptSubset

Creates a subset of the font in the specified PostScript format.

CGFontCreatePostScriptEncoding

Creates a PostScript encoding of a font.

Working With Font Tables

CGFontCopyTableTags

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

CGFontCopyTableForTag

Returns the font table that corresponds to the provided tag.

Getting Font Information

CGFontGetTypeID

Returns the Core Foundation type identifier for Core Graphics fonts.

CGFontCopyVariationAxes

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

CGFontCopyVariations

Returns the variation specification dictionary for a font.

CGFontCopyFullName

Returns the full name associated with a font object.

CGFontGetAscent

Returns the ascent of a font.

CGFontGetDescent

Returns the descent of a font.

CGFontGetLeading

Returns the leading of a font.

CGFontGetCapHeight

Returns the cap height of a font.

CGFontGetXHeight

Returns the x-height of a font.

CGFontGetFontBBox

Returns the bounding box of a font.

CGFontGetItalicAngle

Returns the italic angle of a font.

CGFontGetStemV

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

CGFontGetGlyphBBoxes

Get the bounding box of each glyph in an array.

CGFontGetGlyphWithGlyphName

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

CGFontCopyGlyphNameForGlyph

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

CGFontGetNumberOfGlyphs

Returns the number of glyphs in a font.

CGFontGetGlyphAdvances

Gets the advance width of each glyph in the provided array.

CGFontGetUnitsPerEm

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

Data Types

CGFontRef

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

CGFontIndex

An index into a font table.

CGGlyph

An index into the internal glyph table of a font.

Constants

CGFontPostScriptFormat

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.

See Also

Opaque Types

CGBitmapContext

A type of CGContextRef that you can use for drawing bits to memory.

CGColor

A set of components that define a color, with a color space specifying how to interpret them.

CGColorConversionInfo

An object that describes how to convert between color spaces for use by other system services.

CGColorSpace

A profile that specifies how to interpret a color value for display.

CGContext

A Quartz 2D drawing destination.

CGDataConsumer

An abstraction for data-writing tasks that eliminates the need to manage a raw memory buffer.

CGDataProvider

An abstraction for data-reading tasks that eliminates the need to manage a raw memory buffer.

CGFunction

A general facility for defining and using callback functions.

CGGLContext

Deprecated. A type of CGContextRef for drawing OpenGL content.

CGGradient

A definition for a smooth transition between colors for drawing radial and axial gradient fills.

CGImage

A bitmap image or image mask.

CGLayer

An offscreen context for reusing content drawn with Core Graphics.

CGPath

Immutable and mutable types for graphics paths: mathematical descriptions of shapes or lines to be drawn in a graphics context.

CGPattern

A 2D pattern to be used for drawing graphics paths.

CGPDFArray

An array structure within a PDF document.

CGPDFContentStream

A representation of one or more content data streams in a PDF page.

CGPDFContext

A type of CGContextRef for drawing PDF content.

CGPDFDictionary

A dictionary structure within a PDF document.

CGPDFDocument

A document that contains PDF (Portable Document Format) drawing information.

CGPDFObject

An object representing content within a PDF document.

CGPDFOperatorTable

A set of callback functions for operators used when scanning content in a PDF document.

CGPDFPage

A page in a PDF document.

CGPDFScanner

A parser object for handling content and operators in a PDF content stream.

CGPDFStream

A stream or sequence of data bytes in a PDF document.

CGPDFString

A text string in a PDF document.

CGPSConverter

An object that converts PostScript data to PDF data.

CGShading

A definition for a smooth transition between colors, controlled by a custom function you provide, for drawing radial and axial gradient fills.