comparison lisp/international/mule-util.el @ 20841:ef5fd882ca63

(compose-chars-component): Return result as unibyte string. (decompose-composite-char): Doc-string modified.
author Kenichi Handa <handa@m17n.org>
date Wed, 04 Feb 1998 11:25:47 +0000
parents 42d729244a85
children 2c0815a83862
comparison
equal deleted inserted replaced
20840:1842af0263da 20841:ef5fd882ca63
421 ;; Return a string for char CH to be embedded in multibyte form of 421 ;; Return a string for char CH to be embedded in multibyte form of
422 ;; composite character. 422 ;; composite character.
423 (defun compose-chars-component (ch) 423 (defun compose-chars-component (ch)
424 (if (< ch 128) 424 (if (< ch 128)
425 (format "\240%c" (+ ch 128)) 425 (format "\240%c" (+ ch 128))
426 (let ((str (char-to-string ch))) 426 (let ((str (string-as-unibyte (char-to-string ch))))
427 (if (cmpcharp ch) 427 (if (cmpcharp ch)
428 (substring str (if (= (aref str 1) ?\xFF) 2 1)) 428 (substring str (if (= (aref str 1) ?\xFF) 2 1))
429 (aset str 0 (+ (aref str 0) ?\x20)) 429 (aset str 0 (+ (aref str 0) ?\x20))
430 str)))) 430 str))))
431 431
457 (setq str (concat str (compose-chars-rule (car args)) 457 (setq str (concat str (compose-chars-rule (car args))
458 (compose-chars-component (car (cdr args)))) 458 (compose-chars-component (car (cdr args))))
459 args (cdr (cdr args)))) 459 args (cdr (cdr args))))
460 (setq str (concat str (compose-chars-component (car args))) 460 (setq str (concat str (compose-chars-component (car args)))
461 args (cdr args)))) 461 args (cdr args))))
462 str))) 462 (string-as-multibyte str))))
463 463
464 ;;;###autoload 464 ;;;###autoload
465 (defun decompose-composite-char (char &optional type with-composition-rule) 465 (defun decompose-composite-char (char &optional type with-composition-rule)
466 "Convert composite character CHAR to a string containing components of CHAR. 466 "Convert composite character CHAR to a sequence of the components.
467 Optional 1st arg TYPE specifies the type of sequence returned. 467 Optional 1st arg TYPE specifies the type of sequence returned.
468 It should be `string' (default), `list', or `vector'. 468 It should be `string' (default), `list', or `vector'.
469 Optional 2nd arg WITH-COMPOSITION-RULE non-nil means the returned 469 Optional 2nd arg WITH-COMPOSITION-RULE non-nil means the returned
470 sequence contains embedded composition rules if any. In this case, the 470 sequence contains embedded composition rules if any. In this case, the
471 order of elements in the sequence is the same as arguments for 471 order of elements in the sequence is the same as arguments for