CTFont

The CTFont opaque type represents a Core Text font object. Font objects represent fonts to an application, providing access to characteristics of the font, such as point size, transform matrix, and other attributes. Fonts provide assistance in laying out glyphs relative to one another and are used to establish the current font when drawing in a graphics context.

Symbols

Creating Fonts

func CTFont​Create​UIFont​For​Language(CTFont​UIFont​Type, CGFloat, CFString?)

Returns the special user-interface font for the given language and user-interface type.

func CTFont​Create​Copy​With​Family(CTFont, CGFloat, Unsafe​Pointer<CGAffine​Transform>?, CFString)

Returns a new font in the specified family based on the traits of the original font.

func CTFont​Create​For​String(CTFont, CFString, CFRange)

Returns a new font reference that can best map the given string range based on the current font.

Getting Font Data

func CTFont​Copy​Font​Descriptor(CTFont)

Returns the normalized font descriptor for the given font reference.

func CTFont​Copy​Attribute(CTFont, CFString)

Returns the value associated with an arbitrary attribute of the given font.

func CTFont​Get​Size(CTFont)

Returns the point size of the given font.

func CTFont​Get​Matrix(CTFont)

Returns the transformation matrix of the given font.

func CTFont​Get​Symbolic​Traits(CTFont)

Returns the symbolic traits of the given font.

func CTFont​Copy​Traits(CTFont)

Returns the traits dictionary of the given font.

Getting Font Names

func CTFont​Copy​Post​Script​Name(CTFont)

Returns the PostScript name of the given font.

func CTFont​Copy​Family​Name(CTFont)

Returns the family name of the given font.

func CTFont​Copy​Full​Name(CTFont)

Returns the full name of the given font.

func CTFont​Copy​Display​Name(CTFont)

Returns the display name of the given font.

func CTFont​Copy​Name(CTFont, CFString)

Returns a reference to the requested name of the given font.

Working With Encoding

func CTFont​Copy​Character​Set(CTFont)

Returns the Unicode character set of the font.

func CTFont​Get​String​Encoding(CTFont)

Returns the best string encoding for legacy format support.

func CTFont​Copy​Supported​Languages(CTFont)

Returns an array of languages supported by the font.

Getting Font Metrics

func CTFont​Get​Ascent(CTFont)

Returns the scaled font-ascent metric of the given font.

func CTFont​Get​Descent(CTFont)

Returns the scaled font-descent metric of the given font.

func CTFont​Get​Leading(CTFont)

Returns the scaled font-leading metric of the given font.

func CTFont​Get​Units​Per​Em(CTFont)

Returns the units-per-em metric of the given font.

func CTFont​Get​Glyph​Count(CTFont)

Returns the number of glyphs of the given font.

func CTFont​Get​Bounding​Box(CTFont)

Returns the scaled bounding box of the given font.

func CTFont​Get​Underline​Position(CTFont)

Returns the scaled underline position of the given font.

func CTFont​Get​Underline​Thickness(CTFont)

Returns the scaled underline-thickness metric of the given font.

func CTFont​Get​Slant​Angle(CTFont)

Returns the slant angle of the given font.

func CTFont​Get​Cap​Height(CTFont)

Returns the cap-height metric of the given font.

func CTFont​Get​XHeight(CTFont)

Returns the x-height metric of the given font.

Getting Glyph Data

Working With Font Variations

func CTFont​Copy​Variation​Axes(CTFont)

Returns an array of variation axes.

func CTFont​Copy​Variation(CTFont)

Returns a variation dictionary from the font reference.

Getting Font Features

func CTFont​Copy​Features(CTFont)

Returns an array of font features.

func CTFont​Copy​Feature​Settings(CTFont)

Returns an array of font feature-setting tuples.

Working with Glyphs

func CTFont​Get​Glyphs​For​Characters(CTFont, Unsafe​Pointer<Uni​Char>!, Unsafe​Mutable​Pointer<CGGlyph>!, CFIndex)

Provides basic Unicode encoding for the given font, returning by reference an array of CGGlyph values corresponding to a given array of Unicode characters for the given font.

func CTFont​Draw​Glyphs(CTFont, Unsafe​Pointer<CGGlyph>!, Unsafe​Pointer<CGPoint>!, Int, CGContext)

Renders the given glyphs of a font at the specified positions in the supplied graphics context.

Getting the Type Identifier

func CTFont​Get​Type​ID()

Returns the type identifier for Core Text font references.

Data Types

CTFont

A reference to a Core Text font object.

Global Variables

Name Specifier Constants

Name specifier constants provide access to the different names associated with a font.

Font Variation Axis Dictionary Keys

These constants provide keys to font variation axis dictionary values.

Font Feature Constants

These constants provide keys to font feature dictionary values.

Enumerations

CTFont​UIFont​Type

These constants represent the specific user-interface purpose to specify for font creation.

CTFont​Table​Tag

Font table tags provide access to font table data.

CTFont​Table​Options

These constants describe font table options.

CTFont​Options

These constants describe options for font creation and descriptor matching. They are used by the functions CTFont​Create​With​Name​And​Options(_:​_:​_:​_:​) and CTFont​Create​With​Font​Descriptor​And​Options(_:​_:​_:​_:​).