2 |
|
|
3 |
;; Copyright (C) 1995, 1997, 2001 Electrotechnical Laboratory, JAPAN. |
;; Copyright (C) 1995, 1997, 2001 Electrotechnical Laboratory, JAPAN. |
4 |
;; Licensed to the Free Software Foundation. |
;; Licensed to the Free Software Foundation. |
5 |
|
;; Copyright (C) 2001 Free Software Foundation, Inc. |
6 |
|
|
7 |
;; Keywords: multilingual, European |
;; Keywords: multilingual, European |
8 |
|
|
25 |
|
|
26 |
;;; Commentary: |
;;; Commentary: |
27 |
|
|
28 |
;; For Europeans, character sets ISO8859-1,2,3,4,9,14,15 are supported. |
;; For European scripts, character sets ISO8859-1,2,3,4,9,14,15 are |
29 |
|
;; supported. |
30 |
|
|
31 |
;;; Code: |
;;; Code: |
32 |
|
|
546 |
|
|
547 |
(defconst diacritic-composition-pattern "\\C^\\c^+") |
(defconst diacritic-composition-pattern "\\C^\\c^+") |
548 |
|
|
|
;;;###autoload |
|
549 |
(defun diacritic-compose-region (beg end) |
(defun diacritic-compose-region (beg end) |
550 |
"Compose diacritic characters in the region. |
"Compose diacritic characters in the region. |
551 |
When called from a program, expects two arguments, |
When called from a program, expects two arguments, |
557 |
(while (re-search-forward diacritic-composition-pattern nil t) |
(while (re-search-forward diacritic-composition-pattern nil t) |
558 |
(compose-region (match-beginning 0) (match-end 0))))) |
(compose-region (match-beginning 0) (match-end 0))))) |
559 |
|
|
|
;;;###autoload |
|
560 |
(defun diacritic-compose-string (string) |
(defun diacritic-compose-string (string) |
561 |
"Compose diacritic characters in STRING and return the resulting string." |
"Compose diacritic characters in STRING and return the resulting string." |
562 |
(let ((idx 0)) |
(let ((idx 0)) |
565 |
(setq idx (match-end 0)))) |
(setq idx (match-end 0)))) |
566 |
string) |
string) |
567 |
|
|
|
;;;###autoload |
|
568 |
(defun diacritic-compose-buffer () |
(defun diacritic-compose-buffer () |
569 |
"Compose diacritic characters in the current buffer." |
"Compose diacritic characters in the current buffer." |
570 |
(interactive) |
(interactive) |
571 |
(diacritic-compose-region (point-min) (point-max))) |
(diacritic-compose-region (point-min) (point-max))) |
572 |
|
|
|
;;;###autoload |
|
573 |
(defun diacritic-post-read-conversion (len) |
(defun diacritic-post-read-conversion (len) |
574 |
(diacritic-compose-region (point) (+ (point) len)) |
(diacritic-compose-region (point) (+ (point) len)) |
575 |
len) |
len) |
576 |
|
|
|
;;;###autoload |
|
577 |
(defun diacritic-composition-function (from to pattern &optional string) |
(defun diacritic-composition-function (from to pattern &optional string) |
578 |
"Compose diacritic text in the region FROM and TO. |
"Compose diacritic text in the region FROM and TO. |
579 |
The text matches the regular expression PATTERN. |
The text matches the regular expression PATTERN. |
589 |
(- to from)))) |
(- to from)))) |
590 |
|
|
591 |
;; Register a function to compose Unicode diacrtics and marks. |
;; Register a function to compose Unicode diacrtics and marks. |
592 |
(let ((patterns '(("\\C^\\c^+" . diacrtic-composition-function)))) |
(let ((patterns '(("\\C^\\c^+" . diacritic-composition-function)))) |
593 |
(let ((c #x300)) |
(let ((c #x300)) |
594 |
(while (<= c #x362) |
(while (<= c #x362) |
595 |
(aset composition-function-table (decode-char 'ucs c) patterns) |
(aset composition-function-table (decode-char 'ucs c) patterns) |