Function: compose-gstring-for-dotted-circle
compose-gstring-for-dotted-circle is a byte-compiled function defined
in composite.el.gz.
Signature
(compose-gstring-for-dotted-circle GSTRING DIRECTION)
Source Code
;; Defined in /usr/src/emacs/lisp/composite.el.gz
(defun compose-gstring-for-dotted-circle (gstring direction)
(let* ((dc (lgstring-glyph gstring 0)) ; glyph of dotted-circle
(fc (lgstring-glyph gstring 1)) ; glyph of the following char
(gstr (and nil (font-shape-gstring gstring direction))))
(if (and gstr
(or (= (lgstring-glyph-len gstr) 1)
(and (= (lgstring-glyph-len gstr) 2)
(= (lglyph-to (lgstring-glyph gstr 0))
(lglyph-to (lgstring-glyph gstr 1))))))
;; It seems that font-shape-gstring has composed glyphs.
gstr
;; Artificially compose the following glyph with the preceding
;; dotted-circle.
(setq dc (lgstring-glyph gstring 0)
fc (lgstring-glyph gstring 1))
(let ((dc-width (lglyph-width dc))
(fc-width (- (lglyph-rbearing fc) (lglyph-lbearing fc)))
(from (lglyph-from dc))
(to (lglyph-to fc))
(xoff 0) (yoff 0) (width 0))
(if (and (< (lglyph-descent fc) 0)
(> (lglyph-ascent dc) (- (lglyph-descent fc))))
;; Set YOFF so that the following glyph is put on top of
;; the dotted-circle.
(setq yoff (- (- (lglyph-descent fc)) (lglyph-ascent dc))))
(if (> (lglyph-width fc) 0)
(setq xoff (- (lglyph-rbearing fc))))
(if (< dc-width fc-width)
;; The following glyph is wider, but we don't know how to
;; align both glyphs. So, try the easiest method;
;; i.e. align left edges of the glyphs.
(setq xoff (- xoff (- dc-width) (- (lglyph-lbearing fc )))
width (- fc-width dc-width)))
(if (or (/= xoff 0) (/= yoff 0) (/= width 0) (/= (lglyph-width fc) 0))
(lglyph-set-adjustment fc xoff yoff width))
(lglyph-set-from-to dc from to)
(lglyph-set-from-to fc from to))
(if (> (lgstring-glyph-len gstring) 2)
(lgstring-set-glyph gstring 2 nil))
gstring)))