GlyphLookup class

Stores the glyph index representing the code unit at index i.

Indices are in UTF-16 code unit space. When the source text contains non-BMP characters (emoji), codepoint indices from shaping are converted to UTF-16 indices during construction. The toUtf16 method performs the same codepoint-to-UTF-16 conversion for external callers.

Constructors

GlyphLookup(List<int> indices, [List<int>? _cpToUtf16])
GlyphLookup.fromShape(TextShapeResult shape, int codeUnitCount, {String? text})
Build a GlyphLookup from shaped text.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
indices List<int>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

advanceFactor(int index, bool inv) double
How far this code unit index is within the glyph.
count(int index) int
glyphStart(int index) int
Returns the first codeunit index of the glyph cluster containing index.
isGlyphBoundary(int index) bool
Whether index is at the start of a glyph cluster boundary (i.e. not in the middle of a multi-codepoint glyph).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
toUtf16(int codePointIndex) int
Convert a codepoint index (from TextRun.textIndexAt) to a UTF-16 code unit index. Returns the index unchanged when all characters are BMP.

Operators

operator ==(Object other) bool
The equality operator.
inherited