+/* Set variables WIDTH and BYTES for a multibyte sequence starting at P.
+
+ C is *P which should satisfy `BASE_LEADING_CODE_P (c)'.
+
+ DP is a display table or NULL.
+
+ This macro is used in current_column_1, Fmove_to_column, and
+ compute_motion. */
+
+#define MULTIBYTE_BYTES_WIDTH(p, c, dp) \
+ do { \
+ unsigned char *pend = p + 1; \
+ \
+ wide_column = 0; \
+ while (! CHAR_HEAD_P (*pend)) pend++; \
+ \
+ if (c == LEADING_CODE_COMPOSITION) \
+ { \
+ int id = str_cmpchar_id (p, pend - p); \
+ int ch = MAKE_COMPOSITE_CHAR (id); \
+ \
+ if (id >= 0) \
+ { \
+ bytes = cmpchar_table[id]->len; \
+ if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \
+ width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \
+ else \
+ wide_column = width = cmpchar_table[id]->width; \
+ } \
+ else \
+ { \
+ bytes = 1; \
+ width = 4; \
+ } \
+ } \
+ else \
+ { \
+ bytes = BYTES_BY_CHAR_HEAD (c); \
+ if (bytes >= 2 && bytes <= pend - p) \
+ { \
+ int ch; \
+ \
+ if (dp && (ch = STRING_CHAR (p, bytes), \
+ VECTORP (DISP_CHAR_VECTOR (dp, ch)))) \
+ width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \
+ else \
+ wide_column = width = WIDTH_BY_CHAR_HEAD (c); \
+ } \
+ else \
+ { \
+ bytes = 1; \
+ width = 4; \
+ } \
+ } \
+ if (p + bytes < pend) \
+ { \
+ width += 4 * (pend - (p + bytes)); \
+ bytes = pend - p; \
+ } \
+ } while (0)
+