diff options
| author | Eli Zaretskii | 2018-12-29 16:35:09 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2018-12-29 16:35:09 +0200 |
| commit | 48776b70115edf3775df19d80f734048dadff198 (patch) | |
| tree | 10a7e72a45bbbdf8dbfed4afce59fc9a5b975110 /lisp/language | |
| parent | 1a80b5d9b8cfa0e523b596db5d1e7e6074dbee46 (diff) | |
| download | emacs-48776b70115edf3775df19d80f734048dadff198.tar.gz emacs-48776b70115edf3775df19d80f734048dadff198.zip | |
Provide text directionality and language to HarfBuzz shaper
* lisp/language/tv-util.el (tai-viet-composition-function):
* lisp/language/ethio-util.el (ethio-composition-function):
* lisp/language/japanese.el (compose-gstring-for-variation-glyph):
* lisp/language/thai-util.el (thai-composition-function):
* lisp/language/misc-lang.el (arabic-shape-gstring):
* lisp/language/lao-util.el (lao-composition-function):
* lisp/language/hebrew.el (hebrew-shape-gstring):
* lisp/composite.el (compose-gstring-for-graphic)
(compose-gstring-for-dotted-circle, auto-compose-chars)
(compose-gstring-for-terminal): Accept 2nd argument DIRECTION; all
callers changed.
* src/composite.c (composition_reseat_it): Call
auto-composition-function with one more argument DIRECTION.
(syms_of_composite) <auto-composition-function>: Update the doc
string.
* src/ftfont.c (ftfont_shape_by_hb): Compute language and
direction, and set buffer properties accordingly.
* src/composite.c (autocmp_chars):
* src/w32uniscribe.c (uniscribe_shape):
* src/xftfont.c (xftfont_shape):
* src/ftfont.c (ftfont_shape, ftfont_shape_by_hb):
* src/font.c (Ffont_shape_gstring): Accept an additional argument
DIRECTION.
* src/macfont.m (lgstring_direction): New enum.
(mac_font_shape_1, mac_screen_font_shape, mac_font_shape):
Accept an additional argument specifying text direction. All
callers changed.
* src/font.c (syms_of_font): New symbols QL2R and QR2L.
* src/font.h (shape): Accept new argument DIRECTION. All
implementations changed. (Bug#33729)
(ftfont_shape): Update prototype.
Diffstat (limited to 'lisp/language')
| -rw-r--r-- | lisp/language/ethio-util.el | 2 | ||||
| -rw-r--r-- | lisp/language/hebrew.el | 6 | ||||
| -rw-r--r-- | lisp/language/ind-util.el | 3 | ||||
| -rw-r--r-- | lisp/language/japanese.el | 2 | ||||
| -rw-r--r-- | lisp/language/lao-util.el | 6 | ||||
| -rw-r--r-- | lisp/language/misc-lang.el | 4 | ||||
| -rw-r--r-- | lisp/language/thai-util.el | 6 | ||||
| -rw-r--r-- | lisp/language/tv-util.el | 2 |
8 files changed, 17 insertions, 14 deletions
diff --git a/lisp/language/ethio-util.el b/lisp/language/ethio-util.el index 1ea01684eaa..0729a6d3a63 100644 --- a/lisp/language/ethio-util.el +++ b/lisp/language/ethio-util.el | |||
| @@ -1014,7 +1014,7 @@ With ARG, insert that many delimiters." | |||
| 1014 | ;; | 1014 | ;; |
| 1015 | 1015 | ||
| 1016 | ;;;###autoload | 1016 | ;;;###autoload |
| 1017 | (defun ethio-composition-function (pos to font-object string) | 1017 | (defun ethio-composition-function (pos to font-object string _direction) |
| 1018 | (setq pos (1- pos)) | 1018 | (setq pos (1- pos)) |
| 1019 | (let ((pattern "\\ce\\(፟\\|\\)")) | 1019 | (let ((pattern "\\ce\\(፟\\|\\)")) |
| 1020 | (if string | 1020 | (if string |
diff --git a/lisp/language/hebrew.el b/lisp/language/hebrew.el index c004337c2f8..52188f44725 100644 --- a/lisp/language/hebrew.el +++ b/lisp/language/hebrew.el | |||
| @@ -152,7 +152,7 @@ Bidirectional editing is supported."))) | |||
| 152 | ;; (3) If the font has precomposed glyphs, use them as far as | 152 | ;; (3) If the font has precomposed glyphs, use them as far as |
| 153 | ;; possible. Adjust the remaining glyphs artificially. | 153 | ;; possible. Adjust the remaining glyphs artificially. |
| 154 | 154 | ||
| 155 | (defun hebrew-shape-gstring (gstring) | 155 | (defun hebrew-shape-gstring (gstring direction) |
| 156 | (let* ((font (lgstring-font gstring)) | 156 | (let* ((font (lgstring-font gstring)) |
| 157 | (otf (font-get font :otf)) | 157 | (otf (font-get font :otf)) |
| 158 | (nchars (lgstring-char-len gstring)) | 158 | (nchars (lgstring-char-len gstring)) |
| @@ -172,7 +172,7 @@ Bidirectional editing is supported."))) | |||
| 172 | 172 | ||
| 173 | ((or (assq 'hebr (car otf)) (assq 'hebr (cdr otf))) | 173 | ((or (assq 'hebr (car otf)) (assq 'hebr (cdr otf))) |
| 174 | ;; FONT has OpenType features for Hebrew. | 174 | ;; FONT has OpenType features for Hebrew. |
| 175 | (font-shape-gstring gstring)) | 175 | (font-shape-gstring gstring direction)) |
| 176 | 176 | ||
| 177 | (t | 177 | (t |
| 178 | ;; FONT doesn't have OpenType features for Hebrew. | 178 | ;; FONT doesn't have OpenType features for Hebrew. |
| @@ -217,7 +217,7 @@ Bidirectional editing is supported."))) | |||
| 217 | ;; Now IDX is an index to the first non-precomposed glyph. | 217 | ;; Now IDX is an index to the first non-precomposed glyph. |
| 218 | ;; Adjust positions of the remaining glyphs artificially. | 218 | ;; Adjust positions of the remaining glyphs artificially. |
| 219 | (if (font-get font :combining-capability) | 219 | (if (font-get font :combining-capability) |
| 220 | (font-shape-gstring gstring) | 220 | (font-shape-gstring gstring direction) |
| 221 | (setq base-width (lglyph-width (lgstring-glyph gstring 0))) | 221 | (setq base-width (lglyph-width (lgstring-glyph gstring 0))) |
| 222 | (while (< idx nglyphs) | 222 | (while (< idx nglyphs) |
| 223 | (setq glyph (lgstring-glyph gstring idx)) | 223 | (setq glyph (lgstring-glyph gstring idx)) |
diff --git a/lisp/language/ind-util.el b/lisp/language/ind-util.el index 85e99181b5c..e5eaf1cb4a4 100644 --- a/lisp/language/ind-util.el +++ b/lisp/language/ind-util.el | |||
| @@ -829,6 +829,9 @@ Returns new end position." | |||
| 829 | (let ((pos from) newpos func (max to)) | 829 | (let ((pos from) newpos func (max to)) |
| 830 | (narrow-to-region from to) | 830 | (narrow-to-region from to) |
| 831 | (while (< pos max) | 831 | (while (< pos max) |
| 832 | ;; FIXME: The below seems to assume | ||
| 833 | ;; composition-function-table holds functions? That is no | ||
| 834 | ;; longer true, since long ago. | ||
| 832 | (setq func (aref composition-function-table (char-after pos))) | 835 | (setq func (aref composition-function-table (char-after pos))) |
| 833 | (if (fboundp func) | 836 | (if (fboundp func) |
| 834 | (setq newpos (funcall func pos nil) | 837 | (setq newpos (funcall func pos nil) |
diff --git a/lisp/language/japanese.el b/lisp/language/japanese.el index f6d9e1bf450..b1fb56980a4 100644 --- a/lisp/language/japanese.el +++ b/lisp/language/japanese.el | |||
| @@ -248,7 +248,7 @@ eucJP-ms is defined in <http://www.opengroup.or.jp/jvc/cde/appendix.html>." | |||
| 248 | (define-translation-table 'unicode-to-jisx0213 | 248 | (define-translation-table 'unicode-to-jisx0213 |
| 249 | (char-table-extra-slot table 0))) | 249 | (char-table-extra-slot table 0))) |
| 250 | 250 | ||
| 251 | (defun compose-gstring-for-variation-glyph (gstring) | 251 | (defun compose-gstring-for-variation-glyph (gstring _direction) |
| 252 | "Compose glyph-string GSTRING for graphic display. | 252 | "Compose glyph-string GSTRING for graphic display. |
| 253 | GSTRING must have two glyphs; the first is a glyph for a han character, | 253 | GSTRING must have two glyphs; the first is a glyph for a han character, |
| 254 | and the second is a glyph for a variation selector." | 254 | and the second is a glyph for a variation selector." |
diff --git a/lisp/language/lao-util.el b/lisp/language/lao-util.el index 554f7cfd83a..4d58be2fc57 100644 --- a/lisp/language/lao-util.el +++ b/lisp/language/lao-util.el | |||
| @@ -489,10 +489,10 @@ syllable. In that case, FROM and TO are indexes to STR." | |||
| 489 | lao-str))) | 489 | lao-str))) |
| 490 | 490 | ||
| 491 | ;;;###autoload | 491 | ;;;###autoload |
| 492 | (defun lao-composition-function (gstring) | 492 | (defun lao-composition-function (gstring direction) |
| 493 | (if (= (lgstring-char-len gstring) 1) | 493 | (if (= (lgstring-char-len gstring) 1) |
| 494 | (compose-gstring-for-graphic gstring) | 494 | (compose-gstring-for-graphic gstring direction) |
| 495 | (or (font-shape-gstring gstring) | 495 | (or (font-shape-gstring gstring direction) |
| 496 | (let ((glyph-len (lgstring-glyph-len gstring)) | 496 | (let ((glyph-len (lgstring-glyph-len gstring)) |
| 497 | (i 0) | 497 | (i 0) |
| 498 | glyph) | 498 | glyph) |
diff --git a/lisp/language/misc-lang.el b/lisp/language/misc-lang.el index c1aa79cae45..e25e63b4c5c 100644 --- a/lisp/language/misc-lang.el +++ b/lisp/language/misc-lang.el | |||
| @@ -101,8 +101,8 @@ thin (i.e. 1-dot width) space." | |||
| 101 | ;; Record error in arabic-change-gstring. | 101 | ;; Record error in arabic-change-gstring. |
| 102 | (defvar arabic-shape-log nil) | 102 | (defvar arabic-shape-log nil) |
| 103 | 103 | ||
| 104 | (defun arabic-shape-gstring (gstring) | 104 | (defun arabic-shape-gstring (gstring direction) |
| 105 | (setq gstring (font-shape-gstring gstring)) | 105 | (setq gstring (font-shape-gstring gstring direction)) |
| 106 | (condition-case err | 106 | (condition-case err |
| 107 | (when arabic-shaper-ZWNJ-handling | 107 | (when arabic-shaper-ZWNJ-handling |
| 108 | (let ((font (lgstring-font gstring)) | 108 | (let ((font (lgstring-font gstring)) |
diff --git a/lisp/language/thai-util.el b/lisp/language/thai-util.el index d6c9732a9e8..638d4832d93 100644 --- a/lisp/language/thai-util.el +++ b/lisp/language/thai-util.el | |||
| @@ -225,10 +225,10 @@ positions (integers or markers) specifying the region." | |||
| 225 | (thai-compose-region (point-min) (point-max))) | 225 | (thai-compose-region (point-min) (point-max))) |
| 226 | 226 | ||
| 227 | ;;;###autoload | 227 | ;;;###autoload |
| 228 | (defun thai-composition-function (gstring) | 228 | (defun thai-composition-function (gstring direction) |
| 229 | (if (= (lgstring-char-len gstring) 1) | 229 | (if (= (lgstring-char-len gstring) 1) |
| 230 | (compose-gstring-for-graphic gstring) | 230 | (compose-gstring-for-graphic gstring direction) |
| 231 | (or (font-shape-gstring gstring) | 231 | (or (font-shape-gstring gstring direction) |
| 232 | (let ((glyph-len (lgstring-glyph-len gstring)) | 232 | (let ((glyph-len (lgstring-glyph-len gstring)) |
| 233 | (last-char (lgstring-char gstring | 233 | (last-char (lgstring-char gstring |
| 234 | (1- (lgstring-char-len gstring)))) | 234 | (1- (lgstring-char-len gstring)))) |
diff --git a/lisp/language/tv-util.el b/lisp/language/tv-util.el index a667956a060..7ce8ee1e500 100644 --- a/lisp/language/tv-util.el +++ b/lisp/language/tv-util.el | |||
| @@ -128,7 +128,7 @@ | |||
| 128 | 128 | ||
| 129 | 129 | ||
| 130 | ;;;###autoload | 130 | ;;;###autoload |
| 131 | (defun tai-viet-composition-function (from to font-object string) | 131 | (defun tai-viet-composition-function (from to font-object string _direction) |
| 132 | (if string | 132 | (if string |
| 133 | (if (string-match tai-viet-re string from) | 133 | (if (string-match tai-viet-re string from) |
| 134 | (tai-viet-compose-string from (match-end 0) string)) | 134 | (tai-viet-compose-string from (match-end 0) string)) |