Converts UTF-8 text to an array of glyphs, optionally with
cluster mapping, that can be used to render later using ScaledFont.
If glyphBuffer initially points to a non-empty array, that array is
used as a glyph buffer. If the provided glyph array is too
short for the conversion, a new glyph array is allocated and returned.
If clusterBuffer is not empty a cluster mapping will be computed.
The semantics of how cluster array allocation works is similar to the glyph array.
That is, if clusterBuffer initially points to a non-empty array,
that array is used as a cluster buffer.
If the provided cluster array is too short for the conversion,
a new cluster array is allocated and returned.
In the simplest case, glyphs and clusters can be omitted
or set to an empty array and a suitable array will be allocated.
In code
autoglyphs = scaled_font.textToTextGlyph(x, y, text);
cr.showTextGlyphs(glyphs);
If no cluster mapping is needed
autoglyphs = scaled_font.textToGlyphs(x, y, text);
cr.showGlyphs(glyphs);
If stack-based glyph and cluster arrays are to be used for small arrays
The output values can be readily passed to Context.showTextGlyphs()Context.showGlyphs(), or related functions, assuming that
the exact same ScaledFont is used for the operation.
Glyph[]textToGlyphs(double x, double y, string text, Glyph[] glyphBuffer)
Converts UTF-8 text to an array of glyphs, optionally with cluster mapping, that can be used to render later using ScaledFont.
If glyphBuffer initially points to a non-empty array, that array is used as a glyph buffer. If the provided glyph array is too short for the conversion, a new glyph array is allocated and returned.
If clusterBuffer is not empty a cluster mapping will be computed. The semantics of how cluster array allocation works is similar to the glyph array. That is, if clusterBuffer initially points to a non-empty array, that array is used as a cluster buffer. If the provided cluster array is too short for the conversion, a new cluster array is allocated and returned.
In the simplest case, glyphs and clusters can be omitted or set to an empty array and a suitable array will be allocated. In code
If no cluster mapping is needed
If stack-based glyph and cluster arrays are to be used for small arrays
The output values can be readily passed to Context.showTextGlyphs() Context.showGlyphs(), or related functions, assuming that the exact same ScaledFont is used for the operation.