Next Page > Hide TOC

NSGlyphInfo Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in Mac OS X v10.2 and later.
Companion guide
Declared in
NSGlyphInfo.h

Overview

An NSGlyphInfo object represents a glyph attribute value (NSGlyphInfoAttributeName) in an attributed string. NSGlyphInfo allows you to override a font’s specified mapping from Unicode to the glyph ID. Overriding the mapping allows you to specify a variant glyph for a given character if the font contains multiple variations for that character or to specify a glyph that doesn’t have a standard mapping (such as some ligature glyphs).

Adopted Protocols

NSCoding

Tasks

Creating an NSGlyphInfo Object

Getting Information About an NSGlyphInfo Object

Class Methods

glyphInfoWithCharacterIdentifier:collection:baseString:

Instantiates and returns an NSGlyphInfo object using a character identifier and a character collection.

+ (NSGlyphInfo *)glyphInfoWithCharacterIdentifier:(NSUInteger)cid collection:(NSCharacterCollection)characterCollection baseString:(NSString *)theString

Parameters
cid

A character identifier.

characterCollection

A string constant representing a character collection. Possible values for characterCollection are described in “Constants.”

theString

The part of the attributed string the returned instance is intended to override.

Return Value

The created NSGlyphInfo object or nil if the object couldn't be created.

Availability
Declared In
NSGlyphInfo.h

glyphInfoWithGlyph:forFont:baseString:

Instantiates and returns an NSGlyphInfo object using a glyph index and a specified font.

+ (NSGlyphInfo *)glyphInfoWithGlyph:(NSGlyph)glyph forFont:(NSFont *)font baseString:(NSString *)theString

Parameters
glyph

The identifier of the glyph.

font

The font object to be associated with the returned NSGlyphInfo object,

theString

The part of the attributed string the returned instance is intended to override.

Return Value

The created NSGlyphInfo object or nil if the object couldn't be created.

Availability
Declared In
NSGlyphInfo.h

glyphInfoWithGlyphName:forFont:baseString:

Instantiates and returns an NSGlyphInfo object using a glyph name and a specified font.

+ (NSGlyphInfo *)glyphInfoWithGlyphName:(NSString *)glyphName forFont:(NSFont *)font baseString:(NSString *)theString

Parameters
glyphName

The name of the glyph.

font

The font object to be associated with the returned NSGlyphInfo object,

theString

The part of the attributed string the returned instance is intended to override.

Return Value

The created NSGlyphInfo object or nil if the object couldn't be created.

Availability
Declared In
NSGlyphInfo.h

Instance Methods

characterCollection

Returns an NSCharacterCollection value specifying the glyph–to–character identifier mapping of the receiver.

- (NSCharacterCollection)characterCollection

Discussion

This method returns NSIdentityMappingCharacterCollection if the receiver was instantiated with either an NSGlyph identifier or a glyph name. It returns other possible values if the receiver was instantiated using glyphInfoWithCharacterIdentifier:collection:baseString:. These constants are described in NSCharacterCollection.

Availability
Declared In
NSGlyphInfo.h

characterIdentifier

Returns the receiver’s character identifier (CID).

- (NSUInteger)characterIdentifier

Discussion

If the receiver was instantiated with a method other than glyphInfoWithCharacterIdentifier:collection:baseString:, this method returns NULL.

Availability
Declared In
NSGlyphInfo.h

glyphName

Returns the receiver’s glyph name.

- (NSString *)glyphName

Discussion

If the receiver was instantiated with a method other than glyphInfoWithGlyphName:forFont:baseString:, this method returns nil.

Availability
Declared In
NSGlyphInfo.h

Constants

NSCharacterCollection

The following values specify the mapping of character identifiers to glyphs, and are returned by characterCollection.

typedef enum {
   NSIdentityMappingCharacterCollection = 0,
   NSAdobeCNS1CharacterCollection       = 1,
   NSAdobeGB1CharacterCollection        = 2,
   NSAdobeJapan1CharacterCollection     = 3,
   NSAdobeJapan2CharacterCollection     = 4,
   NSAdobeKorea1CharacterCollection     = 5,
} NSCharacterCollection;

Constants
NSIdentityMappingCharacterCollection

Indicates that the character identifier is equal to the glyph index.

Available in Mac OS X v10.2 and later.

Declared in NSGlyphInfo.h.

NSAdobeCNS1CharacterCollection

Indicates the Adobe-CNS1 mapping.

Available in Mac OS X v10.2 and later.

Declared in NSGlyphInfo.h.

NSAdobeGB1CharacterCollection

Indicates the Adobe-GB1 mapping.

Available in Mac OS X v10.2 and later.

Declared in NSGlyphInfo.h.

NSAdobeJapan1CharacterCollection

Indicates the Adobe-Japan1 mapping.

Available in Mac OS X v10.2 and later.

Declared in NSGlyphInfo.h.

NSAdobeJapan2CharacterCollection

Indicates the Adobe-Japan2 mapping.

Available in Mac OS X v10.2 and later.

Declared in NSGlyphInfo.h.

NSAdobeKorea1CharacterCollection

Indicates the Adobe-Korea1 mapping.

Available in Mac OS X v10.2 and later.

Declared in NSGlyphInfo.h.

Availability
Declared In
NSGlyphInfo.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-03-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.