Function: auto-compose-chars

auto-compose-chars is a byte-compiled function defined in composite.el.gz.

Signature

(auto-compose-chars FUNC FROM TO FONT-OBJECT STRING DIRECTION)

Documentation

Compose the characters at FROM by FUNC.

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 compose-gstring-for-terminal is used instead of FUNC.

If STRING is non-nil, it is a string, and FROM and TO are indices into the string. In that case, compose characters in the string.

The value is a gstring containing information for shaping the characters.

This function is the default value of auto-composition-function (which see).

Probably introduced at or before Emacs version 23.1.

Source Code

;; Defined in /usr/src/emacs/lisp/composite.el.gz
(defun auto-compose-chars (func from to font-object string direction)
  "Compose the characters at FROM by FUNC.
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
`compose-gstring-for-terminal' is used instead of FUNC.

If STRING is non-nil, it is a string, and FROM and TO are indices
into the string.  In that case, compose characters in the string.

The value is a gstring containing information for shaping the characters.

This function is the default value of `auto-composition-function' (which see)."
  (let ((gstring (composition-get-gstring from to font-object string)))
    (if (lgstring-shaped-p gstring)
	gstring
      (or (fontp font-object 'font-object)
	  (setq func 'compose-gstring-for-terminal))
      (funcall func gstring direction))))