Function: composition-find-pos-glyph

composition-find-pos-glyph is a byte-compiled function defined in composite.el.gz.

Signature

(composition-find-pos-glyph COMPOSITION POS)

Documentation

Find in COMPOSITION a glyph that corresponds to character at position POS.

COMPOSITION is as returned by find-composition.

Source Code

;; Defined in /usr/src/emacs/lisp/composite.el.gz
(defun composition-find-pos-glyph (composition pos)
  "Find in COMPOSITION a glyph that corresponds to character at position POS.
COMPOSITION is as returned by `find-composition'."
  (let* ((from-pos (car composition))
         (to-pos (nth 1 composition))
         (gstring (nth 2 composition))
         (nglyphs (lgstring-glyph-len gstring))
        (idx 0)
        glyph found)
    (if (and (>= pos from-pos) (< pos to-pos))
        (while (and (not found) (< idx nglyphs))
          (setq glyph (lgstring-glyph gstring idx))
          (if (and (>= pos (+ from-pos (lglyph-from glyph)))
                   (<= pos (+ from-pos (lglyph-to glyph))))
              (setq found (lglyph-code glyph)))
          (setq idx (1+ idx))))
    found))