+/* Append glyphs to IT's glyph_row for the composition IT->cmp_id.
+ Called from produce_composite_glyph for terminal frames if
+ IT->glyph_row != NULL. IT->face_id contains the character's
+ face. */
+
+static void
+append_composite_glyph (it)
+ struct it *it;
+{
+ struct glyph *glyph;
+
+ xassert (it->glyph_row);
+ glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
+ if (glyph < it->glyph_row->glyphs[1 + it->area])
+ {
+ glyph->type = COMPOSITE_GLYPH;
+ glyph->pixel_width = it->pixel_width;
+ glyph->u.cmp.id = it->cmp_it.id;
+ if (it->cmp_it.ch < 0)
+ {
+ glyph->u.cmp.automatic = 0;
+ glyph->u.cmp.id = it->cmp_it.id;
+ }
+ else
+ {
+ glyph->u.cmp.automatic = 1;
+ glyph->u.cmp.id = it->cmp_it.id;
+ glyph->u.cmp.from = it->cmp_it.from;
+ glyph->u.cmp.to = it->cmp_it.to;
+ }
+
+ glyph->face_id = it->face_id;
+ glyph->padding_p = 0;
+ glyph->charpos = CHARPOS (it->position);
+ glyph->object = it->object;
+
+ ++it->glyph_row->used[it->area];
+ ++glyph;
+ }
+}
+
+
+/* Produce a composite glyph for iterator IT. IT->cmp_id is the ID of
+ the composition. We simply produces components of the composition
+ assuming that that the terminal has a capability to layout/render
+ it correctly. */
+
+static void
+produce_composite_glyph (it)
+ struct it *it;
+{
+ int c;
+
+ if (it->cmp_it.ch < 0)
+ {
+ struct composition *cmp = composition_table[it->cmp_it.id];
+
+ c = COMPOSITION_GLYPH (cmp, 0);
+ it->pixel_width = CHAR_WIDTH (it->c);
+ }
+ else
+ {
+ Lisp_Object gstring = composition_gstring_from_id (it->cmp_it.id);
+
+ it->pixel_width = composition_gstring_width (gstring, it->cmp_it.from,
+ it->cmp_it.to, NULL);
+ }
+ it->nglyphs = 1;
+ if (it->glyph_row)
+ append_composite_glyph (it);
+}
+
+