+ @brief Compute information about glyph sequence.
+
+ The mdraw_glyph_list () function computes information about glyphs
+ corresponding to the text between $FROM and $TO of M-text $MT when
+ it is drawn on a window of frame $FRAME using the
+ mdraw_text_with_control () function with the drawing control
+ object $CONTROL. $GLYPHS is an array of objects to store the
+ information, and $ARRAY_SIZE is the array size.
+
+ If $ARRAY_SIZE is large enough to cover all glyphs, it stores the
+ number of actually filled elements in the place pointed by
+ $NUM_GLYPHS_RETURN, and returns 0.
+
+ Otherwise, it stores the required array size in the place pointed
+ by $NUM_GLYPHS_RETURN, and returns -1. */
+
+/***ja
+ @brief ¥°¥ê¥ÕÎó¤Ë´Ø¤¹¤ë¾ðÊó¤ò·×»»¤¹¤ë.
+
+ ´Ø¿ô mdraw_glyph_list () ¤Ï¡¢´Ø¿ô mdraw_text_with_control ()
+ ¤¬ÉÁ²èÀ©¸æ¥ª¥Ö¥¸¥§¥¯¥È $CONTROL ¤òÍѤ¤¤ÆM-text $MT ¤Î $FROM ¤«¤é $TO
+ ¤Þ¤Ç¤ò¥Õ¥ì¡¼¥à $FRAME ¤ËÉÁ²è¤·¤¿¾ì¹ç¤Î¡¢³Æ¥°¥ê¥Õ¤Î¾ðÊó¤ò $GLYPHS
+ ¤¬»Ø¤¹ÇÛÎó¤Ë³ÊǼ¤¹¤ë¡£ $ARRAY_SIZE ¤Ï¤½¤ÎÇÛÎó¤Î¥µ¥¤¥º¤Ç¤¢¤ë¡£
+
+ ¤â¤· $ARRAY_SIZE ¤¬¤¹¤Ù¤Æ¤Î¥°¥ê¥Õ¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò³ÊǼ¤¹¤ë¤Î¤Ë½½Ê¬¤Ç¤¢¤ì¤Ð¡¢
+ $NUM_GLYPHS_RETURN ¤¬»Ø¤¹¾ì½ê¤Ë¼ÂºÝ¤ËËä¤á¤¿Í×ÁǤοô¤òÀßÄꤷ 0 ¤òÊÖ¤¹¡£
+
+
+ ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢$NUM_GLYPHS_RETURN ¤¬»Ø¤¹¾ì½ê¤ËɬÍפÊÇÛÎó¤Î¥µ¥¤¥º¤òÀßÄꤷ¡¢
+ -1 ¤òÊÖ¤¹¡£
+ */
+
+/***
+ @seealso
+ MDrawGlyph
+*/
+
+int
+mdraw_glyph_list (MFrame *frame, MText *mt, int from, int to,
+ MDrawControl *control, MDrawGlyph *glyphs,
+ int array_size, int *num_glyphs_return)
+{
+ MGlyphString *gstring;
+ MGlyph *g;
+ int n;
+ int pad_width = 0;
+
+ ASSURE_CONTROL (control);
+ *num_glyphs_return = 0;
+ M_CHECK_RANGE (mt, from, to, -1, 0);
+ gstring = get_gstring (frame, mt, from, to, control);
+ if (! gstring)
+ return -1;
+ for (g = MGLYPH (1), n = 0; g->type != GLYPH_ANCHOR; g++)
+ {
+ if (g->type == GLYPH_BOX
+ || g->pos < from || g->pos >= to)
+ continue;
+ if (g->type == GLYPH_PAD)
+ {
+ if (g->left_padding)
+ pad_width = g->width;
+ else if (n > 0)
+ {
+ pad_width = 0;
+ glyphs[-1].x_advance += g->width;
+ }
+ continue;
+ }
+ if (n < array_size)
+ {
+ glyphs->from = g->pos;
+ glyphs->to = g->to;
+ glyphs->glyph_code = g->code;
+ glyphs->x_off = g->xoff + pad_width;
+ glyphs->y_off = g->yoff;
+ glyphs->lbearing = g->lbearing;
+ glyphs->rbearing = g->rbearing;
+ glyphs->ascent = g->ascent;
+ glyphs->descent = g->descent;
+ glyphs->x_advance = g->width + pad_width;
+ glyphs->y_advance = 0;
+ if (g->rface->rfont)
+ {
+ glyphs->font = (MFont *) g->rface->rfont;
+ glyphs->font_type
+ = (glyphs->font->source == MFONT_SOURCE_X ? Mx
+ : g->rface->rfont->driver == &mfont__ft_driver ? Mfreetype
+ : Mxft);
+ glyphs->fontp = g->rface->rfont->fontp;
+ }
+ else
+ {
+ glyphs->font = NULL;
+ glyphs->font_type = Mnil;
+ glyphs->fontp = NULL;
+ }
+ pad_width = 0;
+ glyphs++;
+ }
+ n++;
+ }
+ M17N_OBJECT_UNREF (gstring->top);
+
+ *num_glyphs_return = n;
+ return (n <= array_size ? 0 : -1);
+}
+
+/*=*/
+
+/***en