+/* If a composition starts at POS/POS_BYTE and it doesn't stride over
+ POINT, set *LEN / *LEN_BYTE to the character and byte lengths, *WIDTH
+ to the width, and return 1. Otherwise, return 0. */
+
+static int
+check_composition (pos, pos_byte, point, len, len_byte, width)
+ int pos, pos_byte, point;
+ int *len, *len_byte, *width;
+{
+ Lisp_Object prop;
+ int start, end;
+ int id;
+
+ if (! find_composition (pos, -1, &start, &end, &prop, Qnil)
+ || pos != start || point < end
+ || !COMPOSITION_VALID_P (start, end, prop))
+ return 0;
+ if ((id = get_composition_id (pos, pos_byte, end - pos, prop, Qnil)) < 0)
+ return 0;
+
+ *len = COMPOSITION_LENGTH (prop);
+ *len_byte = CHAR_TO_BYTE (end) - pos_byte;
+ *width = composition_table[id]->width;
+ return 1;
+}
+\f
+/* Set variables WIDTH and BYTES for a multibyte sequence starting at P.
+
+ 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, dp) \
+ do { \
+ int c; \
+ \
+ wide_column = 0; \
+ c = STRING_CHAR_AND_LENGTH (p, MAX_MULTIBYTE_LENGTH, bytes); \
+ if (BYTES_BY_CHAR_HEAD (*p) != bytes) \
+ width = bytes * 4; \
+ else \
+ { \
+ if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) \
+ width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; \
+ else \
+ width = WIDTH_BY_CHAR_HEAD (*p); \
+ if (width > 1) \
+ wide_column = width; \
+ } \
+ } while (0)
+