ShapingResult

public class ShapingResult

A ShapingResult object is a container for the results of text shaping. It is generated by a ShapingEngine object to provide the information related to characters, their glyphs, offsets, and advances.

  • The UTF-16 range in source string.

    Declaration

    Swift

    public private(set) var codeUnitRange: Range<Int> { get }
  • A boolean value that indicates whether the shaped text segment flows backward.

    Declaration

    Swift

    public private(set) var isBackward: Bool { get }
  • The index to the first character in source string.

    Declaration

    Swift

    public var startIndex: String.Index { get }
  • The index after the last character in source string.

    Declaration

    Swift

    public var endIndex: String.Index { get }
  • The collection of glyph IDs.

    Declaration

    Swift

    public var glyphIDs: GlyphIDs { get }
  • The collection of glyph offsets.

    Declaration

    Swift

    public var glyphOffsets: GlyphOffsets { get }
  • The collection of glyph advances.

    Declaration

    Swift

    public var glyphAdvances: GlyphAdvances { get }
  • A collection of indexes, mapping each shaped UTF-16 code unit in source string to corresponding glyph.

    The map is produced according to following rules.

    1. If a single code unit translates into multiple glyphs, then it maps to the first glyph in the sequence.
    2. If multiple code units form a group, such as a grapheme, which in turn translates into multiple glyphs, then each character maps to the first glyph in the sequence.
    3. If nonconsecutive code units translate to a single glyph or ligature, then each participating code unit, and all in-between characters, map to this glyph or ligature.

    Declaration

    Swift

    public var clusterMap: ClusterMap { get }
  • Creates an array of caret edges.

    Declaration

    Swift

    public func makeCaretEdges(caretStops: [Bool]?) -> [CGFloat]

    Parameters

    caretStops

    An array for caret stops of the UTF-16 code units represented by this object.

    Return Value

    An array of caret edges.

Collections

  • A collection of the glyph ids in a shaping result.

    See more

    Declaration

    Swift

    public struct GlyphIDs : RandomAccessCollection
  • A collection of the glyph offsets in a shaping result.

    See more

    Declaration

    Swift

    public struct GlyphOffsets : RandomAccessCollection
  • A collection of the glyph advances in a shaping result.

    See more

    Declaration

    Swift

    public struct GlyphAdvances : RandomAccessCollection
  • A collection of the cluster map in a shaping result, represented by UTF-16 code unit indices.

    See more

    Declaration

    Swift

    public struct ClusterMap : RandomAccessCollection