what is NSAdapativeImageGlyph

Asked on 2024-07-30

1 search

NSAdaptiveImageGlyph is a new API introduced by Apple to support the use of Genmoji and other personalized images in applications. It functions similarly to standard emojis but is designed to handle unique rasterized bitmaps that cannot be described by a Unicode text character. Here are some key features and uses of NSAdaptiveImageGlyph:

  • Standard Image Format: It uses a standard image format in a square aspect ratio with multiple resolutions.
  • Metadata: Includes additional metadata such as a globally unique and stable identifier, a content description for accessibility, and alignment metrics for proper layout and placement alongside regular text.
  • Rich Text Support: NSAdaptiveImageGlyph is natively supported by rich text views, making it easy to integrate into applications that already support rich text.
  • Compatibility: It is compatible with various Apple frameworks like TextKit and CoreText, and can be used in custom typesetting solutions.
  • Fallback Mechanism: For systems that do not support image glyphs, a fallback image is displayed, and the alt text is sourced from the content description.

For more detailed information, you can refer to the session "Bring expression to your app with Genmoji" at the NSAdaptiveImageGlyph chapter.