annotate lisp/language/tibet-util.el @ 81242:95935a0c1560

(mac_begin_cg_clip): New arg F. Call SetPortWindowPort. All callers changed so as not to call SetPortWindowPort. (mac_begin_cg_clip) [USE_CG_DRAWING]: Call mac_prepare_for_quickdraw. (mac_draw_image_string_atsui) [USE_ATSUI]: New function created from mac_draw_string_common. (mac_draw_image_string_qd): Likewise. (mac_draw_string_common): Use them. Add INLINE. (XTmouse_position, x_scroll_bar_report_motion) [TARGET_API_MAC_CARBON]: Use FRAME_OUTER_TO_INNER_DIFF_X, FRAME_OUTER_TO_INNER_DIFF_Y, and GetGlobalMouse. (x_set_mouse_pixel_position) [MAC_OSX]: Use FRAME_OUTER_TO_INNER_DIFF_X and FRAME_OUTER_TO_INNER_DIFF_Y. [TARGET_API_MAC_CARBON] (mac_handle_mouse_event): Likewise. [USE_MAC_TSM] (mac_handle_text_input_event): Likewise. (x_make_frame_visible) [TARGET_API_MAC_CARBON]: Move code for repositioning window to mac_handle_window_event. (x_make_frame_invisible) [TARGET_API_MAC_CARBON]: Move code for saving window location to mac_handle_window_event [USE_MAC_FONT_PANEL] (mac_show_hide_font_panel): Install handler here. (install_menu_target_item_handler): Remove argument in extern. [TARGET_API_MAC_CARBON] (mac_event_to_emacs_modifiers): Also accept command events. (do_keystroke): New function created from XTread_socket. (init_command_handler): Remove functions. [TARGET_API_MAC_CARBON] (mac_handle_window_event): Reposition window and save window location by kEventWindowShowing and kEventWindowHiding handlers here. Don't call next handler for window state change and focus events. (mac_handle_application_event, mac_handle_keyboard_event) [TARGET_API_MAC_CARBON]: New functions. (install_window_handler) [TARGET_API_MAC_CARBON]: Register handlers for kEventWindowShowing and kEventWindowHiding events. Move installation of mouse, font, text input and menu target item handlers to install_application_handler. (install_application_handler) [TARGET_API_MAC_CARBON]: New function. (mac_handle_cg_display_reconfig) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: New function. (init_dm_notification_handler) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: Register it. (XTread_socket) [TARGET_API_MAC_CARBON]: Consolidate SendEventToEventTarget calls. Use FRAME_OUTER_TO_INNER_DIFF_X and FRAME_OUTER_TO_INNER_DIFF_Y. Move application activation handler to mac_handle_application_event. Move keyboard handler to mac_handle_keyboard_event. (XTread_socket) [!TARGET_API_MAC_CARBON]: Use do_keystroke. (mac_initialize) [TARGET_API_MAC_CARBON]: Don't call init_command_handler. Call install_application_handler.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Thu, 07 Jun 2007 08:45:00 +0000
parents e3694f1cb928
children 2c775ed8fc89 95d0cdf160ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36685
ce27cce29f91 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 36683
diff changeset
1 ;;; tibet-util.el --- utilities for Tibetan -*- coding: iso-2022-7bit; -*-
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
2
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74605
diff changeset
3 ;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007
74544
43cc94d955c2 Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 64085
diff changeset
4 ;; Free Software Foundation, Inc.
74605
6ee41fdd69ff Update AIST copyright years.
Kenichi Handa <handa@m17n.org>
parents: 74544
diff changeset
5 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74605
diff changeset
6 ;; 2005, 2006, 2007
62396
197607499a29 Fix copyrights.
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
197607499a29 Fix copyrights.
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
8 ;; Registration Number H14PRO021
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
9
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
10 ;; Keywords: multilingual, Tibetan
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
11
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
13
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
17 ;; any later version.
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
18
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 ;; GNU General Public License for more details.
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
23
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62396
diff changeset
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62396
diff changeset
27 ;; Boston, MA 02110-1301, USA.
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29 ;; Author: Toru TOMABECHI, <Toru.Tomabechi@orient.unil.ch>
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31 ;; Created: Feb. 17. 1997
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36685
diff changeset
33 ;;; History:
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34 ;; 1997.03.13 Modification in treatment of text properties;
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 ;; Support for some special signs and punctuations.
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
36 ;; 1999.10.25 Modification for a new composition way by K.Handa.
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36685
diff changeset
38 ;;; Commentary:
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36685
diff changeset
39
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40 ;;; Code:
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
41
45032
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
42 (defconst tibetan-obsolete-glyphs
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
43 `(("$(7!=(B" . "$(8!=(B") ; 2 col <-> 1 col
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
44 ("$(7!?(B" . "$(8!?(B")
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
45 ("$(7!@(B" . "$(8!@(B")
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
46 ("$(7!A(B" . "$(8!A(B")
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
47 ("$(7"`(B" . "$(8"`(B")
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
48 ("$(7!;(B" . "$(8!;(B")
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
49 ("$(7!D(B" . "$(8!D(B")
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
50 ;; Yes these are dirty. But ...
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
51 ("$(7!>(B $(7!>(B" . ,(compose-string "$(7!>(B $(7!>(B" 0 3 [?$(7!>(B (Br . Bl) ? (Br . Bl) ?$(7!>(B]))
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
52 ("$(7!4!5!5(B" . ,(compose-string
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
53 "$(7#R#S#S#S(B" 0 4
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
54 [?$(7#R(B (Br . Bl) ?$(7#S(B (Br . Bl) ?$(7#S(B (Br . Bl) ?$(7#S(B]))
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
55 ("$(7!4!5(B" . ,(compose-string "$(7#R#S#S(B" 0 3 [?$(7#R(B (Br . Bl) ?$(7#S(B (Br . Bl) ?$(7#S(B]))
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
56 ("$(7!6(B" . ,(compose-string "$(7#R#S!I(B" 0 3 [?$(7#R(B (Br . Bl) ?$(7#S(B (br . tr) ?$(7!I(B]))
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
57 ("$(7!4(B" . ,(compose-string "$(7#R#S(B" 0 2 [?$(7#R(B (Br . Bl) ?$(7#S(B]))))
29a7076e3736 (tibetan-obsolete-glyphs): From tibetan.el.
Richard M. Stallman <rms@gnu.org>
parents: 42839
diff changeset
58
17993
73869115ae0a Most of setup-LANGUAGE-environment functions are
Kenichi Handa <handa@m17n.org>
parents: 17776
diff changeset
59 ;;;###autoload
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
60 (defun tibetan-char-p (ch)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
61 "Check if char CH is Tibetan character.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
62 Returns non-nil if CH is Tibetan. Otherwise, returns nil."
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
63 (memq (char-charset ch) '(tibetan tibetan-1-column)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
64
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
65 ;;; Functions for Tibetan <-> Tibetan-transcription.
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
66
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
67 ;;;###autoload
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
68 (defun tibetan-tibetan-to-transcription (str)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
69 "Transcribe Tibetan string STR and return the corresponding Roman string."
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
70 (let (;; Accumulate transcriptions here in reverse order.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
71 (trans nil)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
72 (len (length str))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
73 (i 0)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
74 ch this-trans)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
75 (while (< i len)
29828
cb30c41d1bb4 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 29596
diff changeset
76 (let ((idx (string-match tibetan-precomposition-rule-regexp str i)))
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
77 (if (eq idx i)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
78 ;; Ith character and the followings matches precomposable
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
79 ;; Tibetan sequence.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
80 (setq i (match-end 0)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
81 this-trans
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
82 (car (rassoc
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
83 (cdr (assoc (match-string 0 str)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
84 tibetan-precomposition-rule-alist))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
85 tibetan-precomposed-transcription-alist)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
86 (setq ch (substring str i (1+ i))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
87 i (1+ i)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
88 this-trans
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
89 (car (or (rassoc ch tibetan-consonant-transcription-alist)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
90 (rassoc ch tibetan-vowel-transcription-alist)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
91 (rassoc ch tibetan-subjoined-transcription-alist)))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
92 (setq trans (cons this-trans trans))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
93 (apply 'concat (nreverse trans))))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
94
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
95 ;;;###autoload
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
96 (defun tibetan-transcription-to-tibetan (str)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
97 "Convert Tibetan Roman string STR to Tibetan character string.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
98 The returned string has no composition information."
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
99 (let (;; Case is significant.
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
100 (case-fold-search nil)
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
101 (idx 0)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
102 ;; Accumulate Tibetan strings here in reverse order.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
103 (t-str-list nil)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
104 i subtrans)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
105 (while (setq i (string-match tibetan-regexp str idx))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
106 (if (< idx i)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
107 ;; STR contains a pattern that doesn't match Tibetan
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
108 ;; transcription. Include the pattern as is.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
109 (setq t-str-list (cons (substring str idx i) t-str-list)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
110 (setq subtrans (match-string 0 str)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
111 idx (match-end 0))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
112 (let ((t-char (cdr (assoc subtrans
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
113 tibetan-precomposed-transcription-alist))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
114 (if t-char
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
115 ;; SUBTRANS corresponds to a transcription for
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
116 ;; precomposable Tibetan sequence.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
117 (setq t-char (car (rassoc t-char
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
118 tibetan-precomposition-rule-alist)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
119 (setq t-char
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
120 (cdr
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
121 (or (assoc subtrans tibetan-consonant-transcription-alist)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
122 (assoc subtrans tibetan-vowel-transcription-alist)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
123 (assoc subtrans tibetan-modifier-transcription-alist)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
124 (assoc subtrans tibetan-subjoined-transcription-alist)))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
125 (setq t-str-list (cons t-char t-str-list))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
126 (if (< idx (length str))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
127 (setq t-str-list (cons (substring str idx) t-str-list)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
128 (apply 'concat (nreverse t-str-list))))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
129
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
130 ;;;
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
131 ;;; Functions for composing/decomposing Tibetan sequence.
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
132 ;;;
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
133 ;;; A Tibetan syllable is typically structured as follows:
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
134 ;;;
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
135 ;;; [Prefix] C [C+] V [M] [Suffix [Post suffix]]
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
136 ;;;
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
137 ;;; where C's are all vertically stacked, V appears below or above
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
138 ;;; consonant cluster and M is always put above the C[C+]V combination.
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
139 ;;; (Sanskrit visarga, though it is a vowel modifier, is considered
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
140 ;;; to be a punctuation.)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
141 ;;;
29828
cb30c41d1bb4 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 29596
diff changeset
142 ;;; Here are examples of the words "bsgrubs" and "hfauM"
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
143 ;;;
29828
cb30c41d1bb4 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 29596
diff changeset
144 ;;; 4$(7"70"714%qx!"U0"G###C"U14"70"714"G0"G1(B 4$(7"Hx!"Rx!"Ur'"_0"H"R"U"_1(B
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
145 ;;;
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
146 ;;; M
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
147 ;;; b s b s h
29828
cb30c41d1bb4 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 29596
diff changeset
148 ;;; g fa
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
149 ;;; r u
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
150 ;;; u
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
151 ;;;
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
152 ;;; Consonants `'' ($(7"A(B), `w' ($(7">(B), `y' ($(7"B(B), `r' ($(7"C(B) take special
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
153 ;;; forms when they are used as subjoined consonant. Consonant `r'
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
154 ;;; takes another special form when used as superjoined in such a case
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
155 ;;; as "rka", while it does not change its form when conjoined with
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
156 ;;; subjoined `'', `w' or `y' as in "rwa", "rya".
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
157
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
158 ;; Append a proper composition rule and glyph to COMPONENTS to compose
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
159 ;; CHAR with a composition that has COMPONENTS.
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
160
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
161 (defun tibetan-add-components (components char)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
162 (let ((last (last components))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
163 (stack-upper '(tc . bc))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
164 (stack-under '(bc . tc))
29596
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
165 rule comp-vowel tmp)
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
166 ;; Special treatment for 'a chung.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
167 ;; If 'a follows a consonant, turn it into the subjoined form.
29596
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
168 ;; * Disabled by Tomabechi 2000/06/09 *
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
169 ;; Because in Unicode, $(7"A(B may follow directly a consonant without
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45174
diff changeset
170 ;; any intervening vowel, as in 4$(7"90"914""0"""Q14"A0"A1!;(B=4$(7"90"91(B 4$(7""0""1(B 4$(7"A0"A1(B not 4$(7"90"91(B 4$(7""0""1(B $(7"Q(B 4$(7"A0"A1(B
29596
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
171 ;;(if (and (= char ?$(7"A(B)
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
172 ;; (aref (char-category-set (car last)) ?0))
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
173 ;; (setq char ?$(7"R(B)) ;; modified for new font by Tomabechi 1999/12/10
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
174
29596
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
175 ;; Composite vowel signs are decomposed before being added
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
176 ;; Added by Tomabechi 2000/06/08
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
177 (if (memq char '(?$(7"T(B ?$(7"V(B ?$(7"W(B ?$(7"X(B ?$(7"Y(B ?$(7"Z(B ?$(7"b(B))
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
178 (setq comp-vowel
29828
cb30c41d1bb4 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 29596
diff changeset
179 (copy-sequence
cb30c41d1bb4 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 29596
diff changeset
180 (cddr (assoc (char-to-string char)
cb30c41d1bb4 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 29596
diff changeset
181 tibetan-composite-vowel-alist)))
29596
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
182 char
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
183 (cadr (assoc (char-to-string char)
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
184 tibetan-composite-vowel-alist))))
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
185 (cond
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
186 ;; Compose upper vowel sign vertically over.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
187 ((aref (char-category-set char) ?2)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
188 (setq rule stack-upper))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
189
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
190 ;; Compose lower vowel sign vertically under.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
191 ((aref (char-category-set char) ?3)
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
192 (if (eq char ?$(7"Q(B) ;; `$(7"Q(B' should not visible when composed.
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
193 (setq rule nil)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
194 (setq rule stack-under)))
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
195 ;; Transform ra-mgo (superscribed r) if followed by a subjoined
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
196 ;; consonant other than w, ', y, r.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
197 ((and (= (car last) ?$(7"C(B)
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
198 (not (memq char '(?$(7#>(B ?$(7"R(B ?$(7#B(B ?$(7#C(B))))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
199 (setcar last ?$(7!"(B) ;; modified for newfont by Tomabechi 1999/12/10
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
200 (setq rule stack-under))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
201 ;; Transform initial base consonant if followed by a subjoined
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
202 ;; consonant but 'a.
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
203 (t
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
204 (let ((laststr (char-to-string (car last))))
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
205 (if (and (/= char ?$(7"R(B) ;; modified for new font by Tomabechi
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
206 (string-match "[$(7"!(B-$(7"="?"@"D(B-$(7"J"K(B]" laststr))
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
207 (setcar last (string-to-char
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
208 (cdr (assoc (char-to-string (car last))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
209 tibetan-base-to-subjoined-alist)))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
210 (setq rule stack-under))))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
211
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
212 (if rule
29596
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
213 (setcdr last (list rule char)))
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
214 ;; Added by Tomabechi 2000/06/08
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
215 (if comp-vowel
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
216 (nconc last comp-vowel))
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
217 ))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
218
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
219 ;;;###autoload
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
220 (defun tibetan-compose-string (str)
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
221 "Compose Tibetan string STR."
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
222 (let ((idx 0))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
223 ;; `$(7"A(B' is included in the pattern for subjoined consonants
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
224 ;; because we treat it specially in tibetan-add-components.
29596
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
225 ;; (This feature is removed by Tomabechi 2000/06/08)
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
226 (while (setq idx (string-match tibetan-composable-pattern str idx))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
227 (let ((from idx)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
228 (to (match-end 0))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
229 components)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
230 (if (eq (string-match tibetan-precomposition-rule-regexp str idx) idx)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
231 (setq idx (match-end 0)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
232 components
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
233 (list (string-to-char
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
234 (cdr
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
235 (assoc (match-string 0 str)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
236 tibetan-precomposition-rule-alist)))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
237 (setq components (list (aref str idx))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
238 idx (1+ idx)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
239 (while (< idx to)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
240 (tibetan-add-components components (aref str idx))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
241 (setq idx (1+ idx)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
242 (compose-string str from to components))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
243 str)
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
244
19553
e63ba5228950 (tibetan-composition): Add autoload cookies.
Kenichi Handa <handa@m17n.org>
parents: 19366
diff changeset
245 ;;;###autoload
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
246 (defun tibetan-compose-region (beg end)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
247 "Compose Tibetan text the region BEG and END."
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
248 (interactive "r")
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
249 (let (str result chars)
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
250 (save-excursion
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
251 (save-restriction
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
252 (narrow-to-region beg end)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
253 (goto-char (point-min))
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
254 ;; `$(7"A(B' is included in the pattern for subjoined consonants
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
255 ;; because we treat it specially in tibetan-add-components.
29596
c3845ffcb423 Convert all tibetan-1-column characters
Kenichi Handa <handa@m17n.org>
parents: 29363
diff changeset
256 ;; (This feature is removed by Tomabechi 2000/06/08)
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
257 (while (re-search-forward tibetan-composable-pattern nil t)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
258 (let ((from (match-beginning 0))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
259 (to (match-end 0))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
260 components)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
261 (goto-char from)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
262 (if (looking-at tibetan-precomposition-rule-regexp)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
263 (progn
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
264 (setq components
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
265 (list (string-to-char
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
266 (cdr
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
267 (assoc (match-string 0)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
268 tibetan-precomposition-rule-alist)))))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
269 (goto-char (match-end 0)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
270 (setq components (list (char-after from)))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
271 (forward-char 1))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
272 (while (< (point) to)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
273 (tibetan-add-components components (following-char))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
274 (forward-char 1))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
275 (compose-region from to components)))))))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
276
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
277 (defvar tibetan-decompose-precomposition-alist
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
278 (mapcar (function (lambda (x) (cons (string-to-char (cdr x)) (car x))))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
279 tibetan-precomposition-rule-alist))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
280
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
281 ;;;###autoload
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
282 (defun tibetan-decompose-region (from to)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
283 "Decompose Tibetan text in the region FROM and TO.
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
284 This is different from decompose-region because precomposed Tibetan characters
42839
df6b9860f119 (tibetan-decompose-region)
Pavel Janík <Pavel@Janik.cz>
parents: 38436
diff changeset
285 are decomposed into normal Tibetan character sequences."
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
286 (interactive "r")
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
287 (save-restriction
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
288 (narrow-to-region from to)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
289 (decompose-region from to)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
290 (goto-char from)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
291 (while (not (eobp))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
292 (let* ((char (following-char))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
293 (slot (assq char tibetan-decompose-precomposition-alist)))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
294 (if slot
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
295 (progn
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
296 (delete-char 1)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
297 (insert (cdr slot)))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
298 (forward-char 1))))))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
299
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
300
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
301 ;;;###autoload
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
302 (defun tibetan-decompose-string (str)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
303 "Decompose Tibetan string STR.
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
304 This is different from decompose-string because precomposed Tibetan characters
42839
df6b9860f119 (tibetan-decompose-region)
Pavel Janík <Pavel@Janik.cz>
parents: 38436
diff changeset
305 are decomposed into normal Tibetan character sequences."
29363
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
306 (let ((new "")
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
307 (len (length str))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
308 (idx 0)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
309 char slot)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
310 (while (< idx len)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
311 (setq char (aref str idx)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
312 slot (assq (aref str idx) tibetan-decompose-precomposition-alist)
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
313 new (concat new (if slot (cdr slot) (char-to-string char)))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
314 idx (1+ idx)))
1ebd8db9c3dc (tibetan-add-components): Fixes for new
Kenichi Handa <handa@m17n.org>
parents: 28906
diff changeset
315 new))
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
316
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
317 ;;;###autoload
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
318 (defun tibetan-composition-function (from to pattern &optional string)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
319 (if string
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
320 (tibetan-compose-string string)
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
321 (tibetan-compose-region from to))
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
322 (- to from))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
323
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
324 ;;;
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
325 ;;; This variable is used to avoid repeated decomposition.
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
326 ;;;
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
327 (setq-default tibetan-decomposed nil)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
328
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
329 ;;;###autoload
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
330 (defun tibetan-decompose-buffer ()
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
331 "Decomposes Tibetan characters in the buffer into their components.
26896
d48416a42048 Most functions rewritten.
Kenichi Handa <handa@m17n.org>
parents: 24159
diff changeset
332 See also the documentation of the function `tibetan-decompose-region'."
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
333 (interactive)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
334 (make-local-variable 'tibetan-decomposed)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
335 (cond ((not tibetan-decomposed)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
336 (tibetan-decompose-region (point-min) (point-max))
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
337 (setq tibetan-decomposed t))))
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
338
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
339 ;;;###autoload
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
340 (defun tibetan-compose-buffer ()
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
341 "Composes Tibetan character components in the buffer.
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
342 See also docstring of the function tibetan-compose-region."
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
343 (interactive)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
344 (make-local-variable 'tibetan-decomposed)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
345 (tibetan-compose-region (point-min) (point-max))
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
346 (setq tibetan-decomposed nil))
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
347
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
348 ;;;###autoload
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
349 (defun tibetan-post-read-conversion (len)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
350 (save-excursion
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
351 (save-restriction
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
352 (let ((buffer-modified-p (buffer-modified-p)))
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
353 (narrow-to-region (point) (+ (point) len))
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
354 (tibetan-compose-region (point-min) (point-max))
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
355 (set-buffer-modified-p buffer-modified-p)
20107
4595a463b105 (tibetan-post-read-conversion): Return
Kenichi Handa <handa@m17n.org>
parents: 19553
diff changeset
356 (make-local-variable 'tibetan-decomposed)
4595a463b105 (tibetan-post-read-conversion): Return
Kenichi Handa <handa@m17n.org>
parents: 19553
diff changeset
357 (setq tibetan-decomposed nil)
4595a463b105 (tibetan-post-read-conversion): Return
Kenichi Handa <handa@m17n.org>
parents: 19553
diff changeset
358 (- (point-max) (point-min))))))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
359
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
360
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
361 ;;;###autoload
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
362 (defun tibetan-pre-write-conversion (from to)
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
363 (setq tibetan-decomposed-temp tibetan-decomposed)
23522
0f86fe9632e0 (tibetan-pre-write-conversion): Use with-temp-buffer.
Kenichi Handa <handa@m17n.org>
parents: 22987
diff changeset
364 (let ((old-buf (current-buffer)))
23545
0d25c6f765ab (tibetan-pre-write-conversion): Cancel previous
Kenichi Handa <handa@m17n.org>
parents: 23522
diff changeset
365 (set-buffer (generate-new-buffer " *temp*"))
0d25c6f765ab (tibetan-pre-write-conversion): Cancel previous
Kenichi Handa <handa@m17n.org>
parents: 23522
diff changeset
366 (if (stringp from)
0d25c6f765ab (tibetan-pre-write-conversion): Cancel previous
Kenichi Handa <handa@m17n.org>
parents: 23522
diff changeset
367 (insert from)
0d25c6f765ab (tibetan-pre-write-conversion): Cancel previous
Kenichi Handa <handa@m17n.org>
parents: 23522
diff changeset
368 (insert-buffer-substring old-buf from to))
0d25c6f765ab (tibetan-pre-write-conversion): Cancel previous
Kenichi Handa <handa@m17n.org>
parents: 23522
diff changeset
369 (if (not tibetan-decomposed-temp)
0d25c6f765ab (tibetan-pre-write-conversion): Cancel previous
Kenichi Handa <handa@m17n.org>
parents: 23522
diff changeset
370 (tibetan-decompose-region (point-min) (point-max)))
17776
ece62fdeeebb (tibetan-pre-write-conversion): Make it work
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
371 ;; Should return nil as annotations.
ece62fdeeebb (tibetan-pre-write-conversion): Make it work
Kenichi Handa <handa@m17n.org>
parents: 17315
diff changeset
372 nil))
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
373
45174
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
374
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
375 ;;;
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
376 ;;; Unicode-related definitions.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 45174
diff changeset
377 ;;;
45174
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
378
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
379 (defvar tibetan-canonicalize-for-unicode-alist
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
380 '(("$(7"Q(B" . "") ;; remove vowel a
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
381 ("$(7"T(B" . "$(7"R"S(B") ;; decompose vowels whose use is ``discouraged'' in Unicode 3.0
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
382 ("$(7"V(B" . "$(7"R"U(B")
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
383 ("$(7"W(B" . "$(7#C"a(B")
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
384 ("$(7"X(B" . "$(7#C"R"a(B")
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
385 ("$(7"Y(B" . "$(7#D"a(B")
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
386 ("$(7"Z(B" . "$(7#D"R"a(B")
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
387 ("$(7"b(B" . "$(7"R"a(B"))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
388 "Rules for canonicalizing Tibetan vowels for Unicode.")
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
389
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
390 (defvar tibetan-canonicalize-for-unicode-regexp
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
391 "[$(7"Q"T"V"W"X"Y"Z"b(B]"
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
392 "Regexp for Tibetan vowels to be canonicalized in Unicode.")
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
393
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
394 (defun tibetan-canonicalize-for-unicode-region (from to)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
395 (save-restriction
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
396 (narrow-to-region from to)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
397 (goto-char from)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
398 (while (re-search-forward tibetan-canonicalize-for-unicode-regexp nil t)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
399 (let (
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
400 ;;(from (match-beginning 0))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
401 ;;(to (match-end 0))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
402 (canonical-form
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
403 (cdr (assoc (match-string 0)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
404 tibetan-canonicalize-for-unicode-alist))))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
405 ;;(goto-char from)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
406 ;;(delete-region from to)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
407 ;;(insert canonical-form)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
408 (replace-match canonical-form)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
409 ))))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
410
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
411 (defvar tibetan-strict-unicode t
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
412 "*Flag to control Tibetan canonicalizing for Unicode.
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
413
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
414 If non-nil, the vowel a is removed and composite vowels are decomposed
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
415 before writing buffer in Unicode. See also
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
416 `tibetan-canonicalize-for-unicode-regexp' and
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
417 `tibetan-canonicalize-for-unicode-alist'.")
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
418
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
419 ;;;###autoload
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
420 (defun tibetan-pre-write-canonicalize-for-unicode (from to)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
421 (let ((old-buf (current-buffer))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
422 (strict-unicode tibetan-strict-unicode))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
423 (set-buffer (generate-new-buffer " *temp*"))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
424 (if (stringp from)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
425 (insert from)
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
426 (insert-buffer-substring old-buf from to))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
427 (if strict-unicode
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
428 (tibetan-canonicalize-for-unicode-region (point-min) (point-max)))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
429 ;; Should return nil as annotations.
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
430 nil))
15af34d3b6f7 (tibetan-canonicalize-for-unicode-alist)
Kenichi Handa <handa@m17n.org>
parents: 45032
diff changeset
431
18309
bd8b521f5218 Provide XXX-util instead of
Kenichi Handa <handa@m17n.org>
parents: 17993
diff changeset
432 (provide 'tibet-util)
17301
0b94fe381355 Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
433
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49598
diff changeset
434 ;;; arch-tag: 7a7333e8-1584-446c-b39c-a02b9def265d
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 36685
diff changeset
435 ;;; tibet-util.el ends here