diff options
author | Robert Pluim <rpluim@gmail.com> | 2021-09-21 17:46:32 +0200 |
---|---|---|
committer | Robert Pluim <rpluim@gmail.com> | 2021-09-24 13:10:48 +0200 |
commit | fdaae2e7bee5512047dc2ae67979d40cf60a5104 (patch) | |
tree | 10257c603816918103cd9a8c4c1dfd06f711b709 /lisp/composite.el | |
parent | 04e236044acfb77f2be0b66cd2e0b2a172159546 (diff) | |
download | emacs-fdaae2e7bee5512047dc2ae67979d40cf60a5104.tar.gz emacs-fdaae2e7bee5512047dc2ae67979d40cf60a5104.tar.bz2 emacs-fdaae2e7bee5512047dc2ae67979d40cf60a5104.zip |
Move compose-gstring-for-variation-glyph
It logically belongs in composite.el, not japanese.el
* lisp/language/japanese.el (compose-gstring-for-variation-glyph):
Remove from here.
* lisp/composite.el (compose-gstring-for-variation-glyph): And add here.
Diffstat (limited to 'lisp/composite.el')
-rw-r--r-- | lisp/composite.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/composite.el b/lisp/composite.el index a16c0cc2370..859253ec7e2 100644 --- a/lisp/composite.el +++ b/lisp/composite.el @@ -815,6 +815,28 @@ 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))))))) + +(let ((elt '([".." 1 compose-gstring-for-variation-glyph]))) + (set-char-table-range composition-function-table '(#xFE00 . #xFE0F) 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. |