-(defun lao-composition-function (pos &optional string)
- (setq pos (1- pos))
- (with-category-table lao-category-table
- (if string
- (if (and (>= pos 0)
- (eq (string-match lao-composition-pattern string pos) pos))
- (prog1 (match-end 0)
- (compose-string string pos (match-end 0))))
- (if (>= pos (point-min))
- (save-excursion
- (goto-char pos)
- (if (looking-at lao-composition-pattern)
- (prog1 (match-end 0)
- (compose-region pos (match-end 0)))))))))
+(defun lao-composition-function (gstring)
+ (if (= (lgstring-char-len gstring) 1)
+ (compose-gstring-for-graphic gstring)
+ (or (font-shape-gstring gstring)
+ (let ((glyph-len (lgstring-glyph-len gstring))
+ (i 0)
+ glyph)
+ (while (and (< i glyph-len)
+ (setq glyph (lgstring-glyph gstring i)))
+ (setq i (1+ i)))
+ (compose-glyph-string-relative gstring 0 i 0.1)))))