/** * pango_glyph_string_get_logical_widths: * @glyphs: a #PangoGlyphString * @text: the text corresponding to the glyphs * @length: the length of @text, in bytes * @embedding_level: the embedding level of the string * @logical_widths: an array whose length is the number of characters in * text (equal to g_utf8_strlen (text, length) unless * text has NUL bytes) * to be filled in with the resulting character widths. * * Given a #PangoGlyphString resulting from pango_shape() and the corresponding * text, determine the screen width corresponding to each character. When * multiple characters compose a single cluster, the width of the entire * cluster is divided equally among the characters. * * See also pango_glyph_item_get_logical_widths(). **/ void pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs, const char *text, int length, int embedding_level, int *logical_widths) { /* Build a PangoGlyphItem and call the other API */ PangoItem item = {0, length, pango_utf8_strlen (text, length), {NULL, NULL, NULL, embedding_level, PANGO_GRAVITY_AUTO, 0, PANGO_SCRIPT_UNKNOWN, NULL, NULL}}; PangoGlyphItem glyph_item = {&item, glyphs}; return pango_glyph_item_get_logical_widths (&glyph_item, text, logical_widths); }
int len, const PangoAnalysis *analysis G_GNUC_UNUSED, PangoLogAttr *attrs, int attrs_len G_GNUC_UNUSED) { #ifdef HAVE_LIBTHAI thchar_t tis_stack[512]; int brk_stack[512]; thchar_t *tis_text; int *brk_pnts; int cnt; #ifdef HAVE_TH_BRK_FIND_BREAKS ThBrk* brk; #endif cnt = pango_utf8_strlen (text, len) + 1; tis_text = tis_stack; if (cnt > (int) G_N_ELEMENTS (tis_stack)) tis_text = g_new (thchar_t, cnt); utf8_to_tis (text, len, tis_text, &cnt); brk_pnts = brk_stack; if (cnt > (int) G_N_ELEMENTS (brk_stack)) brk_pnts = g_new (int, cnt); /* find line break positions */ #ifdef HAVE_TH_BRK_FIND_BREAKS brk = th_brk_new(NULL);