Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

Core Text String Attributes Reference

Framework
Declared in
CTStringAttributes.h

Overview

This reference document describes the attributes to which Core Text responds when the attributes are placed in a CFAttributedString object.

Constants

String Attribute Name Constants

These constants represent string attribute names.

const CFStringRef kCTFontAttributeName;
const CFStringRef kCTKernAttributeName;
const CFStringRef kCTLigatureAttributeName;
const CFStringRef kCTForegroundColorAttributeName;
const CFStringRef kCTParagraphStyleAttributeName;
const CFStringRef kCTUnderlineStyleAttributeName;
const CFStringRef kCTVerticalFormsAttributeName;
const CFStringRef kCTGlyphInfoAttributeName;

Constants
kCTFontAttributeName

The font of the text to which this attribute applies. The value associated with this attribute must be a CTFont object. Default is Helvetica 12.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTKernAttributeName

The amount to kern the next character. The value associated with this attribute must be a CFNumber float. Default is standard kerning. The kerning attribute indicates how many points the following character should be shifted from its default offset as defined by the current character's font in points: a positive kern indicates a shift farther away from and a negative kern indicates a shift closer to the current character. If this attribute is not present, standard kerning is used. If this attribute is set to 0.0, no kerning is done at all.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTLigatureAttributeName

The type of ligatures to use. The value associated with this attribute must be a CFNumber object. Default is an integer value of 1. The ligature attribute determines what kinds of ligatures should be used when displaying the string. A value of 0 indicates that only ligatures essential for proper rendering of text should be used. A value of 1 indicates that standard ligatures should be used, and 2 indicates that all available ligatures should be used. Which ligatures are standard depends on the script and possibly the font. Arabic text, for example, requires ligatures for many character sequences but has a rich set of additional ligatures that combine characters. English text has no essential ligatures, and typically has only two standard ligatures, those for "fi" and "fl"—all others are considered more advanced or fancy.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTForegroundColorAttributeName

The foreground color of the text to which this attribute applies. The value associated with this attribute must be a CGColor object. Default value is black.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTParagraphStyleAttributeName

The paragraph style of the text to which this attribute applies. A paragraph style object is used to specify things like line alignment, tab rulers, writing direction, and so on. Value must be a CTParagraphStyle object. Default is an empty CTParagraphStyle object. See CTParagraphStyle Reference for more information.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTUnderlineStyleAttributeName

The style of underlining, to be applied at render time, for the text to which this attribute applies. Value must be a CFNumber object. Default is kCTUnderlineStyleNone. Set a value of something other than kCTUnderlineStyleNone to draw an underline. In addition, the constants listed in “CTUnderlineStyleModifiers” can be used to modify the look of the underline. The underline color is determined by the text's foreground color.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTVerticalFormsAttributeName

The orientation of the glyphs in the text to which this attribute applies. Value must be a CFBoolean object. Default is False. A value of False indicates that horizontal glyph forms are to be used; True indicates that vertical glyph forms are to be used.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTGlyphInfoAttributeName

The glyph info object to apply to the text associated with this attribute. Value must be a CTGlyphInfo object. The glyph specified by this CTGlyphInfo object is assigned to the entire attribute range, provided that its contents match the specified base string and that the specified glyph is available in the font specified by kCTFontAttributeName. See CTGlyphInfo Reference for more information.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

Declared In
CTStringAttributes.h

CTUnderlineStyle

Underline style specifiers.

enum{
kCTUnderlineStyleNone = 0x00,
kCTUnderlineStyleSingle = 0x01,
kCTUnderlineStyleThick = 0x02,
kCTUnderlineStyleDouble = 0x09
};
typedef int32_t CTUnderlineStyle;

Constants
kCTUnderlineStyleNone

Do not draw an underline.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTUnderlineStyleSingle

Draw an underline consisting of a single line.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTUnderlineStyleThick

Draw an underline consisting of a thick line.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTUnderlineStyleDouble

Draw an underline consisting of a double line.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

Discussion

These underline type specifiers can be applied to the value set with the kCTUnderlineStyleAttributeName attribute to control the underline style Core Text uses when rendering the text to which the attribute applies.

Declared In
CTStringAttributes.h

CTUnderlineStyleModifiers

Underline style modifiers.

enum{
kCTUnderlinePatternSolid = 0x0000,
kCTUnderlinePatternDot = 0x0100,
kCTUnderlinePatternDash = 0x0200,
kCTUnderlinePatternDashDot = 0x0300,
kCTUnderlinePatternDashDotDot = 0x0400
};
typedef int32_t CTUnderlineStyleModifiers;

Constants
kCTUnderlinePatternSolid

Draw a solid underline.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTUnderlinePatternDot

Draw an underline using a pattern of dots.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTUnderlinePatternDash

Draw an underline using a pattern of dashes.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTUnderlinePatternDashDot

Draw an underline using a pattern of alternating dashes and dots.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

kCTUnderlinePatternDashDotDot

Draw an underline using a pattern of a dash followed by two dots.

Available in Mac OS X v10.5 and later.

Declared in CTStringAttributes.h

Discussion

Set these bits with the underline style (see “CTUnderlineStyle”) that you set with the kCTUnderlineStyleAttributeName attribute to modify how the underline will be drawn.

Declared In
CTStringAttributes.h

Next Page > Hide TOC


Last updated: 2007-05-01




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice