summaryrefslogtreecommitdiff
path: root/lisp/composite.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/composite.el')
-rw-r--r--lisp/composite.el40
1 files changed, 18 insertions, 22 deletions
diff --git a/lisp/composite.el b/lisp/composite.el
index e50e5d381ec..e0d0721f16d 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -7,7 +7,7 @@
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H14PRO021
-;; Author: Kenichi HANDA <handa@etl.go.jp>
+;; Author: Kenichi Handa <handa@gnu.org>
;; (according to ack.texi)
;; Keywords: mule, multilingual, character composition
;; Package: emacs
@@ -119,7 +119,7 @@ RULE is a cons of global and new reference point symbols
(setq nref (cdr (assq nref reference-point-alist))))
(or (and (>= gref 0) (< gref 12) (>= nref 0) (< nref 12))
(error "Invalid composition rule: %S" rule))
- (logior (lsh xoff 16) (lsh yoff 8) (+ (* gref 12) nref)))
+ (logior (ash xoff 16) (ash yoff 8) (+ (* gref 12) nref)))
(error "Invalid composition rule: %S" rule))))
;; Decode encoded composition rule RULE-CODE. The value is a cons of
@@ -130,8 +130,8 @@ RULE is a cons of global and new reference point symbols
(defun decode-composition-rule (rule-code)
(or (and (natnump rule-code) (< rule-code #x1000000))
(error "Invalid encoded composition rule: %S" rule-code))
- (let ((xoff (lsh rule-code -16))
- (yoff (logand (lsh rule-code -8) #xFF))
+ (let ((xoff (ash rule-code -16))
+ (yoff (logand (ash rule-code -8) #xFF))
gref nref)
(setq rule-code (logand rule-code #xFF)
gref (car (rassq (/ rule-code 12) reference-point-alist))
@@ -382,8 +382,8 @@ This function is the default value of `compose-chars-after-function'."
(looking-at pattern))
(<= (match-end 0) limit))
(setq result
- (funcall func pos (match-end 0) font-obj object)))
- (setq result (funcall func pos limit font-obj object)))
+ (funcall func pos (match-end 0) font-obj object nil)))
+ (setq result (funcall func pos limit font-obj object nil)))
(if result (setq tail nil))))))
result))
@@ -524,8 +524,9 @@ after a sequence of character events."
(setq from (1+ from)))
gstring))
-(defun compose-gstring-for-graphic (gstring)
- "Compose glyph-string GSTRING for graphic display.
+(defun compose-gstring-for-graphic (gstring direction)
+ "Compose glyph-string GSTRING under bidi DIRECTION for graphic display.
+DIRECTION is either L2R or R2L, or nil if unknown.
Combining characters are composed with the preceding base
character. If the preceding character is not a base character,
each combining character is composed as a spacing character by
@@ -559,7 +560,7 @@ All non-spacing characters have this function in
;; A base character and the following non-spacing characters.
(t
- (let ((gstr (font-shape-gstring gstring)))
+ (let ((gstr (font-shape-gstring gstring direction)))
(if (and gstr
(> (lglyph-to (lgstring-glyph gstr 0)) 0))
gstr
@@ -686,12 +687,12 @@ All non-spacing characters have this function in
(setq i (1+ i))))
gstring))))))
-(defun compose-gstring-for-dotted-circle (gstring)
+(defun compose-gstring-for-dotted-circle (gstring direction)
(let* ((dc (lgstring-glyph gstring 0)) ; glyph of dotted-circle
(dc-id (lglyph-code dc))
(fc (lgstring-glyph gstring 1)) ; glyph of the following char
(fc-id (lglyph-code fc))
- (gstr (and nil (font-shape-gstring gstring))))
+ (gstr (and nil (font-shape-gstring gstring direction))))
(if (and gstr
(or (= (lgstring-glyph-len gstr) 1)
(and (= (lgstring-glyph-len gstr) 2)
@@ -742,7 +743,7 @@ All non-spacing characters have this function in
(aset composition-function-table #x25CC
`([,(purecopy ".\\c^") 0 compose-gstring-for-dotted-circle])))
-(defun compose-gstring-for-terminal (gstring)
+(defun compose-gstring-for-terminal (gstring _direction)
"Compose glyph-string GSTRING for terminal display.
Non-spacing characters are composed with the preceding base
character. If the preceding character is not a base character,
@@ -799,10 +800,11 @@ prepending a space before it."
gstring))
-(defun auto-compose-chars (func from to font-object string)
+(defun auto-compose-chars (func from to font-object string direction)
"Compose the characters at FROM by FUNC.
-FUNC is called with one argument GSTRING which is built for characters
-in the region FROM (inclusive) and TO (exclusive).
+FUNC is called with two arguments: GSTRING, which is built for
+characters in the region FROM (inclusive) and TO (exclusive);
+and DIRECTION, which is the bidi directionality of the characters.
If the character are composed on a graphic display, FONT-OBJECT
is a font to use. Otherwise, FONT-OBJECT is nil, and the function
@@ -819,7 +821,7 @@ This function is the default value of `auto-composition-function' (which see)."
gstring
(or (fontp font-object 'font-object)
(setq func 'compose-gstring-for-terminal))
- (funcall func gstring))))
+ (funcall func gstring direction))))
(put 'auto-composition-mode 'permanent-local t)
@@ -829,9 +831,6 @@ This function is the default value of `auto-composition-function' (which see)."
;;;###autoload
(define-minor-mode auto-composition-mode
"Toggle Auto Composition mode.
-With a prefix argument ARG, enable Auto Composition mode if ARG
-is positive, and disable it otherwise. If called from Lisp,
-enable the mode if ARG is omitted or nil.
When Auto Composition mode is enabled, text characters are
automatically composed by functions registered in
@@ -847,9 +846,6 @@ Auto Composition mode in all buffers (this is the default)."
;;;###autoload
(define-minor-mode global-auto-composition-mode
"Toggle Auto Composition mode in all buffers.
-With a prefix argument ARG, enable it if ARG is positive, and
-disable it otherwise. If called from Lisp, enable it if ARG is
-omitted or nil.
For more information on Auto Composition mode, see
`auto-composition-mode' ."