-;;; composite.el --- Support character composition.
+;;; composite.el --- support character composition
;; Copyright (C) 1999 Electrotechnical Laboratory, JAPAN.
;; Licensed to the Free Software Foundation.
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
+;;; Commentary:
+
;;; Code:
;;;###autoload
be added.
For instance, if GLOBAL-REF-POINT is `br' (bottom-right) and
-NEW-REF-POINT is `tl' (top-left), the overall glyph is updated as
+NEW-REF-POINT is `tc' (top-center), the overall glyph is updated as
follows (the point `*' corresponds to both reference points):
+-------+--+ <--- new ascent
(defun compose-region (start end &optional components modification-func)
"Compose characters in the current region.
+Characters are composed relatively, i.e. composed by overstricking or
+stacking depending on ascent, descent and other properties.
+
When called from a program, expects these four arguments.
First two arguments START and END are positions (integers or markers)
specifying the region.
Optional 3rd argument COMPONENTS, if non-nil, is a character or a
-sequence (vector, list, or string) of integers.
+sequence (vector, list, or string) of integers. In this case,
+characters are composed not relatively but according to COMPONENTS.
If it is a character, it is an alternate character to display instead
of the text in the region.
result))
\f
-;; A char-table of functions to call for compositions.
-;;;###autoload
-(put 'composition-function-table 'char-table-extra-slots 0)
-
-;;;###autoload
-(defvar composition-function-table
- (make-char-table 'composition-function-table)
- "Char table of patterns and functions to make a composition.
-
-Each element is nil or an alist of PATTERNs vs FUNCs, where PATTERNs
-are regular expressions and FUNCs are functions. FUNC is responsible
-for composing text matching the corresponding PATTERN. FUNC is called
-with three arguments FROM, TO, and PATTERN. See the function
-`compose-chars-after' for more detail.
-
-This table is looked up by the first character of a composition when
-the composition gets invalid after a change in a buffer.")
-
;;;###autoload
-(defun compose-chars-after (pos &optional limit)
+(defun compose-chars-after (pos &optional limit object)
"Compose characters in current buffer after position POS.
It looks up the char-table `composition-function-table' (which see) by
Optional 2nd arg LIMIT, if non-nil, limits the matching of text.
+Optional 3rd arg OBJECT, if non-nil, is a string that contains the
+text to compose. In that case, POS and LIMIT index to the string.
+
This function is the default value of `compose-chars-after-function'."
(let ((tail (aref composition-function-table (char-after pos)))
pattern func result)
;;;###autoload
(defun compose-last-chars (args)
"Compose last characters.
-The argument is a parameterized event of the form (compose-last-chars N),
-where N is the number of characters before point to compose.
+The argument is a parameterized event of the form
+ \(compose-last-chars N COMPONENTS),
+where N is the number of characters before point to compose,
+COMPONENTS, if non-nil, is the same as the argument to `compose-region'
+\(which see). If it is nil, `compose-chars-after' is called,
+and that function find a proper rule to compose the target characters.
This function is intended to be used from input methods.
The global keymap binds special event `compose-last-chars' to this
-function. Input method may generate an event (compose-last-chars N)
+function. Input method may generate an event (compose-last-chars N COMPONENTS)
after a sequence character events."
(interactive "e")
(let ((chars (nth 1 args)))
(if (and (numberp chars)
(>= (- (point) (point-min)) chars))
- (compose-chars-after (- (point) chars) (point)))))
+ (if (nth 2 args)
+ (compose-region (- (point) chars) (point) (nth 2 args))
+ (compose-chars-after (- (point) chars) (point))))))
;;;###autoload(global-set-key [compose-last-chars] 'compose-last-chars)
\f
;;; The following codes are only for backward compatibility with Emacs
-;;; 20.4 and the earlier.
+;;; 20.4 and earlier.
;;;###autoload
(defun decompose-composite-char (char &optional type with-composition-rule)
"Convert CHAR to string.
-This is only for backward compatibility with Emacs 20.4 and the earlier.
If optional 2nd arg TYPE is non-nil, it is `string', `list', or
`vector'. In this case, CHAR is converted string, list of CHAR, or
((eq type 'list) (list char))
(t (vector char))))
+;;;###autoload
(make-obsolete 'decompose-composite-char 'char-to-string "21.1")
\f