Mercurial > emacs
comparison lisp/international/mule-util.el @ 24250:98056b9021a6
(compose-chars): Doc-string
modified. Currectly handle a composition character in ARGS.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 02 Feb 1999 05:11:50 +0000 |
parents | 31a8f281b188 |
children | b6fcff552040 |
comparison
equal
deleted
inserted
replaced
24249:20c1dc041c44 | 24250:98056b9021a6 |
---|---|
452 (cdr (assq (cdr rule) reference-point-alist))))) | 452 (cdr (assq (cdr rule) reference-point-alist))))) |
453 | 453 |
454 ;;;###autoload | 454 ;;;###autoload |
455 (defun compose-chars (first-component &rest args) | 455 (defun compose-chars (first-component &rest args) |
456 "Return one char string composed from the arguments. | 456 "Return one char string composed from the arguments. |
457 Each argument is a character (including a composite character) | 457 For relative composition, each argument should be a non-composition character |
458 or a composition rule. | 458 or a relative-composition character. |
459 For rule-based composition, Nth (where N is odd) argument should be | |
460 a non-composition character or a rule-based-composition character, | |
461 and Mth (where M is even) argument should be a composition rule. | |
459 A composition rule has the form \(GLOBAL-REF-POINT . NEW-REF-POINT). | 462 A composition rule has the form \(GLOBAL-REF-POINT . NEW-REF-POINT). |
460 See the documentation of `reference-point-alist' for more detail." | 463 See the documentation of `reference-point-alist' for more detail." |
461 (if (= (length args) 0) | 464 (if (= (length args) 0) |
462 (char-to-string first-component) | 465 (char-to-string first-component) |
463 (let* ((with-rule (consp (car args))) | 466 (let* ((with-rule (consp (car args))) |
464 (str (if with-rule (concat (vector leading-code-composition ?\xFF)) | 467 (str (if (cmpcharp first-component) |
465 (char-to-string leading-code-composition)))) | 468 (string-as-unibyte (char-to-string first-component)) |
466 (if (and with-rule | 469 (if with-rule |
467 (cmpcharp first-component)) | 470 (concat (vector leading-code-composition ?\xFF) |
468 (error "Can't compose an already composed character")) | 471 (compose-chars-component first-component)) |
469 (setq str (concat str (compose-chars-component first-component))) | 472 (concat (char-to-string leading-code-composition) |
473 (compose-chars-component first-component)))))) | |
474 (if (and (cmpcharp first-component) | |
475 (eq with-rule (/= (aref str 1) ?\xFF))) | |
476 (error "%s-compostion-character is not allowed in %s composition: %c" | |
477 (if with-rule "relative" "rule-based") | |
478 (if with-rule "rule-based" "relative") | |
479 first-component)) | |
470 (while args | 480 (while args |
471 (if with-rule | 481 (if with-rule |
472 (progn | 482 (setq str (concat str (compose-chars-rule (car args))) |
473 (if (not (consp (car args))) | 483 args (cdr args))) |
474 (error "Invalid composition rule: %s" (car args))) | 484 (if (cmpcharp (car args)) |
475 (if (cmpcharp (car (cdr args))) | 485 (let ((cmp-str (string-as-unibyte (char-to-string (car args))))) |
476 (error "Can't compose an already composed character")) | 486 (if (eq with-rule (/= (aref cmp-str 1) ?\xFF)) |
477 (setq str (concat str (compose-chars-rule (car args)) | 487 (error "%s-compostion-character is not allowed in %s composition: %c" |
478 (compose-chars-component (car (cdr args)))) | 488 (if with-rule "relative" "rule-based") |
479 args (cdr (cdr args)))) | 489 (if with-rule "rule-based" "relative") |
480 (setq str (concat str (compose-chars-component (car args))) | 490 (car args))) |
481 args (cdr args)))) | 491 (setq str (concat str (substring cmp-str |
492 (if with-rule 2 1))))) | |
493 (setq str (concat str (compose-chars-component (car args))))) | |
494 (setq args (cdr args))) | |
482 (string-as-multibyte str)))) | 495 (string-as-multibyte str)))) |
483 | 496 |
484 ;;;###autoload | 497 ;;;###autoload |
485 (defun decompose-composite-char (char &optional type with-composition-rule) | 498 (defun decompose-composite-char (char &optional type with-composition-rule) |
486 "Convert composite character CHAR to a sequence of the components. | 499 "Convert composite character CHAR to a sequence of the components. |