iOS Developer Library

Developer

ApplicationServices Framework Reference CTFont Reference

Options
Deployment Target:

On This Page
Language:

CTFont Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import CoreText

Objective-C

@import CoreText;

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.

Functions

  • Returns a new font reference for the given name.

    Declaration

    Swift

    func CTFontCreateWithName(_ name: CFString!, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateWithName ( CFStringRef name, CGFloat size, const CGAffineTransform *matrix );

    Parameters

    name

    The font name for which you wish to create a new font reference. A valid PostScript name is preferred, although other font name types are matched in a fallback manner.

    size

    The point size for the font reference. If 0.0 is specified, the default font size of 12.0 is used. This parameter is optional.

    matrix

    The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the identity matrix is used. This parameter is optional.

    Return Value

    Returns a CTFontRef that best matches the name provided with size and matrix attributes.

    Discussion

    The name parameter is the only required parameter, and default values are used for unspecified parameters (0.0 for size and NULL for matrix). If all parameters cannot be matched identically, a best match is found.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a new font reference for the given name.

    Declaration

    Swift

    func CTFontCreateWithNameAndOptions(_ name: CFString!, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>, _ options: CTFontOptions) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateWithNameAndOptions ( CFStringRef name, CGFloat size, const CGAffineTransform *matrix, CTFontOptions options );

    Parameters

    name

    The font name for which you wish to create a new font reference. A valid PostScript name is preferred, although other font name types are matched in a fallback manner.

    size

    The point size for the font reference. If 0.0 is specified, the default font size of 12.0 is used. This parameter is optional.

    matrix

    The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the identity matrix is used. This parameter is optional.

    options

    Options flags. See Font Option Constants for values. This parameter is optional.

    Return Value

    Returns a CTFontRef that best matches the name provided with size and matrix attributes.

    Discussion

    The name parameter is the only required parameter, and default values are used for unspecified parameters (0.0 for size and NULL for matrix and options). If all parameters cannot be matched identically, a best match is found.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a new font reference that best matches the given font descriptor.

    Declaration

    Swift

    func CTFontCreateWithFontDescriptor(_ descriptor: CTFontDescriptor!, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateWithFontDescriptor ( CTFontDescriptorRef descriptor, CGFloat size, const CGAffineTransform *matrix );

    Parameters

    descriptor

    A font descriptor containing attributes that specify the requested font.

    size

    The point size for the font reference. If 0.0 is specified, the default font size of 12.0 is used. This parameter is optional.

    matrix

    The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the identity matrix is used. This parameter is optional.

    Return Value

    A CTFontRef that best matches the attributes provided with the font descriptor.

    Discussion

    The size and matrix parameters override any specified in the font descriptor unless they are unspecified (0.0 for size and NULL for matrix). A best match font is always returned, and default values are used for any unspecified parameters.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a new font reference that best matches the given font descriptor.

    Declaration

    Swift

    func CTFontCreateWithFontDescriptorAndOptions(_ descriptor: CTFontDescriptor!, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>, _ options: CTFontOptions) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateWithFontDescriptorAndOptions ( CTFontDescriptorRef descriptor, CGFloat size, const CGAffineTransform *matrix, CTFontOptions options );

    Parameters

    descriptor

    A font descriptor containing attributes that specify the requested font.

    size

    The point size for the font reference. If 0.0 is specified, the default font size of 12.0 is used. This parameter is optional.

    matrix

    The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the identity matrix is used. This parameter is optional.

    options

    Options flags. See Font Option Constants for values. This parameter is optional.

    Return Value

    A CTFontRef that best matches the attributes provided with the font descriptor.

    Discussion

    The size and matrix parameters override any specified in the font descriptor, unless they are unspecified (0.0 for size and NULL for matrix and options). A best match font is always returned, and default values are used for any unspecified.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontCreateUIFontForLanguage(_ uiType: CTFontUIFontType, _ size: CGFloat, _ language: CFString!) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateUIFontForLanguage ( CTFontUIFontType uiType, CGFloat size, CFStringRef language );

    Parameters

    uiType

    A constant specifying the intended user-interface use for the requested font reference. See Enumerations for possible values.

    size

    The point size for the font reference. If 0.0 is specified, the default size for the requested user-interface type is used.

    language

    Language specifier string to select a font for a particular localization. If NULL is specified, the current system language is used. The format of the language identifier should conform to the RFC 3066bis standard.

    Return Value

    The correct font for various user-interface uses.

    Discussion

    The only required parameter is the uiType selector; the other parameters have default values.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a new font with additional attributes based on the original font.

    Declaration

    Swift

    func CTFontCreateCopyWithAttributes(_ font: CTFont!, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>, _ attributes: CTFontDescriptor!) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateCopyWithAttributes ( CTFontRef font, CGFloat size, const CGAffineTransform *matrix, CTFontDescriptorRef attributes );

    Parameters

    font

    The original font reference on which to base the new font.

    size

    The point size for the font reference. If 0.0 is specified, the original font’s size is preserved.

    matrix

    The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the original font's matrix is preserved.

    attributes

    A font descriptor containing additional attributes that the new font should contain.

    Return Value

    A new font reference converted from the original with the specified attributes.

    Discussion

    This function provides a mechanism to change attributes quickly on a given font reference in response to user actions. For instance, the size can be changed in response to a user manipulating a size slider.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a new font in the same font family as the original with the specified symbolic traits.

    Declaration

    Swift

    func CTFontCreateCopyWithSymbolicTraits(_ font: CTFont!, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>, _ symTraitValue: CTFontSymbolicTraits, _ symTraitMask: CTFontSymbolicTraits) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateCopyWithSymbolicTraits ( CTFontRef font, CGFloat size, const CGAffineTransform *matrix, CTFontSymbolicTraits symTraitValue, CTFontSymbolicTraits symTraitMask );

    Parameters

    font

    The original font reference on which to base the new font.

    size

    The point size for the font reference. If 0.0 is specified, the original font’s size is preserved.

    matrix

    The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the original font's matrix is preserved.

    symTraitValue

    The value of the symbolic traits.

    symTraitMask

    The mask bits of the symbolic traits.

    Return Value

    A new font reference in the same family with the given symbolic traits. or NULL if none is found in the system.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontCreateCopyWithFamily(_ font: CTFont!, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>, _ family: CFString!) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateCopyWithFamily ( CTFontRef font, CGFloat size, const CGAffineTransform *matrix, CFStringRef family );

    Parameters

    font

    The original font reference on which to base the new font.

    size

    The point size for the font reference. If 0.0 is specified, the original font’s size is preserved.

    matrix

    The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the original font's matrix is preserved.

    family

    The name of the desired family.

    Return Value

    A new font reference with the original traits in the given family, or NULL if none is found in the system.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontCreateForString(_ currentFont: CTFont!, _ string: CFString!, _ range: CFRange) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateForString ( CTFontRef currentFont, CFStringRef string, CFRange range );

    Parameters

    currentFont

    The current font that contains a valid cascade list.

    string

    A unicode string containing characters that cannot be encoded by the current font.

    range

    A CFRange structure specifying the range of the string that needs to be mapped.

    Return Value

    The best substitute font from the cascade list of the current font that can encode the specified string range. If the current font is capable of encoding the string range, then it is retained and returned.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the normalized font descriptor for the given font reference.

    Declaration

    Swift

    func CTFontCopyFontDescriptor(_ font: CTFont!) -> CTFontDescriptor!

    Objective-C

    CTFontDescriptorRef CTFontCopyFontDescriptor ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    A normalized font descriptor for a font containing enough information to recreate this font at a later time.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontCopyAttribute(_ font: CTFont!, _ attribute: CFString!) -> AnyObject!

    Objective-C

    CFTypeRef CTFontCopyAttribute ( CTFontRef font, CFStringRef attribute );

    Parameters

    font

    The font reference.

    attribute

    The requested attribute.

    Return Value

    A retained reference to an arbitrary attribute or NULL if the requested attribute is not present.

    Discussion

    Refer to the attribute definitions documentation for information as to how each attribute is packaged as a CFType.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the point size of the given font.

    Declaration

    Swift

    func CTFontGetSize(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetSize ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The point size of the given font reference. This is the point size provided when the font was created.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the transformation matrix of the given font.

    Declaration

    Swift

    func CTFontGetMatrix(_ font: CTFont!) -> CGAffineTransform

    Objective-C

    CGAffineTransform CTFontGetMatrix ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The transformation matrix for the given font reference. This is the matrix that was provided when the font was created.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the symbolic traits of the given font.

    Declaration

    Swift

    func CTFontGetSymbolicTraits(_ font: CTFont!) -> CTFontSymbolicTraits

    Objective-C

    CTFontSymbolicTraits CTFontGetSymbolicTraits ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The symbolic traits of the font. This is equivalent to the kCTFontSymbolicTrait value of the traits dictionary.

    Discussion

    See the Constants section of CTFontDescriptor Reference for a definition of the font traits.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the traits dictionary of the given font.

    Declaration

    Swift

    func CTFontCopyTraits(_ font: CTFont!) -> CFDictionary!

    Objective-C

    CFDictionaryRef CTFontCopyTraits ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    A retained reference to the font traits dictionary. Individual traits can be accessed with the trait key constants.

    Discussion

    See the Constants section of CTFontDescriptor Reference for a definition of the font traits.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the PostScript name of the given font.

    Declaration

    Swift

    func CTFontCopyPostScriptName(_ font: CTFont!) -> CFString!

    Objective-C

    CFStringRef CTFontCopyPostScriptName ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    A retained reference to the PostScript name of the font.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the family name of the given font.

    Declaration

    Swift

    func CTFontCopyFamilyName(_ font: CTFont!) -> CFString!

    Objective-C

    CFStringRef CTFontCopyFamilyName ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    A retained reference to the family name of the font.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the full name of the given font.

    Declaration

    Swift

    func CTFontCopyFullName(_ font: CTFont!) -> CFString!

    Objective-C

    CFStringRef CTFontCopyFullName ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    A retained reference to the full name of the font.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the display name of the given font.

    Declaration

    Swift

    func CTFontCopyDisplayName(_ font: CTFont!) -> CFString!

    Objective-C

    CFStringRef CTFontCopyDisplayName ( CTFontRef font );

    Parameters

    font

    The font reference.

    Discussion

    A retained reference to the localized display name of the font.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontCopyName(_ font: CTFont!, _ nameKey: CFString!) -> CFString!

    Objective-C

    CFStringRef CTFontCopyName ( CTFontRef font, CFStringRef nameKey );

    Parameters

    font

    The font reference.

    nameKey

    The name specifier. See “Name Specifier Constants” for possible values.

    Return Value

    The requested name for the font, or NULL if the font does not have an entry for the requested name. The Unicode version of the name is preferred, otherwise the first available version is returned.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a reference to a localized name for the given font.

    Declaration

    Swift

    func CTFontCopyLocalizedName(_ font: CTFont!, _ nameKey: CFString!, _ language: UnsafeMutablePointer<Unmanaged<CFString>?>) -> CFString!

    Objective-C

    CFStringRef CTFontCopyLocalizedName ( CTFontRef font, CFStringRef nameKey, CFStringRef *actualLanguage );

    Parameters

    font

    The font reference.

    nameKey

    The name specifier. See “Name Specifier Constants” for possible values.

    language

    On output, points to the language string of the returned name string. The format of the language identifier conforms to the RFC 3066bis standard.

    Return Value

    A specific localized name from the font reference or NULL if the font does not have an entry for the requested name key.

    Discussion

    The name is localized based on the user's global language preference precedence. That is, the user’s language preference is a list of languages in order of precedence. So, for example, if the list had Japanese and English, in that order, then a font that did not have Japanese name strings but had English strings would return the English strings.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the Unicode character set of the font.

    Declaration

    Swift

    func CTFontCopyCharacterSet(_ font: CTFont!) -> CFCharacterSet!

    Objective-C

    CFCharacterSetRef CTFontCopyCharacterSet ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    A retained reference to the font's character set.

    Discussion

    The returned character set covers the nominal referenced by the font's Unicode 'cmap’ table.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the best string encoding for legacy format support.

    Declaration

    Swift

    func CTFontGetStringEncoding(_ font: CTFont!) -> CFStringEncoding

    Objective-C

    CFStringEncoding CTFontGetStringEncoding ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The best string encoding for the font.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns an array of languages supported by the font.

    Declaration

    Swift

    func CTFontCopySupportedLanguages(_ font: CTFont!) -> CFArray!

    Objective-C

    CFArrayRef CTFontCopySupportedLanguages ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    A retained reference to an array of languages supported by the font. The array contains language identifier strings as CFStringRef objects. The format of the language identifier conforms to the RFC 3066bis standard.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetAscent(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetAscent ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The font-ascent metric scaled according to the point size and matrix of the font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetDescent(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetDescent ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The font-descent metric scaled according to the point size and matrix of the font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetLeading(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetLeading ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The font-leading metric scaled according to the point size and matrix of the font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetUnitsPerEm(_ font: CTFont!) -> UInt32

    Objective-C

    unsigned int CTFontGetUnitsPerEm ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The units per em of the font.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the number of glyphs of the given font.

    Declaration

    Swift

    func CTFontGetGlyphCount(_ font: CTFont!) -> CFIndex

    Objective-C

    CFIndex CTFontGetGlyphCount ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The number of glyphs in the font.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the scaled bounding box of the given font.

    Declaration

    Swift

    func CTFontGetBoundingBox(_ font: CTFont!) -> CGRect

    Objective-C

    CGRect CTFontGetBoundingBox ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The design bounding box of the font, which is the rectangle defined by xMin, yMin, xMax, and yMax values for the font. Returns CGRectNull on error.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the scaled underline position of the given font.

    Declaration

    Swift

    func CTFontGetUnderlinePosition(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetUnderlinePosition ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The font underline-position metric scaled according to the point size and matrix of the font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetUnderlineThickness(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetUnderlineThickness ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The font underline-thickness metric scaled according to the point size and matrix of the font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the slant angle of the given font.

    Declaration

    Swift

    func CTFontGetSlantAngle(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetSlantAngle ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The transformed slant angle of the font. This is equivalent to the italic or caret angle with any skew from the transformation matrix applied.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the cap-height metric of the given font.

    Declaration

    Swift

    func CTFontGetCapHeight(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetCapHeight ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The font cap-height metric scaled according to the point size and matrix of the font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the x-height metric of the given font.

    Declaration

    Swift

    func CTFontGetXHeight(_ font: CTFont!) -> CGFloat

    Objective-C

    CGFloat CTFontGetXHeight ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The font x-height metric scaled according to the point size and matrix of the font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Creates a path for the specified glyph.

    Declaration

    Swift

    func CTFontCreatePathForGlyph(_ font: CTFont!, _ glyph: CGGlyph, _ transform: UnsafePointer<CGAffineTransform>) -> CGPath!

    Objective-C

    CGPathRef CTFontCreatePathForGlyph ( CTFontRef font, CGGlyph glyph, const CGAffineTransform *transform );

    Parameters

    font

    The font reference.

    glyph

    The glyph.

    transform

    An affine transform applied to the path. Can be NULL. If NULL, CGAffineTransformIdentity is used.

    Return Value

    A CGPath object containing the glyph outlines, NULL on error. Must be released by caller.

    Discussion

    Creates a path from the outlines of the glyph for the specified font. The path reflects the font point size, matrix, and transform parameter, applied in that order. The transform parameter is most commonly be used to provide a translation to the desired glyph origin.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetGlyphWithName(_ font: CTFont!, _ glyphName: CFString!) -> CGGlyph

    Objective-C

    CGGlyph CTFontGetGlyphWithName ( CTFontRef font, CFStringRef glyphName );

    Parameters

    font

    The font reference.

    glyphName

    The glyph name as a CFString object.

    Return Value

    The glyph value for the named glyph as a CGGlyph object, or if the glyph name is not recognized, the .notdef glyph index value.

    Discussion

    The returned CGGlyph object can be used with any of the subsequent glyph data accessors or directly with Core Graphics.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetBoundingRectsForGlyphs(_ font: CTFont!, _ orientation: CTFontOrientation, _ glyphs: UnsafePointer<CGGlyph>, _ boundingRects: UnsafeMutablePointer<CGRect>, _ count: CFIndex) -> CGRect

    Objective-C

    CGRect CTFontGetBoundingRectsForGlyphs ( CTFontRef font, CTFontOrientation orientation, const CGGlyph glyphs[], CGRect boundingRects[], CFIndex count );

    Parameters

    font

    The font reference.

    orientation

    The intended drawing orientation of the glyphs. Used to determined which glyph metrics to return.

    glyphs

    An array of count number of glyphs.

    boundingRects

    On output, the computed glyph rectangles in an array of count number of CGRect objects. If NULL, only the overall bounding rectangle is calculated.

    count

    The capacity of the glyphs and boundingRects buffers.

    Return Value

    The overall bounding rectangle for an array or run of glyphs. Returns CGRectNull on error.

    Discussion

    The bounding rectangles of the individual glyphs are returned through the boundingRects parameter. These are the design metrics from the font transformed in font space.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Calculates the advances for an array of glyphs and returns the summed advance.

    Declaration

    Swift

    func CTFontGetAdvancesForGlyphs(_ font: CTFont!, _ orientation: CTFontOrientation, _ glyphs: UnsafePointer<CGGlyph>, _ advances: UnsafeMutablePointer<CGSize>, _ count: CFIndex) -> Double

    Objective-C

    double CTFontGetAdvancesForGlyphs ( CTFontRef font, CTFontOrientation orientation, const CGGlyph glyphs[], CGSize advances[], CFIndex count );

    Parameters

    font

    The font reference.

    orientation

    The intended drawing orientation of the glyphs. Used to determined which glyph metrics to return.

    glyphs

    An array of count number of glyphs.

    advances

    An array of count number of CGSize objects to receive the computed glyph advances. If NULL, only the overall advance is calculated.

    count

    The capacity of the glyphs and advances buffers.

    Return Value

    The summed glyph advance of an array of glyphs.

    Discussion

    Individual glyph advances are passed back via the advances parameter. These are the ideal metrics for each glyph scaled and transformed in font space.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetVerticalTranslationsForGlyphs(_ font: CTFont!, _ glyphs: UnsafePointer<CGGlyph>, _ translations: UnsafeMutablePointer<CGSize>, _ count: CFIndex)

    Objective-C

    void CTFontGetVerticalTranslationsForGlyphs ( CTFontRef font, const CGGlyph glyphs[], CGSize translations[], CFIndex count );

    Parameters

    font

    The font reference.

    glyphs

    An array of count number of glyphs.

    translations

    On output, the computed origin offsets in an array of count number of CGSize objects.

    count

    The capacity of the glyphs and translations buffers.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns an array of variation axes.

    Declaration

    Swift

    func CTFontCopyVariationAxes(_ font: CTFont!) -> CFArray!

    Objective-C

    CFArrayRef CTFontCopyVariationAxes ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    An array of variation axes dictionaries. Each variation axis dictionary contains the five variation axis keys listed in “Font Variation Axis Dictionary Keys”.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a variation dictionary from the font reference.

    Declaration

    Swift

    func CTFontCopyVariation(_ font: CTFont!) -> CFDictionary!

    Objective-C

    CFDictionaryRef CTFontCopyVariation ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    The current variation instance as a dictionary.

    Discussion

    The keys for each variation correspond to the variation identifier obtained via kCTFontVariationAxisIdentifierKey, which represents the four-character axis code as a CFNumber object.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns an array of font features.

    Declaration

    Swift

    func CTFontCopyFeatures(_ font: CTFont!) -> CFArray!

    Objective-C

    CFArrayRef CTFontCopyFeatures ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    An array of font feature dictionaries for the font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns an array of font feature-setting tuples.

    Declaration

    Swift

    func CTFontCopyFeatureSettings(_ font: CTFont!) -> CFArray!

    Objective-C

    CFArrayRef CTFontCopyFeatureSettings ( CTFontRef font );

    Parameters

    font

    The font reference.

    Return Value

    A normalized array of font feature-setting dictionaries. The array contains only the non-default settings that should be applied to the font, or NULL if the default settings should be used.

    Discussion

    A feature-setting dictionary is a tuple of a kCTFontFeatureTypeIdentifierKey key-value pair and a kCTFontFeatureSelectorIdentifierKey key-value pair. Each setting dictionary indicates which setting is enabled. It is the caller's responsibility to handle exclusive and nonexclusive settings as necessary.

    The feature settings are verified against those that the font supports and any that do not apply are removed. Further, feature settings that represent a default setting for the font are also removed.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontGetGlyphsForCharacters(_ font: CTFont!, _ characters: UnsafePointer<UniChar>, _ glyphs: UnsafeMutablePointer<CGGlyph>, _ count: CFIndex) -> Bool

    Objective-C

    bool CTFontGetGlyphsForCharacters ( CTFontRef font, const UniChar characters[], CGGlyph glyphs[], CFIndex count );

    Parameters

    font

    The font reference.

    characters

    An array of Unicode characters.

    glyphs

    On output, points to an array of glyph values.

    count

    The capacity of the character and glyph arrays.

    Return Value

    True if the font could encode all Unicode characters; otherwise False.

    Discussion

    If a glyph could not be encoded, a value of 0 is passed back at the corresponding index in the glyphs array and the function returns False. It is the responsibility of the caller to handle the Unicode properties of the input characters.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

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

    Declaration

    Swift

    func CTFontDrawGlyphs(_ font: CTFont!, _ glyphs: UnsafePointer<CGGlyph>, _ positions: UnsafePointer<CGPoint>, _ count: Int, _ context: CGContext!)

    Objective-C

    void CTFontDrawGlyphs ( CTFontRef font, const CGGlyph glyphs[], const CGPoint positions[], size_t count, CGContextRef context );

    Parameters

    font

    The font with glyphs to render. If the font has a size or matrix attribute, context is set with these values.

    glyphs

    The glyphs to be rendered. The glyphs should be the result of proper Unicode text layout operations (such as with CTLine). Functions such as CTFontGetGlyphsForCharacters do not perform any Unicode text layout.

    positions

    The positions (origins) for each glyph in glyphs. The positions are in user space. The number of positions passed in must match the number of glyphs (in glyphs).

    count

    The number of glyphs to be rendered from the glyphs array.

    context

    The graphics context used to render the glyphs.

    Discussion

    This function modifies graphics state including font, text size, and text matrix if these attributes are specified in font. These attributes are not restored.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 4.2 and later.

  • Returns caret positions within a glyph.

    Declaration

    Swift

    func CTFontGetLigatureCaretPositions(_ font: CTFont!, _ glyph: CGGlyph, _ positions: UnsafeMutablePointer<CGFloat>, _ maxPositions: CFIndex) -> CFIndex

    Objective-C

    CFIndex CTFontGetLigatureCaretPositions ( CTFontRef font, CGGlyph glyph, CGFloat positions[], CFIndex maxPositions );

    Parameters

    font

    A reference to the font to use.

    glyph

    A reference to the glyph.

    positions

    A buffer of at least maxPositions to receive the ligature caret positions for glyph.

    maxPositions

    The maximum number of positions to return.

    Return Value

    The maximum number of caret positions for the specified glyph

    Discussion

    This function is used to obtain caret positions for a specific glyph. The return value is the maximum number of positions possible, and the function will populate the caller's positions buffer with available positions if possible. This function might not be able to produce positions if the font does not have the appropriate data, in which case it will return 0.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a Core Graphics font reference and attributes.

    Declaration

    Swift

    func CTFontCopyGraphicsFont(_ font: CTFont!, _ attributes: UnsafeMutablePointer<Unmanaged<CTFontDescriptor>?>) -> CGFont!

    Objective-C

    CGFontRef CTFontCopyGraphicsFont ( CTFontRef font, CTFontDescriptorRef *attributes );

    Parameters

    font

    The font reference.

    attributes

    On output, points to a font descriptor containing additional attributes from the font. Can be NULL. Must be released by the caller.

    Return Value

    A CGFontRef object for the given font reference.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Creates a new font reference from an existing Core Graphics font reference.

    Declaration

    Swift

    func CTFontCreateWithGraphicsFont(_ graphicsFont: CGFont!, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>, _ attributes: CTFontDescriptor!) -> CTFont!

    Objective-C

    CTFontRef CTFontCreateWithGraphicsFont ( CGFontRef graphicsFont, CGFloat size, const CGAffineTransform *matrix, CTFontDescriptorRef attributes );

    Parameters

    graphicsFont

    A valid Core Graphics font reference.

    size

    The point size for the font reference. If 0.0 is specified the default font size of 12.0 is used.

    matrix

    The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL, the identity matrix is used. Optional.

    attributes

    Additional attributes that should be matched. Optional.

    Return Value

    A new font reference for an existing CGFontRef object with the specified size, matrix, and additional attributes.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns an array of font table tags.

    Declaration

    Swift

    func CTFontCopyAvailableTables(_ font: CTFont!, _ options: CTFontTableOptions) -> CFArray!

    Objective-C

    CFArrayRef CTFontCopyAvailableTables ( CTFontRef font, CTFontTableOptions options );

    Parameters

    font

    The font reference.

    options

    The font table options.

    Return Value

    An array of Font Table Tag Constants values for the given font and the supplied options.

    Discussion

    The returned set will contain unboxed values, which can be extracted like so:

    • CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tags, index);

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a reference to the font table data.

    Declaration

    Swift

    func CTFontCopyTable(_ font: CTFont!, _ table: CTFontTableTag, _ options: CTFontTableOptions) -> CFData!

    Objective-C

    CFDataRef CTFontCopyTable ( CTFontRef font, CTFontTableTag table, CTFontTableOptions options );

    Parameters

    font

    The font reference.

    table

    The font table identifier as a Font Table Tag Constants constant. See Font Table Tag Constants for possible values.

    options

    The font table options.

    Return Value

    A retained reference to the font table data as a CFDataRef object. The table data is not actually copied; however, the data reference must be released.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the type identifier for Core Text font references.

    Declaration

    Swift

    func CTFontGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID CTFontGetTypeID ( void );

    Return Value

    The identifier for the CTFont opaque type.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

Data Types

  • A reference to a Core Text font object.

    Declaration

    Swift

    typealias CTFontRef = CTFont

    Objective-C

    typedef const struct __CTFont *CTFontRef;

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

Constants

Global Variables

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

    Declaration

    Swift

    let kCTFontCopyrightNameKey: CFString! let kCTFontFamilyNameKey: CFString! let kCTFontSubFamilyNameKey: CFString! let kCTFontStyleNameKey: CFString! let kCTFontUniqueNameKey: CFString! let kCTFontFullNameKey: CFString! let kCTFontVersionNameKey: CFString! let kCTFontPostScriptNameKey: CFString! let kCTFontTrademarkNameKey: CFString! let kCTFontManufacturerNameKey: CFString! let kCTFontDesignerNameKey: CFString! let kCTFontDescriptionNameKey: CFString! let kCTFontVendorURLNameKey: CFString! let kCTFontDesignerURLNameKey: CFString! let kCTFontLicenseNameKey: CFString! let kCTFontLicenseURLNameKey: CFString! let kCTFontSampleTextNameKey: CFString! let kCTFontPostScriptCIDNameKey: CFString!

    Objective-C

    const CFStringRef kCTFontCopyrightNameKey; const CFStringRef kCTFontFamilyNameKey; const CFStringRef kCTFontSubFamilyNameKey; const CFStringRef kCTFontStyleNameKey; const CFStringRef kCTFontUniqueNameKey; const CFStringRef kCTFontFullNameKey; const CFStringRef kCTFontVersionNameKey; const CFStringRef kCTFontPostScriptNameKey; const CFStringRef kCTFontTrademarkNameKey; const CFStringRef kCTFontManufacturerNameKey; const CFStringRef kCTFontDesignerNameKey; const CFStringRef kCTFontDescriptionNameKey; const CFStringRef kCTFontVendorURLNameKey; const CFStringRef kCTFontDesignerURLNameKey; const CFStringRef kCTFontLicenseNameKey; const CFStringRef kCTFontLicenseURLNameKey; const CFStringRef kCTFontSampleTextNameKey; const CFStringRef kCTFontPostScriptCIDNameKey;

    Constants

    • kCTFontCopyrightNameKey

      kCTFontCopyrightNameKey

      The name specifier for the copyright name.

      Available in iOS 3.2 and later.

    • kCTFontFamilyNameKey

      kCTFontFamilyNameKey

      The name specifier for the family name.

      Available in iOS 3.2 and later.

    • kCTFontSubFamilyNameKey

      kCTFontSubFamilyNameKey

      The name specifier for the subfamily name.

      Available in iOS 3.2 and later.

    • kCTFontStyleNameKey

      kCTFontStyleNameKey

      The name specifier for the style name.

      Available in iOS 3.2 and later.

    • kCTFontUniqueNameKey

      kCTFontUniqueNameKey

      The name specifier for the unique name.

      Available in iOS 3.2 and later.

    • kCTFontFullNameKey

      kCTFontFullNameKey

      The name specifier for the full name.

      Available in iOS 3.2 and later.

    • kCTFontVersionNameKey

      kCTFontVersionNameKey

      The name specifier for the version name.

      Available in iOS 3.2 and later.

    • kCTFontPostScriptNameKey

      kCTFontPostScriptNameKey

      The name specifier for the PostScript name.

      Available in iOS 3.2 and later.

    • kCTFontTrademarkNameKey

      kCTFontTrademarkNameKey

      The name specifier for the trademark name.

      Available in iOS 3.2 and later.

    • kCTFontManufacturerNameKey

      kCTFontManufacturerNameKey

      The name specifier for the manufacturer name.

      Available in iOS 3.2 and later.

    • kCTFontDesignerNameKey

      kCTFontDesignerNameKey

      The name specifier for the designer name.

      Available in iOS 3.2 and later.

    • kCTFontDescriptionNameKey

      kCTFontDescriptionNameKey

      The name specifier for the description name.

      Available in iOS 3.2 and later.

    • kCTFontVendorURLNameKey

      kCTFontVendorURLNameKey

      The name specifier for the vendor URL name.

      Available in iOS 3.2 and later.

    • kCTFontDesignerURLNameKey

      kCTFontDesignerURLNameKey

      The name specifier for the designer URL name.

      Available in iOS 3.2 and later.

    • kCTFontLicenseNameKey

      kCTFontLicenseNameKey

      The name specifier for the license name.

      Available in iOS 3.2 and later.

    • kCTFontLicenseURLNameKey

      kCTFontLicenseURLNameKey

      The name specifier for the license URL name.

      Available in iOS 3.2 and later.

    • kCTFontSampleTextNameKey

      kCTFontSampleTextNameKey

      The name specifier for the sample text name string.

      Available in iOS 3.2 and later.

    • kCTFontPostScriptCIDNameKey

      kCTFontPostScriptCIDNameKey

      The name specifier for the PostScript character identifier (CID) font name.

      Available in iOS 3.2 and later.

  • These constants provide keys to font variation axis dictionary values.

    Declaration

    Swift

    let kCTFontVariationAxisIdentifierKey: CFString! let kCTFontVariationAxisMinimumValueKey: CFString! let kCTFontVariationAxisMaximumValueKey: CFString! let kCTFontVariationAxisDefaultValueKey: CFString! let kCTFontVariationAxisNameKey: CFString!

    Objective-C

    const CFStringRef kCTFontVariationAxisIdentifierKey; const CFStringRef kCTFontVariationAxisMinimumValueKey; const CFStringRef kCTFontVariationAxisMaximumValueKey; const CFStringRef kCTFontVariationAxisDefaultValueKey; const CFStringRef kCTFontVariationAxisNameKey;

    Constants

    • kCTFontVariationAxisIdentifierKey

      kCTFontVariationAxisIdentifierKey

      Key to get the variation axis identifier value as a CFNumberRef object.

      Available in iOS 3.2 and later.

    • kCTFontVariationAxisMinimumValueKey

      kCTFontVariationAxisMinimumValueKey

      Key to get the variation axis minimum value as a CFNumberRef object.

      Available in iOS 3.2 and later.

    • kCTFontVariationAxisMaximumValueKey

      kCTFontVariationAxisMaximumValueKey

      Key to get the variation axis maximum value as a CFNumberRef object.

      Available in iOS 3.2 and later.

    • kCTFontVariationAxisDefaultValueKey

      kCTFontVariationAxisDefaultValueKey

      Key to get the variation axis default value as a CFNumberRef object.

      Available in iOS 3.2 and later.

    • kCTFontVariationAxisNameKey

      kCTFontVariationAxisNameKey

      Key to get the localized variation axis name string.

      Available in iOS 3.2 and later.

  • These constants provide keys to font feature dictionary values.

    Declaration

    Swift

    let kCTFontFeatureTypeIdentifierKey: CFString! let kCTFontFeatureTypeNameKey: CFString! let kCTFontFeatureTypeExclusiveKey: CFString! let kCTFontFeatureTypeSelectorsKey: CFString! let kCTFontFeatureSelectorIdentifierKey: CFString! let kCTFontFeatureSelectorNameKey: CFString! let kCTFontFeatureSelectorDefaultKey: CFString! let kCTFontFeatureSelectorSettingKey: CFString!

    Objective-C

    const CFStringRef kCTFontFeatureTypeIdentifierKey; const CFStringRef kCTFontFeatureTypeNameKey; const CFStringRef kCTFontFeatureTypeExclusiveKey; const CFStringRef kCTFontFeatureTypeSelectorsKey; const CFStringRef kCTFontFeatureSelectorIdentifierKey; const CFStringRef kCTFontFeatureSelectorNameKey; const CFStringRef kCTFontFeatureSelectorDefaultKey; const CFStringRef kCTFontFeatureSelectorSettingKey;

    Constants

    • kCTFontFeatureTypeIdentifierKey

      kCTFontFeatureTypeIdentifierKey

      Key to get the font feature type value as a CFNumberRef object.

      Available in iOS 3.2 and later.

    • kCTFontFeatureTypeNameKey

      kCTFontFeatureTypeNameKey

      Key to get the localized font feature type name as a CFString object.

      Available in iOS 3.2 and later.

    • kCTFontFeatureTypeExclusiveKey

      kCTFontFeatureTypeExclusiveKey

      Key to get the font feature exclusive setting of the feature as a CFBoolean object. The value associated with this key indicates whether the feature selectors associated with this type should be mutually exclusive.

      Available in iOS 3.2 and later.

    • kCTFontFeatureTypeSelectorsKey

      kCTFontFeatureTypeSelectorsKey

      Key to get the the array of font feature selectors as a CFArrayRef object. This is an array of selector dictionaries that contain the values for the font feature selector keys listed in this group.

      Available in iOS 3.2 and later.

    • kCTFontFeatureSelectorIdentifierKey

      kCTFontFeatureSelectorIdentifierKey

      Key to be used with a selector dictionary corresponding to a feature type to obtain the selector identifier value as a CFNumberRef object.

      Available in iOS 3.2 and later.

    • kCTFontFeatureSelectorNameKey

      kCTFontFeatureSelectorNameKey

      Key to be used with a selector dictionary to get the localized name string for the selector as a CFStringRef object.

      Available in iOS 3.2 and later.

    • kCTFontFeatureSelectorDefaultKey

      kCTFontFeatureSelectorDefaultKey

      Key to be used with a selector dictionary to get the default indicator for the selector. This value is a CFBooleanRef object, which if present and true, indicates that this selector is the default setting for the current feature type.

      Available in iOS 3.2 and later.

    • kCTFontFeatureSelectorSettingKey

      kCTFontFeatureSelectorSettingKey

      Key to be used with a selector dictionary to get or specify the current setting for the selector. This value is a CFBooleanRef object to indicate whether this selector is on or off. If this key is not present, the default setting is used.

      Available in iOS 3.2 and later.

Enumerations

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

    Declaration

    Swift

    enum CTFontUIFontType : UInt32 { case UIFontNone case UIFontUser case UIFontUserFixedPitch case UIFontSystem case UIFontEmphasizedSystem case UIFontSmallSystem case UIFontSmallEmphasizedSystem case UIFontMiniSystem case UIFontMiniEmphasizedSystem case UIFontViews case UIFontApplication case UIFontLabel case UIFontMenuTitle case UIFontMenuItem case UIFontMenuItemMark case UIFontMenuItemCmdKey case UIFontWindowTitle case UIFontPushButton case UIFontUtilityWindowTitle case UIFontAlertHeader case UIFontSystemDetail case UIFontEmphasizedSystemDetail case UIFontToolbar case UIFontSmallToolbar case UIFontMessage case UIFontPalette case UIFontToolTip case UIFontControlContent }

    Objective-C

    enum { kCTFontNoFontType = -1, kCTFontUserFontType = 0, kCTFontUserFixedPitchFontType = 1, kCTFontSystemFontType = 2, kCTFontEmphasizedSystemFontType = 3, kCTFontSmallSystemFontType = 4, kCTFontSmallEmphasizedSystemFontType = 5, kCTFontMiniSystemFontType = 6, kCTFontMiniEmphasizedSystemFontType = 7, kCTFontViewsFontType = 8, kCTFontApplicationFontType = 9, kCTFontLabelFontType = 10, kCTFontMenuTitleFontType = 11, kCTFontMenuItemFontType = 12, kCTFontMenuItemMarkFontType = 13, kCTFontMenuItemCmdKeyFontType = 14, kCTFontWindowTitleFontType = 15, kCTFontPushButtonFontType = 16, kCTFontUtilityWindowTitleFontType = 17, kCTFontAlertHeaderFontType = 18, kCTFontSystemDetailFontType = 19, kCTFontEmphasizedSystemDetailFontType = 20, kCTFontToolbarFontType = 21, kCTFontSmallToolbarFontType = 22, kCTFontMessageFontType = 23, kCTFontPaletteFontType = 24, kCTFontToolTipFontType = 25, kCTFontControlContentFontType = 26}; typedef uint32_t CTFontUIFontType;

    Constants

    • kCTFontNoFontType

      kCTFontNoFontType

      The user-interface font type is not specified.

      Available in iOS 3.2 and later.

    • kCTFontUserFontType

      kCTFontUserFontType

      The font used by default for documents and other text under the user’s control (that is, text whose font the user can normally change).

      Available in iOS 3.2 and later.

    • kCTFontUserFixedPitchFontType

      kCTFontUserFixedPitchFontType

      The font used by default for documents and other text under the user’s control when that font is fixed-pitch.

      Available in iOS 3.2 and later.

    • kCTFontSystemFontType

      kCTFontSystemFontType

      The system font used for standard user-interface items such as button labels, menu items, and so on.

      Available in iOS 3.2 and later.

    • kCTFontEmphasizedSystemFontType

      kCTFontEmphasizedSystemFontType

      The system font used for emphasis in alerts.

      Available in iOS 3.2 and later.

    • kCTFontSmallSystemFontType

      kCTFontSmallSystemFontType

      The standard small system font used for informative text in alerts, column headings in lists, help tags, and small controls.

      Available in iOS 3.2 and later.

    • kCTFontSmallEmphasizedSystemFontType

      kCTFontSmallEmphasizedSystemFontType

      The small system font used for emphasis.

      Available in iOS 3.2 and later.

    • kCTFontMiniSystemFontType

      kCTFontMiniSystemFontType

      The standard miniature system font used for mini controls and utility window labels and text.

      Available in iOS 3.2 and later.

    • kCTFontMiniEmphasizedSystemFontType

      kCTFontMiniEmphasizedSystemFontType

      The miniature system font used for emphasis.

      Available in iOS 3.2 and later.

    • kCTFontViewsFontType

      kCTFontViewsFontType

      The view font used as the default font of text in lists and tables.

      Available in iOS 3.2 and later.

    • kCTFontApplicationFontType

      kCTFontApplicationFontType

      The default font for text documents.

      Available in iOS 3.2 and later.

    • kCTFontLabelFontType

      kCTFontLabelFontType

      The font used for labels and tick marks on full-size sliders.

      Available in iOS 3.2 and later.

    • kCTFontMenuTitleFontType

      kCTFontMenuTitleFontType

      The font used for menu titles.

      Available in iOS 3.2 and later.

    • kCTFontMenuItemFontType

      kCTFontMenuItemFontType

      The font used for menu items.

      Available in iOS 3.2 and later.

    • kCTFontMenuItemMarkFontType

      kCTFontMenuItemMarkFontType

      The font used to draw menu item marks.

      Available in iOS 3.2 and later.

    • kCTFontMenuItemCmdKeyFontType

      kCTFontMenuItemCmdKeyFontType

      The font used for menu-item command-key equivalents.

      Available in iOS 3.2 and later.

    • kCTFontWindowTitleFontType

      kCTFontWindowTitleFontType

      The font used for window titles.

      Available in iOS 3.2 and later.

    • kCTFontPushButtonFontType

      kCTFontPushButtonFontType

      The font used for a push button (a rounded rectangular button with a text label on it).

      Available in iOS 3.2 and later.

    • kCTFontUtilityWindowTitleFontType

      kCTFontUtilityWindowTitleFontType

      The font used for utility window titles.

      Available in iOS 3.2 and later.

    • kCTFontAlertHeaderFontType

      kCTFontAlertHeaderFontType

      The font used for alert headers.

      Available in iOS 3.2 and later.

    • kCTFontSystemDetailFontType

      kCTFontSystemDetailFontType

      The standard system font used for details.

      Available in iOS 3.2 and later.

    • kCTFontEmphasizedSystemDetailFontType

      kCTFontEmphasizedSystemDetailFontType

      The system font used for emphasis in details.

      Available in iOS 3.2 and later.

    • kCTFontToolbarFontType

      kCTFontToolbarFontType

      The font used for labels of toolbar items.

      Available in iOS 3.2 and later.

    • kCTFontSmallToolbarFontType

      kCTFontSmallToolbarFontType

      The small font used for labels of toolbar items.

      Available in iOS 3.2 and later.

    • kCTFontMessageFontType

      kCTFontMessageFontType

      The font used for standard interface items, such as button labels, menu items, and so on.

      Available in iOS 3.2 and later.

    • kCTFontPaletteFontType

      kCTFontPaletteFontType

      The font used in tool palettes.

      Available in iOS 3.2 and later.

    • kCTFontToolTipFontType

      kCTFontToolTipFontType

      The font used for tool tips.

      Available in iOS 3.2 and later.

    • kCTFontControlContentFontType

      kCTFontControlContentFontType

      The font used for contents of user-interface controls.

      Available in iOS 3.2 and later.

    Discussion

    Use these constants with the CTFontCreateUIFontForLanguage function to indicate the intended user interface use of the font reference to be created.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Font table tags provide access to font table data.

    Declaration

    Swift

    typealias CTFontTableTag = FourCharCode

    Objective-C

    enum { kCTFontTableBASE = 'BASE', kCTFontTableCFF = 'CFF ', kCTFontTableDSIG = 'DSIG', kCTFontTableEBDT = 'EBDT', kCTFontTableEBLC = 'EBLC', kCTFontTableEBSC = 'EBSC', kCTFontTableGDEF = 'GDEF', kCTFontTableGPOS = 'GPOS', kCTFontTableGSUB = 'GSUB', kCTFontTableJSTF = 'JSTF', kCTFontTableLTSH = 'LTSH', kCTFontTableOS2 = 'OS/2', kCTFontTablePCLT = 'PCLT', kCTFontTableVDMX = 'VDMX', kCTFontTableVORG = 'VORG', kCTFontTableZapf = 'Zapf', kCTFontTableAcnt = 'acnt', kCTFontTableAvar = 'avar', kCTFontTableBdat = 'bdat', kCTFontTableBhed = 'bhed', kCTFontTableBloc = 'bloc', kCTFontTableBsln = 'bsln', kCTFontTableCmap = 'cmap', kCTFontTableCvar = 'cvar', kCTFontTableCvt = 'cvt ', kCTFontTableFdsc = 'fdsc', kCTFontTableFeat = 'feat', kCTFontTableFmtx = 'fmtx', kCTFontTableFpgm = 'fpgm', kCTFontTableFvar = 'fvar', kCTFontTableGasp = 'gasp', kCTFontTableGlyf = 'glyf', kCTFontTableGvar = 'gvar', kCTFontTableHdmx = 'hdmx', kCTFontTableHead = 'head', kCTFontTableHhea = 'hhea', kCTFontTableHmtx = 'hmtx', kCTFontTableHsty = 'hsty', kCTFontTableJust = 'just', kCTFontTableKern = 'kern', kCTFontTableKerx = 'kerx', kCTFontTableLcar = 'lcar', kCTFontTableLoca = 'loca', kCTFontTableMaxp = 'maxp', kCTFontTableMort = 'mort', kCTFontTableMorx = 'morx', kCTFontTableName = 'name', kCTFontTableOpbd = 'opbd', kCTFontTablePost = 'post', kCTFontTablePrep = 'prep', kCTFontTableProp = 'prop', kCTFontTableSbit = 'sbit', kCTFontTableSbix = 'sbix', kCTFontTableTrak = 'trak', kCTFontTableVhea = 'vhea', kCTFontTableVmtx = 'vmtx' }; typedef uint32_t CTFontTableTag;

    Constants

    • kCTFontTableBASE

      kCTFontTableBASE

      Font table tag for the font baseline.

      Available in iOS 3.2 and later.

    • kCTFontTableCFF

      kCTFontTableCFF

      Font table tag for a PostScript font program.

      Available in iOS 3.2 and later.

    • kCTFontTableDSIG

      kCTFontTableDSIG

      Font table tag for a digital signature.

      Available in iOS 3.2 and later.

    • kCTFontTableEBDT

      kCTFontTableEBDT

      Font table tag for an embedded bitmap.

      Available in iOS 3.2 and later.

    • kCTFontTableEBLC

      kCTFontTableEBLC

      Font table tag for the embedded bitmap location.

      Available in iOS 3.2 and later.

    • kCTFontTableEBSC

      kCTFontTableEBSC

      Font table tag for embedded bitmap scaling.

      Available in iOS 3.2 and later.

    • kCTFontTableGDEF

      kCTFontTableGDEF

      Font table tag for glyph definition.

      Available in iOS 3.2 and later.

    • kCTFontTableGPOS

      kCTFontTableGPOS

      Font table tag for glyph positioning.

      Available in iOS 3.2 and later.

    • kCTFontTableGSUB

      kCTFontTableGSUB

      Font table tag for glyph substitution.

      Available in iOS 3.2 and later.

    • kCTFontTableJSTF

      kCTFontTableJSTF

      Font table tag for justification.

      Available in iOS 3.2 and later.

    • kCTFontTableLTSH

      kCTFontTableLTSH

      Font table tag for linear threshold.

      Available in iOS 3.2 and later.

    • kCTFontTableOS2

      kCTFontTableOS2

      Font table tag for OS/2 and Windows-specific metrics.

      Available in iOS 3.2 and later.

    • kCTFontTablePCLT

      kCTFontTablePCLT

      Font table tag for PCL 5 data.

      Available in iOS 3.2 and later.

    • kCTFontTableVDMX

      kCTFontTableVDMX

      Font table tag for vertical device metrics.

      Available in iOS 3.2 and later.

    • kCTFontTableVORG

      kCTFontTableVORG

      Font table tag for vertical origin.

      Available in iOS 3.2 and later.

    • kCTFontTableZapf

      kCTFontTableZapf

      Font table tag for glyph reference.

      Available in iOS 3.2 and later.

    • kCTFontTableAcnt

      kCTFontTableAcnt

      Font table tag for accent attachment.

      Available in iOS 3.2 and later.

    • kCTFontTableAvar

      kCTFontTableAvar

      Font table tag for axis variation.

      Available in iOS 3.2 and later.

    • kCTFontTableBdat

      kCTFontTableBdat

      Font table tag for bitmap data.

      Available in iOS 3.2 and later.

    • kCTFontTableBhed

      kCTFontTableBhed

      Font table tag for bitmap font header.

      Available in iOS 3.2 and later.

    • kCTFontTableBloc

      kCTFontTableBloc

      Font table tag for bitmap location.

      Available in iOS 3.2 and later.

    • kCTFontTableBsln

      kCTFontTableBsln

      Font table tag for baseline.

      Available in iOS 3.2 and later.

    • kCTFontTableCmap

      kCTFontTableCmap

      Font table tag for character-to-glyph mapping.

      Available in iOS 3.2 and later.

    • kCTFontTableCvar

      kCTFontTableCvar

      Font table tag for control value variation, or CVT variation.

      Available in iOS 3.2 and later.

    • kCTFontTableCvt

      kCTFontTableCvt

      Font table tag for control value table.

      Available in iOS 3.2 and later.

    • kCTFontTableFdsc

      kCTFontTableFdsc

      Font table tag for font descriptor.

      Available in iOS 3.2 and later.

    • kCTFontTableFeat

      kCTFontTableFeat

      Font table tag for layout feature.

      Available in iOS 3.2 and later.

    • kCTFontTableFmtx

      kCTFontTableFmtx

      Font table tag for font metrics.

      Available in iOS 3.2 and later.

    • kCTFontTableFpgm

      kCTFontTableFpgm

      Font table tag for font program.

      Available in iOS 3.2 and later.

    • kCTFontTableFvar

      kCTFontTableFvar

      Font table tag for font variation.

      Available in iOS 3.2 and later.

    • kCTFontTableGasp

      kCTFontTableGasp

      Font table tag for grid-fitting/scan-conversion.

      Available in iOS 3.2 and later.

    • kCTFontTableGlyf

      kCTFontTableGlyf

      Font table tag for glyph data.

      Available in iOS 3.2 and later.

    • kCTFontTableGvar

      kCTFontTableGvar

      Font table tag for glyph variation.

      Available in iOS 3.2 and later.

    • kCTFontTableHdmx

      kCTFontTableHdmx

      Font table tag for horizontal device metrics.

      Available in iOS 3.2 and later.

    • kCTFontTableHead

      kCTFontTableHead

      Font table tag for font header.

      Available in iOS 3.2 and later.

    • kCTFontTableHhea

      kCTFontTableHhea

      Font table tag for horizontal header.

      Available in iOS 3.2 and later.

    • kCTFontTableHmtx

      kCTFontTableHmtx

      Font table tag for horizontal metrics.

      Available in iOS 3.2 and later.

    • kCTFontTableHsty

      kCTFontTableHsty

      Font table tag for horizontal style.

      Available in iOS 3.2 and later.

    • kCTFontTableJust

      kCTFontTableJust

      Font table tag for justification.

      Available in iOS 3.2 and later.

    • kCTFontTableKern

      kCTFontTableKern

      Font table tag for kerning.

      Available in iOS 3.2 and later.

    • kCTFontTableKerx

      kCTFontTableKerx

      Font table tag for extended kerning.

      Available in iOS 4.3 and later.

    • kCTFontTableLcar

      kCTFontTableLcar

      Font table tag for ligature caret.

      Available in iOS 3.2 and later.

    • kCTFontTableLoca

      kCTFontTableLoca

      Font table tag for index to location.

      Available in iOS 3.2 and later.

    • kCTFontTableMaxp

      kCTFontTableMaxp

      Font table tag for maximum profile.

      Available in iOS 3.2 and later.

    • kCTFontTableMort

      kCTFontTableMort

      Font table tag for morph.

      Available in iOS 3.2 and later.

    • kCTFontTableMorx

      kCTFontTableMorx

      Font table tag for extended morph.

      Available in iOS 3.2 and later.

    • kCTFontTableName

      kCTFontTableName

      Font table tag for naming table.

      Available in iOS 3.2 and later.

    • kCTFontTableOpbd

      kCTFontTableOpbd

      Font table tag for optical bounds.

      Available in iOS 3.2 and later.

    • kCTFontTablePost

      kCTFontTablePost

      Font table tag for PostScript information.

      Available in iOS 3.2 and later.

    • kCTFontTablePrep

      kCTFontTablePrep

      Font table tag for control value program, 'prep' table.

      Available in iOS 3.2 and later.

    • kCTFontTableProp

      kCTFontTableProp

      Font table tag for properties.

      Available in iOS 3.2 and later.

    • kCTFontTableSbit

      kCTFontTableSbit

      Font table tag for bitmap data.

      Available in iOS 4.2 and later.

    • kCTFontTableSbix

      kCTFontTableSbix

      Font table tag for extended bitmap data.

      Available in iOS 4.2 and later.

    • kCTFontTableTrak

      kCTFontTableTrak

      Font table tag for tracking.

      Available in iOS 3.2 and later.

    • kCTFontTableVhea

      kCTFontTableVhea

      Font table tag for vertical header.

      Available in iOS 3.2 and later.

    • kCTFontTableVmtx

      kCTFontTableVmtx

      Font table tag for vertical metrics.

      Available in iOS 3.2 and later.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • These constants describe font table options.

    Declaration

    Swift

    struct CTFontTableOptions : RawOptionSetType { init(_ rawValue: UInt32) init(rawValue rawValue: UInt32) static var NoOptions: CTFontTableOptions { get } static var ExcludeSynthetic: CTFontTableOptions { get } }

    Objective-C

    enum { kCTFontTableOptionNoOptions = 0, kCTFontTableOptionExcludeSynthetic = (1 << 0) }; typedef uint32_t CTFontTableOptions;

    Constants

    • OptionNoOptions

      kCTFontTableOptionNoOptions

      No font table options are specified.

      Available in iOS 3.2 and later.

    • kCTFontTableOptionExcludeSynthetic

      kCTFontTableOptionExcludeSynthetic

      The font table excludes synthetic font data.

      Available in iOS 3.2 and later.

      Deprecated in iOS 6.0.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • These constants describe options for font creation and descriptor matching. They are used by the functions CTFontCreateWithNameAndOptions and CTFontCreateWithFontDescriptorAndOptions.

    Declaration

    Swift

    struct CTFontOptions : RawOptionSetType { init(_ rawValue: CFOptionFlags) init(rawValue rawValue: CFOptionFlags) static var Default: CTFontOptions { get } static var PreventAutoActivation: CTFontOptions { get } static var PreferSystemFont: CTFontOptions { get } }

    Objective-C

    enum { kCTFontOptionsDefault = 0, kCTFontOptionsPreventAutoActivation = 1 << 0, kCTFontOptionsPreferSystemFont = 1 << 2, }; typedef CFOptionFlags CTFontOptions;

    Constants

    • Default

      kCTFontOptionsDefault

      Default options are used.

      Available in iOS 3.2 and later.

    • PreventAutoActivation

      kCTFontOptionsPreventAutoActivation

      Prevents automatic font activation.

      Available in iOS 3.2 and later.

    • PreferSystemFont

      kCTFontOptionsPreferSystemFont

      Font matching prefers to match Apple system fonts.

      Available in iOS 3.2 and later.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.