aboutsummaryrefslogtreecommitdiffstats
path: root/src/font.c
diff options
context:
space:
mode:
authorRobert Pluim2021-10-18 11:51:10 +0200
committerRobert Pluim2021-10-19 14:40:26 +0200
commit9bd2f59db608def1b588b03eff846d3fe8a7fa00 (patch)
tree39a768d3990701aef8461a40f7c595c424382766 /src/font.c
parente55e2d4a110447540db6bbdb9cb1c12313b4b8ad (diff)
downloademacs-9bd2f59db608def1b588b03eff846d3fe8a7fa00.tar.gz
emacs-9bd2f59db608def1b588b03eff846d3fe8a7fa00.zip
Handle VS-16 correctly for non-emoji codepoints
* admin/unidata/blocks.awk: Remove emoji overrides for codepoints with Emoji_Presentation = No, they're no longer necessary. * lisp/composite.el: Remove #xFE0F (VS-16) from the range handled by `compose-gstring-for-variation-glyph' so it can be handled by `font_range'. * src/composite.c (syms_of_composite): New variable `auto-composition-emoji-eligible-codepoints'. * admin/unidata/emoji-zwj.awk: Generate value for `auto-composition-emoji-eligible-codepoints'. Add `composition-function-table' entries for 'codepoint + U+FE0F' for them. * src/font.c (codepoint_is_emoji_eligible): New function to check if we should try to use the emoji font for a codepoint. (font_range): Use it.
Diffstat (limited to 'src/font.c')
-rw-r--r--src/font.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/font.c b/src/font.c
index 83f0f8296ad..6cd4a6b5c11 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3860,6 +3860,23 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w,
3860 3860
3861#ifdef HAVE_WINDOW_SYSTEM 3861#ifdef HAVE_WINDOW_SYSTEM
3862 3862
3863/* Check if CH is a codepoint for which we should attempt to use the
3864 emoji font, even if the codepoint itself has Emoji_Presentation =
3865 No. Vauto_composition_emoji_eligible_codepoints is filled in for
3866 us by admin/unidata/emoji-zwj.awk. */
3867static bool
3868codepoint_is_emoji_eligible (int ch)
3869{
3870 if (EQ (CHAR_TABLE_REF (Vchar_script_table, ch), Qemoji))
3871 return true;
3872
3873 if (! NILP (Fmemq (make_fixnum (ch),
3874 Vauto_composition_emoji_eligible_codepoints)))
3875 return true;
3876
3877 return false;
3878}
3879
3863/* Check how many characters after character/byte position POS/POS_BYTE 3880/* Check how many characters after character/byte position POS/POS_BYTE
3864 (at most to *LIMIT) can be displayed by the same font in the window W. 3881 (at most to *LIMIT) can be displayed by the same font in the window W.
3865 FACE, if non-NULL, is the face selected for the character at POS. 3882 FACE, if non-NULL, is the face selected for the character at POS.
@@ -3907,8 +3924,7 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
3907 /* If the composition was triggered by an emoji, use a character 3924 /* If the composition was triggered by an emoji, use a character
3908 from 'script-representative-chars', rather than the first 3925 from 'script-representative-chars', rather than the first
3909 character in the string, to determine the font to use. */ 3926 character in the string, to determine the font to use. */
3910 if (EQ (CHAR_TABLE_REF (Vchar_script_table, ch), 3927 if (codepoint_is_emoji_eligible (ch))
3911 Qemoji))
3912 { 3928 {
3913 Lisp_Object val = assq_no_quit (Qemoji, Vscript_representative_chars); 3929 Lisp_Object val = assq_no_quit (Qemoji, Vscript_representative_chars);
3914 if (CONSP (val)) 3930 if (CONSP (val))