aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorRobert Pluim2021-10-18 11:51:10 +0200
committerRobert Pluim2021-10-19 14:40:26 +0200
commit9bd2f59db608def1b588b03eff846d3fe8a7fa00 (patch)
tree39a768d3990701aef8461a40f7c595c424382766 /admin
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 'admin')
-rwxr-xr-xadmin/unidata/blocks.awk26
-rw-r--r--admin/unidata/emoji-zwj.awk41
2 files changed, 41 insertions, 26 deletions
diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk
index 96b0413875d..314ac3e9394 100755
--- a/admin/unidata/blocks.awk
+++ b/admin/unidata/blocks.awk
@@ -221,31 +221,9 @@ FILENAME ~ "emoji-data.txt" && /^[0-9A-F].*; Emoji_Presentation / {
221} 221}
222 222
223END { 223END {
224 ## These codepoints have Emoji_Presentation = No, but they are
225 ## used in emoji-sequences.txt and emoji-zwj-sequences.txt (with a
226 ## Variation Selector), so force them into the emoji script so
227 ## they will get composed correctly. FIXME: delete this when we
228 ## can change the font used for a codepoint based on whether it's
229 ## followed by a VS (usually VS-16)
230 idx = 0 224 idx = 0
231 override_start[idx] = "1F3CB" 225 # ## These are here so that font_range can choose Emoji presentation
232 override_end[idx] = "1F3CC" 226 # ## for the preceding codepoint when it encounters a VS
233 idx++
234 override_start[idx] = "1F3F3"
235 override_end[idx] = "1F3F4"
236 idx++
237 override_start[idx] = "1F441"
238 override_end[idx] = "1F441"
239 idx++
240 override_start[idx] = "1F574"
241 override_end[idx] = "1F575"
242 idx++
243 override_start[idx] = "1F590"
244 override_end[idx] = "1F590"
245
246 ## These are here so that font_range can choose Emoji presentation
247 ## for the preceding codepoint when it encounters a VS
248 idx++
249 override_start[idx] = "FE00" 227 override_start[idx] = "FE00"
250 override_end[idx] = "FE0F" 228 override_end[idx] = "FE0F"
251 229
diff --git a/admin/unidata/emoji-zwj.awk b/admin/unidata/emoji-zwj.awk
index 5aca157cbd4..d4e2944ca34 100644
--- a/admin/unidata/emoji-zwj.awk
+++ b/admin/unidata/emoji-zwj.awk
@@ -64,6 +64,44 @@ END {
64 print ";;; emoji-zwj.el --- emoji zwj character composition table -*- lexical-binding:t -*-" 64 print ";;; emoji-zwj.el --- emoji zwj character composition table -*- lexical-binding:t -*-"
65 print ";;; Automatically generated from admin/unidata/emoji-{zwj-,}sequences.txt" 65 print ";;; Automatically generated from admin/unidata/emoji-{zwj-,}sequences.txt"
66 print "(eval-when-compile (require 'regexp-opt))" 66 print "(eval-when-compile (require 'regexp-opt))"
67
68 # The following codepoints are not emoji, but they are part of
69 # emoji sequences. We have code in font.c:font_range that will
70 # try to display them with the emoji font anyway.
71
72 trigger_codepoints[1] = "261D"
73 trigger_codepoints[2] = "26F9"
74 trigger_codepoints[3] = "270C"
75 trigger_codepoints[4] = "270D"
76 trigger_codepoints[5] = "2764"
77 trigger_codepoints[6] = "1F3CB"
78 trigger_codepoints[7] = "1F3CC"
79 trigger_codepoints[8] = "1F3F3"
80 trigger_codepoints[9] = "1F3F4"
81 trigger_codepoints[10] = "1F441"
82 trigger_codepoints[11] = "1F574"
83 trigger_codepoints[12] = "1F575"
84 trigger_codepoints[13] = "1F590"
85
86 printf "(setq auto-composition-emoji-eligible-codepoints\n"
87 printf "'("
88
89 for (trig in trigger_codepoints)
90 {
91 printf("\n?\\N{U+%s}", trigger_codepoints[trig])
92 }
93 printf "\n))\n\n"
94
95 # We add entries for 'codepoint U+FE0F' here to ensure that the
96 # code in font_range is triggered.
97
98 for (trig in trigger_codepoints)
99 {
100 codepoint = trigger_codepoints[trig]
101 c = sprintf("\\N{U+%s}", codepoint)
102 vec[codepoint] = vec[codepoint] "\n\"" c "\\N{U+FE0F}\""
103 }
104
67 print "(dolist (elt `(" 105 print "(dolist (elt `("
68 106
69 for (elt in ch) 107 for (elt in ch)
@@ -98,6 +136,5 @@ END {
98 print " 0" 136 print " 0"
99 print " 'compose-gstring-for-graphic))))" 137 print " 'compose-gstring-for-graphic))))"
100 138
101 print "\n" 139 printf "\n(provide 'emoji-zwj)"
102 print "(provide 'emoji-zwj)"
103} 140}