Mac Developer Library

Developer

AppKit Framework Reference NSGlyphInfo Class Reference

Options
Deployment Target:

On This Page
Language:

NSGlyphInfo

An NSGlyphInfo object represents a glyph attribute value (NSGlyphInfoAttributeName) in an attributed string (NSAttributedString). Glyphs are the graphic representations of characters, stored in a font, that the text system draws on a display or printed page. Before text can be laid out, the layout manager (NSLayoutManager) generates a stream of glyphs to be laid out, using character and font information specified by the attributed string and contained in the font file. NSGlyphInfo provides a means to override the standard glyph generation process and substitute a specified glyph over the attribute’s range. More...

Inheritance


Import Statement


import AppKit @import AppKit;

Availability


Available in OS X v10.2 and later.
  • Instantiates and returns an NSGlyphInfo object using a character identifier and a character collection.

    Declaration

    Swift

    init?(characterIdentifier cid: Int, collection characterCollection: NSCharacterCollection, baseString theString: String) -> NSGlyphInfo

    Objective-C

    + (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.2 and later.

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

    Declaration

    Swift

    init?(glyph glyph: NSGlyph, forFont font: NSFont, baseString theString: String) -> NSGlyphInfo

    Objective-C

    + (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.2 and later.

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

    Declaration

    Swift

    init?(glyphName glyphName: String, forFont font: NSFont, baseString theString: String) -> NSGlyphInfo

    Objective-C

    + (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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.2 and later.

  • Returns the receiver’s character identifier (CID).

    Declaration

    Swift

    var characterIdentifier: Int { get }

    Objective-C

    @property(readonly) NSUInteger characterIdentifier

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.2 and later.

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

    Declaration

    Swift

    var characterCollection: NSCharacterCollection { get }

    Objective-C

    @property(readonly) 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.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.2 and later.

  • Returns the receiver’s glyph name.

    Declaration

    Swift

    var glyphName: String? { get }

    Objective-C

    @property(readonly, copy) NSString *glyphName

    Discussion

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

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.2 and later.

Data Types

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

    Declaration

    Swift

    enum NSCharacterCollection : UInt { case IdentityMappingCharacterCollection case AdobeCNS1CharacterCollection case AdobeGB1CharacterCollection case AdobeJapan1CharacterCollection case AdobeJapan2CharacterCollection case AdobeKorea1CharacterCollection }

    Objective-C

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

    Constants

    • IdentityMappingCharacterCollection

      NSIdentityMappingCharacterCollection

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

      Available in OS X v10.2 and later.

    • AdobeCNS1CharacterCollection

      NSAdobeCNS1CharacterCollection

      Indicates the Adobe-CNS1 mapping.

      Available in OS X v10.2 and later.

    • AdobeGB1CharacterCollection

      NSAdobeGB1CharacterCollection

      Indicates the Adobe-GB1 mapping.

      Available in OS X v10.2 and later.

    • AdobeJapan1CharacterCollection

      NSAdobeJapan1CharacterCollection

      Indicates the Adobe-Japan1 mapping.

      Available in OS X v10.2 and later.

    • AdobeJapan2CharacterCollection

      NSAdobeJapan2CharacterCollection

      Indicates the Adobe-Japan2 mapping.

      Available in OS X v10.2 and later.

    • AdobeKorea1CharacterCollection

      NSAdobeKorea1CharacterCollection

      Indicates the Adobe-Korea1 mapping.

      Available in OS X v10.2 and later.

    Import Statement

    import AppKit

    Availability

    Available in OS X v10.2 and later.