From 950831c369636d8a681edc736a6c6151c1b1edee Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Fri, 24 Sep 2021 14:13:24 +0200 Subject: [PATCH] Add glyphless-char-display-control for Variation Selectors * lisp/international/characters.el (update-glyphless-char-display): (glyphless-char-display-control): Add control knob for U+FE00 through U+FE0F, defaulting to 'thin-space'. * doc/lispref/display.texi (Glyphless Chars): Document it. --- doc/lispref/display.texi | 5 +++++ lisp/international/characters.el | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 510efaf2719..2ae04a85218 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -7952,6 +7952,11 @@ Characters of Unicode General Category [Cf], such as U+200E @sc{left-to-right mark}, but excluding characters that have graphic images, such as U+00AD @sc{soft hyphen}. +@item variation-selectors +Unicode VS-1 through VS-16 (U+FE00 through U+FE0F), which are used to +select between different glyphs for the same codepoints (typically +emojis). + @item no-font Characters for which there is no suitable font, or which cannot be encoded by the terminal's coding system. diff --git a/lisp/international/characters.el b/lisp/international/characters.el index e08dc275498..475a669dc40 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -1540,6 +1540,9 @@ option `glyphless-char-display'." ((eq target 'c1-control) (glyphless-set-char-table-range glyphless-char-display #x80 #x9F method)) + ((eq target 'variation-selectors) + (glyphless-set-char-table-range glyphless-char-display + #xFE00 #xFE0F method)) ((eq target 'format-control) (when unicode-category-table (map-char-table @@ -1575,6 +1578,7 @@ option `glyphless-char-display'." ;;; Control of displaying glyphless characters. (defcustom glyphless-char-display-control '((format-control . thin-space) + (variation-selectors . thin-space) (no-font . hex-code)) "List of directives to control display of glyphless characters. @@ -1590,6 +1594,9 @@ GROUP must be one of these symbols: such as U+200C (ZWNJ), U+200E (LRM), but excluding characters that have graphic images, such as U+00AD (SHY). + `variation-selectors': U+FE00..U+FE0F, used for choosing between + glyph variations (e.g. Emoji vs Text + presentation). `no-font': characters for which no suitable font is found. For character terminals, characters that cannot be encoded by `terminal-coding-system'. @@ -1607,7 +1614,7 @@ Do not set its value directly from Lisp; the value takes effect only via a custom `:set' function (`update-glyphless-char-display'), which updates `glyphless-char-display'." - :version "24.1" + :version "28.1" :type '(alist :key-type (symbol :tag "Character Group") :value-type (symbol :tag "Display Method")) :options '((c0-control @@ -1628,6 +1635,12 @@ function (`update-glyphless-char-display'), which updates (const :tag "Display as empty box" empty-box) (const :tag "Display acronym" acronym) (const :tag "Display hex code in a box" hex-code))) + (variation-selectors + (choice (const :tag "Don't display" zero-width) + (const :tag "Display as thin space" thin-space) + (const :tag "Display as empty box" empty-box) + (const :tag "Display acronym" acronym) + (const :tag "Display hex code in a box" hex-code))) (no-font (choice (const :tag "Don't display" zero-width) (const :tag "Display as thin space" thin-space) -- 2.39.2