ScaledFont.textToGlyphs

Converts UTF-8 text to an array of glyphs, optionally with cluster mapping, that can be used to render later using scaled_font. If glyphs initially points to a non-NULL value, that array is used as a glyph buffer, and num_glyphs should point to the number of glyph entries available there. If the provided glyph array is too short for the conversion, a new glyph array is allocated using cairo_glyph_allocate() and placed in glyphs. Upon return, num_glyphs always contains the number of generated glyphs. If the value glyphs points to has changed after the call, the user is responsible for freeing the allocated glyph array using cairo_glyph_free(). This may happen even if the provided array was large enough. If clusters is not NULL, num_clusters and cluster_flags should not be NULL, and cluster mapping will be computed. The semantics of how cluster array allocation works is similar to the glyph array. That is, if clusters initially points to a non-NULL value, that array is used as a cluster buffer, and num_clusters should point to the number of cluster entries available there. If the provided cluster array is too short for the conversion, a new cluster array is allocated using cairo_text_cluster_allocate() and placed in clusters. Upon return, num_clusters always contains the number of generated clusters. If the value clusters points at has changed after the call, the user is responsible for freeing the allocated cluster array using cairo_text_cluster_free(). This may happen even if the provided array was large enough. In the simplest case, glyphs and clusters can point to NULL initially Since 1.8

class ScaledFont
textToGlyphs

Parameters

x double

X position to place first glyph

y double

Y position to place first glyph

utf8 string

a string of text encoded in UTF-8

utf8_Len int

length of utf8 in bytes, or -1 if it is NUL-terminated

glyphs cairo_glyph_t[]

pointer to array of glyphs to fill

clusters cairo_text_cluster_t[]

pointer to array of cluster mapping information to fill, or NULL

clusterFlags cairo_text_cluster_flags_t

pointer to location to store cluster flags corresponding to the output clusters, or NULL

Return Value

CAIRO_STATUS_SUCCESS upon success, or an error status if the input values are wrong or if conversion failed. If the input values are correct but the conversion failed, the error status is also set on scaled_font.

Meta