diff options
author | Yuuki Harano <masm+github@masm11.me> | 2021-11-11 00:39:53 +0900 |
---|---|---|
committer | Yuuki Harano <masm+github@masm11.me> | 2021-11-11 00:39:53 +0900 |
commit | 4dd1f56f29fc598a8339a345c2f8945250600602 (patch) | |
tree | af341efedffe027e533b1bcc0dbf270532e48285 /lisp/composite.el | |
parent | 4c49ec7f865bdad1629d2f125f71f4e506b258f2 (diff) | |
parent | 810fa21d26453f898de9747ece7205dfe6de9d08 (diff) | |
download | emacs-4dd1f56f29fc598a8339a345c2f8945250600602.tar.gz emacs-4dd1f56f29fc598a8339a345c2f8945250600602.tar.bz2 emacs-4dd1f56f29fc598a8339a345c2f8945250600602.zip |
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'lisp/composite.el')
-rw-r--r-- | lisp/composite.el | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/lisp/composite.el b/lisp/composite.el index 6f654df15aa..c2289e8998f 100644 --- a/lisp/composite.el +++ b/lisp/composite.el @@ -815,6 +815,35 @@ prepending a space before it." (setq i (1+ i))))))) gstring)) +(defun compose-gstring-for-variation-glyph (gstring _direction) + "Compose glyph-string GSTRING for graphic display. +GSTRING must have two glyphs; the first is a glyph for a han character, +and the second is a glyph for a variation selector." + (let* ((font (lgstring-font gstring)) + (han (lgstring-char gstring 0)) + (vs (lgstring-char gstring 1)) + (glyphs (font-variation-glyphs font han)) + (g0 (lgstring-glyph gstring 0)) + (g1 (lgstring-glyph gstring 1))) + (catch 'tag + (dolist (elt glyphs) + (if (= (car elt) vs) + (progn + (lglyph-set-code g0 (cdr elt)) + (lglyph-set-from-to g0 (lglyph-from g0) (lglyph-to g1)) + (lgstring-set-glyph gstring 1 nil) + (throw 'tag gstring))))))) + +;; We explicitly don't handle #xFE0F (VS-16) here, because that's +;; taken care of by font_range in font.c, which will check for an +;; emoji font for codepoints used in compositions even if they're not +;; emoji themselves, and thus choose the Emoji presentation for them +;; when followed by VS-16. VS-15 *is* handled here, because if it's +;; handled in font_range, we end up choosing the Emoji presentation +;; rather than the Text presentation. +(let ((elt '([".." 1 compose-gstring-for-variation-glyph]))) + (set-char-table-range composition-function-table '(#xFE00 . #xFE0E) elt) + (set-char-table-range composition-function-table '(#xE0100 . #xE01EF) elt)) (defun auto-compose-chars (func from to font-object string direction) "Compose the characters at FROM by FUNC. @@ -864,7 +893,7 @@ Auto Composition mode in all buffers (this is the default)." "Toggle Auto Composition mode in all buffers. For more information on Auto Composition mode, see -`auto-composition-mode' ." +`auto-composition-mode'." :global t :variable (default-value 'auto-composition-mode)) @@ -872,6 +901,4 @@ For more information on Auto Composition mode, see (provide 'composite) - - ;;; composite.el ends here |