comparison lisp/international/mule-util.el @ 23687:9913df387dfb

(compose-chars-component): Signal error if CH is a rule-based composition character. (compose-chars): Signal error if an already compsed character is going to be composed by rule-base.
author Kenichi Handa <handa@m17n.org>
date Wed, 11 Nov 1998 03:36:15 +0000
parents aab4ef022ffd
children 3d9e32528ca1
comparison
equal deleted inserted replaced
23686:29fd5e07b576 23687:9913df387dfb
468 (defun compose-chars-component (ch) 468 (defun compose-chars-component (ch)
469 (if (< ch 128) 469 (if (< ch 128)
470 (format "\240%c" (+ ch 128)) 470 (format "\240%c" (+ ch 128))
471 (let ((str (string-as-unibyte (char-to-string ch)))) 471 (let ((str (string-as-unibyte (char-to-string ch))))
472 (if (cmpcharp ch) 472 (if (cmpcharp ch)
473 (substring str (if (= (aref str 1) ?\xFF) 2 1)) 473 (if (= (aref str 1) ?\xFF)
474 (error "Can't compose a rule-based composition character")
475 (substring str (if (= (aref str 1) ?\xFF) 2 1)))
474 (aset str 0 (+ (aref str 0) ?\x20)) 476 (aset str 0 (+ (aref str 0) ?\x20))
475 str)))) 477 str))))
476 478
477 ;; Return a string for composition rule RULE to be embedded in 479 ;; Return a string for composition rule RULE to be embedded in
478 ;; multibyte form of composite character. 480 ;; multibyte form of composite character.
491 (if (= (length args) 0) 493 (if (= (length args) 0)
492 (char-to-string first-component) 494 (char-to-string first-component)
493 (let* ((with-rule (consp (car args))) 495 (let* ((with-rule (consp (car args)))
494 (str (if with-rule (concat (vector leading-code-composition ?\xFF)) 496 (str (if with-rule (concat (vector leading-code-composition ?\xFF))
495 (char-to-string leading-code-composition)))) 497 (char-to-string leading-code-composition))))
498 (if (and with-rule
499 (cmpcharp first-component))
500 (error "Can't compose an already composed character"))
496 (setq str (concat str (compose-chars-component first-component))) 501 (setq str (concat str (compose-chars-component first-component)))
497 (while args 502 (while args
498 (if with-rule 503 (if with-rule
499 (progn 504 (progn
500 (if (not (consp (car args))) 505 (if (not (consp (car args)))
501 (error "Invalid composition rule: %s" (car args))) 506 (error "Invalid composition rule: %s" (car args)))
507 (if (cmpcharp (car (cdr args)))
508 (error "Can't compose an already composed character"))
502 (setq str (concat str (compose-chars-rule (car args)) 509 (setq str (concat str (compose-chars-rule (car args))
503 (compose-chars-component (car (cdr args)))) 510 (compose-chars-component (car (cdr args))))
504 args (cdr (cdr args)))) 511 args (cdr (cdr args))))
505 (setq str (concat str (compose-chars-component (car args))) 512 (setq str (concat str (compose-chars-component (car args)))
506 args (cdr args)))) 513 args (cdr args))))