override_start[idx] = "1F590"
override_end[idx] = "1F590"
+ ## These are here so that font_range can choose Emoji presentation
+ ## for the preceding codepoint when it encounters a VS
+ idx++
+ override_start[idx] = "FE00"
+ override_end[idx] = "FE0F"
+
for (k in override_start)
{
i++
as single glyphs instead of multiple ones. 'Noto Color Emoji' is one
such suitable font.
++++
+** Composition of emoji has been improved.
+If autocomposition is triggered by an emoji character, then the emoji
+font is now used to check if composition can be performed, rather than
+the font of the first character of the string being composed. This
+allows e.g.
+
+'Emoji codepoint' + VS-16
+
+to be displayed using the emoji font even if 'Emoji codepoint' does
+not have emoji presentation by default.
+
+++
** New command 'execute-extended-command-for-buffer'.
This new command, bound to 'M-S-x', works like
/* Try to compose the characters at CHARPOS according to composition
rule RULE ([PATTERN PREV-CHARS FUNC]). LIMIT limits the characters
to compose. STRING, if not nil, is a target string. WIN is a
- window where the characters are being displayed. If characters are
+ window where the characters are being displayed. CH is the
+ character that triggered the composition check. If characters are
successfully composed, return the composition as a glyph-string
object. Otherwise return nil. */
static Lisp_Object
autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos,
ptrdiff_t limit, struct window *win, struct face *face,
- Lisp_Object string, Lisp_Object direction)
+ Lisp_Object string, Lisp_Object direction, int ch)
{
ptrdiff_t count = SPECPDL_INDEX ();
Lisp_Object pos = make_fixnum (charpos);
struct frame *f = XFRAME (font_object);
if (FRAME_WINDOW_P (f))
{
- font_object = font_range (charpos, bytepos, &to, win, face, string);
+ font_object = font_range (charpos, bytepos, &to, win, face, string, ch);
if (! FONT_OBJECT_P (font_object)
|| (! NILP (re)
&& to < limit
if (XFIXNAT (AREF (elt, 1)) != cmp_it->lookback)
goto no_composition;
lgstring = autocmp_chars (elt, charpos, bytepos, endpos,
- w, face, string, direction);
+ w, face, string, direction, cmp_it->ch);
if (composition_gstring_p (lgstring))
break;
lgstring = Qnil;
else
direction = QR2L;
lgstring = autocmp_chars (elt, cpos, bpos, charpos + 1, w, face,
- string, direction);
+ string, direction, cmp_it->ch);
if (! composition_gstring_p (lgstring)
|| cpos + LGSTRING_CHAR_LEN (lgstring) - 1 != charpos)
/* Composition failed or didn't cover the current
for (check = cur; check_pos < check.pos; )
BACKWARD_CHAR (check, stop);
*gstring = autocmp_chars (elt, check.pos, check.pos_byte,
- tail, w, NULL, string, Qnil);
+ tail, w, NULL, string, Qnil, c);
need_adjustment = 1;
if (NILP (*gstring))
{
If STRING is not nil, it is the string to check instead of the current
buffer. In that case, FACE must be not NULL.
+ CH is the character that actually caused the composition
+ process to start, it may be different from the character at POS.
+
The return value is the font-object for the character at POS.
*LIMIT is set to the position where that font can't be used.
Lisp_Object
font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
- struct window *w, struct face *face, Lisp_Object string)
+ struct window *w, struct face *face, Lisp_Object string,
+ int ch)
{
ptrdiff_t ignore;
int c;
Lisp_Object font_object = Qnil;
+ struct frame *f = XFRAME (w->frame);
if (!face)
{
- struct frame *f = XFRAME (w->frame);
int face_id;
if (NILP (string))
face = FACE_FROM_ID (f, face_id);
}
+ /* If the composition was triggered by an emoji, use a character
+ from 'script-representative-chars', rather than the first
+ character in the string, to determine the font to use. */
+ if (EQ (CHAR_TABLE_REF (Vchar_script_table, ch),
+ Qemoji))
+ {
+ Lisp_Object val = assq_no_quit (Qemoji, Vscript_representative_chars);
+ if (CONSP (val))
+ {
+ val = XCDR (val);
+ if (CONSP (val))
+ val = XCAR (val);
+ else if (VECTORP (val))
+ val = AREF (val, 0);
+ font_object = font_for_char (face, XFIXNAT (val), pos - 1, string);
+ }
+ }
+
while (pos < *limit)
{
c = (NILP (string)
DEFSYM (Qiso8859_1, "iso8859-1");
DEFSYM (Qiso10646_1, "iso10646-1");
DEFSYM (Qunicode_bmp, "unicode-bmp");
+ DEFSYM (Qemoji, "emoji");
/* Symbols representing keys of font extra info. */
DEFSYM (QCotf, ":otf");
extern Lisp_Object font_update_drivers (struct frame *f, Lisp_Object list);
extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t, ptrdiff_t *,
struct window *, struct face *,
- Lisp_Object);
+ Lisp_Object, int);
extern void font_fill_lglyph_metrics (Lisp_Object, struct font *, unsigned int);
extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop,