Function: compose-glyph-string-relative

compose-glyph-string-relative is a byte-compiled function defined in composite.el.gz.

Signature

(compose-glyph-string-relative GSTRING FROM TO &optional GAP)

Source Code

;; Defined in /usr/src/emacs/lisp/composite.el.gz
(defun compose-glyph-string-relative (gstring from to &optional gap)
  (let ((font-object (lgstring-font gstring))
	(glyph (lgstring-glyph gstring from))
	from-pos to-pos
	ascent descent)
    (if gap
	(setq gap (floor (* (font-get font-object :size) gap)))
      (setq gap 0))
    (setq from-pos (lglyph-from glyph)
	  to-pos (lglyph-to (lgstring-glyph gstring (1- to)))
	  ascent (lglyph-ascent glyph)
	  descent (lglyph-descent glyph))
    (lglyph-set-from-to glyph from-pos to-pos)
    (setq from (1+ from))
    (while (< from to)
      (setq glyph (lgstring-glyph gstring from))
      (lglyph-set-from-to glyph from-pos to-pos)
      (let ((this-ascent (lglyph-ascent glyph))
	    (this-descent (lglyph-descent glyph))
	    xoff yoff)
	(setq xoff (if (<= (lglyph-rbearing glyph) 0) 0
		     (- (lglyph-width glyph))))
	(if (> this-ascent 0)
	    (if (< this-descent 0)
		(setq yoff (- 0 ascent gap this-descent)
		      ascent (+ ascent gap this-ascent this-descent))
	      (setq yoff 0))
	  (setq yoff (+ descent gap this-ascent)
		descent (+ descent gap this-ascent this-descent)))
	(if (or (/= xoff 0) (/= yoff 0))
	    (lglyph-set-adjustment glyph xoff yoff 0)))
      (setq from (1+ from)))
    gstring))