Function: lgstring-glyph-boundary
lgstring-glyph-boundary is a byte-compiled function defined in
composite.el.gz.
Signature
(lgstring-glyph-boundary GSTRING STARTPOS ENDPOS)
Documentation
Return buffer position at or after ENDPOS where grapheme from GSTRING ends.
STARTPOS is the position where the grapheme cluster starts; it is returned
by find-composition.
Source Code
;; Defined in /usr/src/emacs/lisp/composite.el.gz
(defun lgstring-glyph-boundary (gstring startpos endpos)
"Return buffer position at or after ENDPOS where grapheme from GSTRING ends.
STARTPOS is the position where the grapheme cluster starts; it is returned
by `find-composition'."
(let ((nglyphs (lgstring-glyph-len gstring))
(idx 0)
glyph found)
(while (and (not found) (< idx nglyphs))
(setq glyph (lgstring-glyph gstring idx))
(cond
((or (null glyph)
(= (+ startpos (lglyph-from glyph)) endpos))
(setq found endpos))
((>= (+ startpos (lglyph-to glyph)) endpos)
(setq found (+ startpos (lglyph-to glyph) 1)))
(t
(setq idx (1+ idx)))))
(or found endpos)))