* src/composite.c (find_automatic_composition): Now extern.
(char_composable_p): Don't assume 'unicode-category-table' is
always available.
* src/composite.h (find_automatic_composition): Add prototype.
* src/character.c (lisp_string_width): Support automatic
compositions; call 'find_automatic_composition' when
'auto-composition-mode' is ON.
chars = end - i;
bytes = string_char_to_byte (string, end) - i_byte;
}
+ else if (!NILP (BVAR (current_buffer, enable_multibyte_characters))
+ && ! NILP (Vauto_composition_mode)
+ && find_automatic_composition (i, -1, &ignore, &end, &val, string)
+ && end > i)
+ {
+ int j;
+ for (thiswidth = 0, j = 0; j < LGSTRING_GLYPH_LEN (val); j++)
+ {
+ Lisp_Object g = LGSTRING_GLYPH (val, j);
+
+ if (NILP (g))
+ break;
+ thiswidth += char_width (LGLYPH_CHAR (g), dp);
+ }
+ chars = end - i;
+ bytes = string_char_to_byte (string, end) - i_byte;
+ }
else
{
int c;
Lisp_Object val;
return (c >= ' '
&& (c == ZERO_WIDTH_NON_JOINER || c == ZERO_WIDTH_JOINER
- || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
- (FIXNUMP (val) && (XFIXNUM (val) <= UNICODE_CATEGORY_Zs)))));
+ /* unicode-category-table may not be available during
+ dumping. */
+ || (CHAR_TABLE_P (Vunicode_category_table)
+ && (val = CHAR_TABLE_REF (Vunicode_category_table, c),
+ (FIXNUMP (val)
+ && (XFIXNUM (val) <= UNICODE_CATEGORY_Zs))))));
}
/* Update cmp_it->stop_pos to the next position after CHARPOS (and
representing the composition, and return true. Otherwise, *GSTRING to
Qnil, and return false. */
-static bool
+bool
find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
ptrdiff_t *start, ptrdiff_t *end,
Lisp_Object *gstring, Lisp_Object string)
extern int composition_gstring_width (Lisp_Object, ptrdiff_t, ptrdiff_t,
struct font_metrics *);
+extern bool find_automatic_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *,
+ ptrdiff_t *, Lisp_Object *,
+ Lisp_Object);
+
extern void composition_compute_stop_pos (struct composition_it *,
ptrdiff_t, ptrdiff_t, ptrdiff_t,
Lisp_Object);