]> code.delx.au - gnu-emacs/blob - lisp/language/european.el
(diacritic-composition-pattern): New constant.
[gnu-emacs] / lisp / language / european.el
1 ;;; european.el --- support for European languages -*- coding: iso-2022-7bit; -*-
2
3 ;; Copyright (C) 1995, 1997, 2001 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5
6 ;; Keywords: multilingual, European
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;; For Europeans, character sets ISO8859-1,2,3,4,9,14,15 are supported.
28
29 ;;; Code:
30
31 ;; Latin-1 (ISO-8859-1)
32
33 (make-coding-system
34 'iso-latin-1 2 ?1
35 "ISO 2022 based 8-bit encoding for Latin-1 (MIME:ISO-8859-1)"
36 '(ascii latin-iso8859-1 nil nil
37 nil nil nil nil nil nil nil nil nil nil nil nil t)
38 '((safe-charsets ascii latin-iso8859-1)
39 (mime-charset . iso-8859-1)))
40
41 (define-coding-system-alias 'iso-8859-1 'iso-latin-1)
42 (define-coding-system-alias 'latin-1 'iso-latin-1)
43
44 (set-language-info-alist
45 "Latin-1" '((charset ascii latin-iso8859-1)
46 (coding-system iso-latin-1)
47 (coding-priority iso-latin-1)
48 (nonascii-translation . latin-iso8859-1)
49 (unibyte-syntax . "latin-1")
50 (unibyte-display . iso-latin-1)
51 (input-method . "latin-1-prefix")
52 (sample-text
53 . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
54 (documentation . "\
55 This language environment is a generic one for the Latin-1 (ISO-8859-1)
56 character set which supports the following European languages:
57 Albanian, Basque, Breton, Catalan, Danish, Dutch, English, Faeroese,
58 Finnish, French (with restrictions -- see Latin-9), Frisian, Galician,
59 German, Greenlandic, Icelandic, Irish Gaelic (new orthography),
60 Italian, Latin, Luxemburgish, Norwegian, Portuguese, Rhaeto-Romanic,
61 Scottish Gaelic, Spanish, and Swedish.
62 We also have specific language environments for the following languages:
63 For Dutch, \"Dutch\".
64 For German, \"German\".
65 For Spanish, \"Spanish\".
66 For French, \"French\".
67
68 Latin-1 also covers several written languages outside Europe, including
69 Indonesian/Malay, Tagalog (Philippines), Swahili and Afrikaans."))
70 '("European"))
71
72 \f
73 ;; Latin-2 (ISO-8859-2)
74
75 (make-coding-system
76 'iso-latin-2 2 ?2
77 "ISO 2022 based 8-bit encoding (MIME:ISO-8859-2)"
78 '(ascii latin-iso8859-2 nil nil
79 nil nil nil nil nil nil nil)
80 '((safe-charsets ascii latin-iso8859-2)
81 (mime-charset . iso-8859-2)))
82
83 (define-coding-system-alias 'iso-8859-2 'iso-latin-2)
84 (define-coding-system-alias 'latin-2 'iso-latin-2)
85
86 (set-language-info-alist
87 "Latin-2" '((charset ascii latin-iso8859-2)
88 (coding-system iso-latin-2)
89 (coding-priority iso-latin-2)
90 (nonascii-translation . latin-iso8859-2)
91 (unibyte-syntax . "latin-2")
92 (unibyte-display . iso-latin-2)
93 (input-method . "latin-2-prefix")
94 (documentation . "\
95 This language environment is a generic one for the Latin-2 (ISO-8859-2)
96 character set which supports the following languages:
97 Albanian, Czech, English, German, Hungarian, Polish, Romanian,
98 Serbo-Croatian or Croatian, Slovak, Slovene, Sorbian (upper and lower),
99 and Swedish.
100 We also have specific language environments for the following languages:
101 For Czech, \"Czech\".
102 For Romanian, \"Romanian\".
103 For Slovak, \"Slovak\"."))
104 '("European"))
105
106 \f
107 ;; Latin-3 (ISO-8859-3)
108
109 (make-coding-system
110 'iso-latin-3 2 ?3
111 "ISO 2022 based 8-bit encoding (MIME:ISO-8859-3)"
112 '(ascii latin-iso8859-3 nil nil
113 nil nil nil nil nil nil nil)
114 '((safe-charsets ascii latin-iso8859-3)
115 (mime-charset . iso-8859-3)))
116
117 (define-coding-system-alias 'iso-8859-3 'iso-latin-3)
118 (define-coding-system-alias 'latin-3 'iso-latin-3)
119
120 (set-language-info-alist
121 "Latin-3" '((charset ascii latin-iso8859-3)
122 (coding-system iso-latin-3)
123 (coding-priority iso-latin-3)
124 (nonascii-translation . latin-iso8859-3)
125 (unibyte-syntax . "latin-3")
126 (unibyte-display . iso-latin-3)
127 (input-method . "latin-3-prefix")
128 (documentation . "\
129 These languages are supported with the Latin-3 (ISO-8859-3) character set:
130 Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
131 German, Italian, Maltese, Spanish, and Turkish."))
132 '("European"))
133
134 \f
135 ;; Latin-4 (ISO-8859-4)
136
137 (make-coding-system
138 'iso-latin-4 2 ?4
139 "ISO 2022 based 8-bit encoding (MIME:ISO-8859-4)"
140 '(ascii latin-iso8859-4 nil nil
141 nil nil nil nil nil nil nil)
142 '((safe-charsets ascii latin-iso8859-4)
143 (mime-charset . iso-8859-4)))
144
145 (define-coding-system-alias 'iso-8859-4 'iso-latin-4)
146 (define-coding-system-alias 'latin-4 'iso-latin-4)
147
148 (set-language-info-alist
149 "Latin-4" '((charset ascii latin-iso8859-4)
150 (coding-system iso-8859-4)
151 (coding-priority iso-8859-4)
152 (nonascii-translation . latin-iso8859-4)
153 (unibyte-syntax . "latin-4")
154 (unibyte-display . iso-8859-4)
155 (input-method . "latin-4-postfix")
156 (documentation . "\
157 These languages are supported with the Latin-4 (ISO-8859-4) character set:
158 Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
159 Latvian, Lithuanian, and Norwegian."))
160 '("European"))
161
162 \f
163 ;; Latin-5 (ISO-8859-9)
164
165 (make-coding-system
166 'iso-latin-5 2 ?9
167 "ISO 2022 based 8-bit encoding (MIME:ISO-8859-9)"
168 '(ascii latin-iso8859-9 nil nil
169 nil nil nil nil nil nil nil)
170 '((safe-charsets ascii latin-iso8859-9)
171 (mime-charset . iso-8859-9)))
172
173 (define-coding-system-alias 'iso-8859-9 'iso-latin-5)
174 (define-coding-system-alias 'latin-5 'iso-latin-5)
175
176 (set-language-info-alist
177 "Latin-5" '((charset ascii latin-iso8859-9)
178 (coding-system iso-latin-5)
179 (coding-priority iso-latin-5)
180 (nonascii-translation . latin-iso8859-9)
181 (unibyte-syntax . "latin-5")
182 (unibyte-display . iso-latin-5)
183 (input-method . "latin-5-postfix")
184 (documentation . "\
185 These languages are supported with the Latin-5 (ISO-8859-9) character set:
186 Bulgarian, Byelorussian, (Slavic) Macedonian, Russian, Serbian and
187 Ukranian.")) ; says ISO 8859-1
188 '("European"))
189
190 \f
191 ;; Latin-8 (ISO-8859-14)
192
193 (make-coding-system
194 'iso-latin-8 2 ?W ; `W' for `Welsh', since `C'
195 ; for `Celtic' is taken.
196 "ISO 2022 based 8-bit encoding for Latin-8 (MIME:ISO-8859-14)"
197 '(ascii latin-iso8859-14 nil nil
198 nil nil nil nil nil nil nil nil nil nil nil nil t)
199 '((safe-charsets ascii latin-iso8859-14)
200 (mime-charset . iso-8859-14)))
201
202 (define-coding-system-alias 'iso-8859-14 'iso-latin-8)
203 (define-coding-system-alias 'latin-8 'iso-latin-8)
204
205 (set-language-info-alist
206 "Latin-8" '((charset ascii latin-iso8859-14)
207 (coding-system iso-latin-8)
208 (coding-priority iso-latin-8)
209 (nonascii-translation . latin-iso8859-14)
210 (unibyte-syntax . "latin-8")
211 (unibyte-display . iso-latin-8)
212 (input-method . "latin-8-prefix")
213 ;; Fixme: Welsh/Ga{e}lic greetings
214 (sample-text . "\e,_"\e(B \e,_p\e(B \e,_^\e(B")
215 (documentation . "\
216 This language environment is a generic one for the Latin-8 (ISO-8859-14)
217 character set which supports the Celtic languages, including those not
218 covered by other ISO-8859 character sets: Welsh, Manx Gaelic and
219 Irish Gaelic (old orthography)."))
220 '("European"))
221 \f
222 ;; Latin-9 (ISO-8859-15)
223
224 (make-coding-system
225 'iso-latin-9 2 ?0 ; `0' for `Latin-0'
226 "ISO 2022 based 8-bit encoding for Latin-9 (MIME:ISO-8859-15)"
227 '(ascii latin-iso8859-15 nil nil
228 nil nil nil nil nil nil nil nil nil nil nil nil t)
229 '((safe-charsets ascii latin-iso8859-15)
230 (mime-charset . iso-8859-15)))
231
232 (define-coding-system-alias 'iso-8859-15 'iso-latin-9)
233 (define-coding-system-alias 'latin-9 'iso-latin-9)
234 (define-coding-system-alias 'latin-0 'iso-latin-9)
235
236 (set-language-info-alist
237 "Latin-9" '((charset ascii latin-iso8859-15)
238 (coding-system iso-latin-9)
239 (coding-priority iso-latin-9)
240 (nonascii-translation . latin-iso8859-15)
241 (unibyte-syntax . "latin-9")
242 (unibyte-display . iso-latin-9)
243 (input-method . "latin-9-prefix")
244 (sample-text
245 . "AVE. \e,b&(48<=>\e(B \e,b$\e(B")
246 (documentation . "\
247 This language environment is a generic one for the Latin-9 (ISO-8859-15)
248 character set which supports the same languages as Latin-1 with the
249 addition of the Euro sign and some additional French and Finnish letters.
250 Latin-9 is sometimes nicknamed `Latin-0'."))
251 '("European"))
252 \f
253 (set-language-info-alist
254 "German" '((tutorial . "TUTORIAL.de")
255 (charset ascii latin-iso8859-1)
256 (coding-system iso-latin-1)
257 (coding-priority iso-latin-1)
258 (input-method . "german-postfix")
259 (nonascii-translation . iso-latin-1)
260 (unibyte-syntax . "latin-1")
261 (unibyte-display . iso-latin-1)
262 (sample-text . "\
263 German (Deutsch Nord) Guten Tag
264 German (Deutsch S\e,A|\e(Bd) Gr\e,A|_\e(B Gott")
265 (documentation . "\
266 This language environment is almost the same as Latin-1,
267 but the default input method is set to \"german-postfix\"."))
268 '("European"))
269
270 (set-language-info-alist
271 "French" '((tutorial . "TUTORIAL.fr")
272 (charset ascii latin-iso8859-1)
273 (coding-system iso-latin-1)
274 (coding-priority iso-latin-1)
275 (nonascii-translation . latin-iso8859-1)
276 (unibyte-syntax . "latin-1")
277 (unibyte-display . iso-latin-1)
278 (input-method . "latin-1-prefix")
279 (sample-text . "French (Fran\e,Ag\e(Bais) Bonjour, Salut")
280 (documentation . "\
281 This language environment is almost the same as Latin-1,
282 but the tutorial is set to \"TUTORIAL.fr\"."))
283 '("European"))
284
285 (set-language-info-alist
286 "Slovenian" '((charset . (ascii latin-iso8859-2))
287 (coding-system . (iso-8859-2))
288 (coding-priority . (iso-8859-2))
289 (nonascii-translation . latin-iso8859-2)
290 (input-method . "latin-2-postfix")
291 (unibyte-syntax . "latin-2")
292 (unibyte-display . iso-8859-2)
293 (tutorial . "TUTORIAL.sl")
294 (sample-text . "\e,B.\e(Belimo vam uspe\e,B9\e(Ben dan!")
295 (documentation . t))
296 '("European"))
297
298 (set-language-info-alist
299 "Spanish" '((tutorial . "TUTORIAL.es")
300 (charset ascii latin-iso8859-1)
301 (coding-system iso-latin-1)
302 (coding-priority iso-latin-1)
303 (input-method . "spanish-postfix")
304 (nonascii-translation . iso-latin-1)
305 (unibyte-syntax . "latin-1")
306 (unibyte-display . iso-latin-1)
307 (sample-text . "Spanish (Espa\e,Aq\e(Bol) \e,A!\e(BHola!")
308 (documentation . "\
309 This language environment is almost the same as Latin-1,
310 but the default input method is set to \"spanish-postfix\",
311 and it selects the Spanish tutorial."))
312 '("European"))
313
314 (set-language-info-alist
315 "Dutch" '((tutorial . "TUTORIAL.nl")
316 (charset ascii latin-iso8859-1)
317 (coding-system iso-latin-1)
318 (coding-priority iso-latin-1)
319 (nonascii-translation . iso-latin-1)
320 (unibyte-syntax . "latin-1")
321 (unibyte-display . iso-latin-1)
322 (sample-text . "Er is een aantal manieren waarop je dit kan doen")
323 (documentation . "\
324 This language environment is almost the same as Latin-1,
325 but select's the Dutch tutorial."))
326 '("European"))
327
328 ;; For Turkish, the character set ISO-8859-9 (Latin-5) is used. But,
329 ;; before the introduction of ISO-8859-9 in 1988, ISO-8859-3 (Latin-3)
330 ;; was used for Turkish. Those who use Latin-3 for Turkish should use
331 ;; "Latin-3" language environment.
332
333 (set-language-info-alist
334 "Turkish" '((charset ascii latin-iso8859-9)
335 (coding-system iso-latin-5)
336 (coding-priority iso-latin-5)
337 (nonascii-translation . latin-iso8859-9)
338 (unibyte-syntax . "latin-5")
339 (unibyte-display . iso-latin-5)
340 (input-method . "turkish-postfix")
341 (sample-text . "Turkish (T\e,M|\e(Brk\e,Mg\e(Be) Merhaba")
342 (documentation . t)))
343
344 ;; Polish ISO 8859-2 environment.
345 ;; Maintainer: Wlodek Bzyl <matwb@univ.gda.pl>
346 ;; Keywords: multilingual, Polish
347
348 (set-language-info-alist
349 "Polish" '((charset . (ascii latin-iso8859-2))
350 (coding-system . (iso-8859-2))
351 (coding-priority . (iso-8859-2))
352 (input-method . "polish-slash")
353 (nonascii-translation . latin-iso8859-2)
354 (unibyte-syntax . "latin-2")
355 (unibyte-display . iso-8859-2)
356 (tutorial . "TUTORIAL.pl")
357 (sample-text . "P\e,Bs\e(Bjd\e,B<\e(B, ki\e,Bq\e(B-\e,B?\e(Be t\e,Bj\e(B chmurno\e,B6f\e(B w g\e,B31\e(Bb flaszy")
358 (documentation . t))
359 '("European"))
360
361 \f
362 ;; Definitions for the Mac Roman character sets and coding system.
363 ;; The Mac Roman encoding uses all 128 code points in the range 128 to
364 ;; 255 for actual characters. Emacs decodes them to one of the
365 ;; following character sets.
366 ;; ascii, latin-iso8859-1, mule-unicode-0100-24ff,
367 ;; mule-unicode-2500-33ff, mule-unicode-e000-ffff
368
369 (let
370 ((encoding-vector (make-vector 256 nil))
371 (i 0)
372 (vec ;; mac-roman (128..255) -> UCS mapping
373 [ #x00C4 ;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS
374 #x00C5 ;; 129:LATIN CAPITAL LETTER A WITH RING ABOVE
375 #x00C7 ;; 130:LATIN CAPITAL LETTER C WITH CEDILLA
376 #x00C9 ;; 131:LATIN CAPITAL LETTER E WITH ACUTE
377 #x00D1 ;; 132:LATIN CAPITAL LETTER N WITH TILDE
378 #x00D6 ;; 133:LATIN CAPITAL LETTER O WITH DIAERESIS
379 #x00DC ;; 134:LATIN CAPITAL LETTER U WITH DIAERESIS
380 #x00E1 ;; 135:LATIN SMALL LETTER A WITH ACUTE
381 #x00E0 ;; 136:LATIN SMALL LETTER A WITH GRAVE
382 #x00E2 ;; 137:LATIN SMALL LETTER A WITH CIRCUMFLEX
383 #x00E4 ;; 138:LATIN SMALL LETTER A WITH DIAERESIS
384 #x00E3 ;; 139:LATIN SMALL LETTER A WITH TILDE
385 #x00E5 ;; 140:LATIN SMALL LETTER A WITH RING ABOVE
386 #x00E7 ;; 141:LATIN SMALL LETTER C WITH CEDILLA
387 #x00E9 ;; 142:LATIN SMALL LETTER E WITH ACUTE
388 #x00E8 ;; 143:LATIN SMALL LETTER E WITH GRAVE
389 #x00EA ;; 144:LATIN SMALL LETTER E WITH CIRCUMFLEX
390 #x00EB ;; 145:LATIN SMALL LETTER E WITH DIAERESIS
391 #x00ED ;; 146:LATIN SMALL LETTER I WITH ACUTE
392 #x00EC ;; 147:LATIN SMALL LETTER I WITH GRAVE
393 #x00EE ;; 148:LATIN SMALL LETTER I WITH CIRCUMFLEX
394 #x00EF ;; 149:LATIN SMALL LETTER I WITH DIAERESIS
395 #x00F1 ;; 150:LATIN SMALL LETTER N WITH TILDE
396 #x00F3 ;; 151:LATIN SMALL LETTER O WITH ACUTE
397 #x00F2 ;; 152:LATIN SMALL LETTER O WITH GRAVE
398 #x00F4 ;; 153:LATIN SMALL LETTER O WITH CIRCUMFLEX
399 #x00F6 ;; 154:LATIN SMALL LETTER O WITH DIAERESIS
400 #x00F5 ;; 155:LATIN SMALL LETTER O WITH TILDE
401 #x00FA ;; 156:LATIN SMALL LETTER U WITH ACUTE
402 #x00F9 ;; 157:LATIN SMALL LETTER U WITH GRAVE
403 #x00FB ;; 158:LATIN SMALL LETTER U WITH CIRCUMFLEX
404 #x00FC ;; 159:LATIN SMALL LETTER U WITH DIAERESIS
405 #x2020 ;; 160:DAGGER
406 #x00B0 ;; 161:DEGREE SIGN
407 #x00A2 ;; 162:CENT SIGN
408 #x00A3 ;; 163:POUND SIGN
409 #x00A7 ;; 164:SECTION SIGN
410 #x2022 ;; 165:BULLET
411 #x00B6 ;; 166:PILCROW SIGN
412 #x00DF ;; 167:LATIN SMALL LETTER SHARP S
413 #x00AE ;; 168:REGISTERED SIGN
414 #x00A9 ;; 169:COPYRIGHT SIGN
415 #x2122 ;; 170:TRADE MARK SIGN
416 #x00B4 ;; 171:ACUTE ACCENT
417 #x00A8 ;; 172:DIAERESIS
418 #x2260 ;; 173:NOT EQUAL TO
419 #x00C6 ;; 174:LATIN CAPITAL LETTER AE
420 #x00D8 ;; 175:LATIN CAPITAL LETTER O WITH STROKE
421 #x221E ;; 176:INFINITY
422 #x00B1 ;; 177:PLUS-MINUS SIGN
423 #x2264 ;; 178:LESS-THAN OR EQUAL TO
424 #x2265 ;; 179:GREATER-THAN OR EQUAL TO
425 #x00A5 ;; 180:YEN SIGN
426 #x00B5 ;; 181:MICRO SIGN
427 #x2202 ;; 182:PARTIAL DIFFERENTIAL
428 #x2211 ;; 183:N-ARY SUMMATION
429 #x220F ;; 184:N-ARY PRODUCT
430 #x03C0 ;; 185:GREEK SMALL LETTER PI
431 #x222B ;; 186:INTEGRAL
432 #x00AA ;; 187:FEMININE ORDINAL INDICATOR
433 #x00BA ;; 188:MASCULINE ORDINAL INDICATOR
434 #x03A9 ;; 189:GREEK CAPITAL LETTER OMEGA
435 #x00E6 ;; 190:LATIN SMALL LETTER AE
436 #x00F8 ;; 191:LATIN SMALL LETTER O WITH STROKE
437 #x00BF ;; 192:INVERTED QUESTION MARK
438 #x00A1 ;; 193:INVERTED EXCLAMATION MARK
439 #x00AC ;; 194:NOT SIGN
440 #x221A ;; 195:SQUARE ROOT
441 #x0192 ;; 196:LATIN SMALL LETTER F WITH HOOK
442 #x2248 ;; 197:ALMOST EQUAL TO
443 #x2206 ;; 198:INCREMENT
444 #x00AB ;; 199:LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
445 #x00BB ;; 200:RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
446 #x2026 ;; 201:HORIZONTAL ELLIPSIS
447 #x00A0 ;; 202:NO-BREAK SPACE
448 #x00C0 ;; 203:LATIN CAPITAL LETTER A WITH GRAVE
449 #x00C3 ;; 204:LATIN CAPITAL LETTER A WITH TILDE
450 #x00D5 ;; 205:LATIN CAPITAL LETTER O WITH TILDE
451 #x0152 ;; 206:LATIN CAPITAL LIGATURE OE
452 #x0153 ;; 207:LATIN SMALL LIGATURE OE
453 #x2013 ;; 208:EN DASH
454 #x2014 ;; 209:EM DASH
455 #x201C ;; 210:LEFT DOUBLE QUOTATION MARK
456 #x201D ;; 211:RIGHT DOUBLE QUOTATION MARK
457 #x2018 ;; 212:LEFT SINGLE QUOTATION MARK
458 #x2019 ;; 213:RIGHT SINGLE QUOTATION MARK
459 #x00F7 ;; 214:DIVISION SIGN
460 #x25CA ;; 215:LOZENGE
461 #x00FF ;; 216:LATIN SMALL LETTER Y WITH DIAERESIS
462 #x0178 ;; 217:LATIN CAPITAL LETTER Y WITH DIAERESIS
463 #x2044 ;; 218:FRACTION SLASH
464 #x20AC ;; 219:EURO SIGN
465 #x2039 ;; 220:SINGLE LEFT-POINTING ANGLE QUOTATION MARK
466 #x203A ;; 221:SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
467 #xFB01 ;; 222:LATIN SMALL LIGATURE FI
468 #xFB02 ;; 223:LATIN SMALL LIGATURE FL
469 #x2021 ;; 224:DOUBLE DAGGER
470 #x00B7 ;; 225:MIDDLE DOT
471 #x201A ;; 226:SINGLE LOW-9 QUOTATION MARK
472 #x201E ;; 227:DOUBLE LOW-9 QUOTATION MARK
473 #x2030 ;; 228:PER MILLE SIGN
474 #x00C2 ;; 229:LATIN CAPITAL LETTER A WITH CIRCUMFLEX
475 #x00CA ;; 230:LATIN CAPITAL LETTER E WITH CIRCUMFLEX
476 #x00C1 ;; 231:LATIN CAPITAL LETTER A WITH ACUTE
477 #x00CB ;; 232:LATIN CAPITAL LETTER E WITH DIAERESIS
478 #x00C8 ;; 233:LATIN CAPITAL LETTER E WITH GRAVE
479 #x00CD ;; 234:LATIN CAPITAL LETTER I WITH ACUTE
480 #x00CE ;; 235:LATIN CAPITAL LETTER I WITH CIRCUMFLEX
481 #x00CF ;; 236:LATIN CAPITAL LETTER I WITH DIAERESIS
482 #x00CC ;; 237:LATIN CAPITAL LETTER I WITH GRAVE
483 #x00D3 ;; 238:LATIN CAPITAL LETTER O WITH ACUTE
484 #x00D4 ;; 239:LATIN CAPITAL LETTER O WITH CIRCUMFLEX
485 #xF8FF ;; 240:Apple logo
486 #x00D2 ;; 241:LATIN CAPITAL LETTER O WITH GRAVE
487 #x00DA ;; 242:LATIN CAPITAL LETTER U WITH ACUTE
488 #x00DB ;; 243:LATIN CAPITAL LETTER U WITH CIRCUMFLEX
489 #x00D9 ;; 244:LATIN CAPITAL LETTER U WITH GRAVE
490 #x0131 ;; 245:LATIN SMALL LETTER DOTLESS I
491 #x02C6 ;; 246:MODIFIER LETTER CIRCUMFLEX ACCENT
492 #x02DC ;; 247:SMALL TILDE
493 #x00AF ;; 248:MACRON
494 #x02D8 ;; 249:BREVE
495 #x02D9 ;; 250:DOT ABOVE
496 #x02DA ;; 251:RING ABOVE
497 #x00B8 ;; 252:CEDILLA
498 #x02DD ;; 253:DOUBLE ACUTE ACCENT
499 #x02DB ;; 254:OGONEK
500 #x02C7 ;; 255:CARON
501 ])
502 translation-table)
503 (while (< i 128)
504 (aset encoding-vector i i)
505 (setq i (1+ i)))
506 (while (< i 256)
507 (aset encoding-vector i
508 (decode-char 'ucs (aref vec (- i 128))))
509 (setq i (1+ i)))
510 (setq translation-table
511 (make-translation-table-from-vector encoding-vector))
512 (define-translation-table 'mac-roman-decoder translation-table)
513 (define-translation-table 'mac-roman-encoder
514 (char-table-extra-slot translation-table 0)))
515
516 (define-ccl-program decode-mac-roman
517 `(4
518 ((loop
519 (read r1)
520 (if (r1 < 128) ;; ASCII
521 (r0 = ,(charset-id 'ascii))
522 (if (r1 < 160)
523 (r0 = ,(charset-id 'eight-bit-control))
524 (r0 = ,(charset-id 'eight-bit-graphic))))
525 (translate-character mac-roman-decoder r0 r1)
526 (write-multibyte-character r0 r1)
527 (repeat))))
528 "CCL program to decode Mac Roman")
529
530 (define-ccl-program encode-mac-roman
531 `(1
532 ((loop
533 (read-multibyte-character r0 r1)
534 (translate-character mac-roman-encoder r0 r1)
535 (write-repeat r1))))
536 "CCL program to encode Mac Roman")
537
538 (make-coding-system
539 'mac-roman 4 ?M "Mac Roman Encoding"
540 '(decode-mac-roman . encode-mac-roman)
541 '((safe-chars . mac-roman-encoder)
542 (valid-codes (0 . 255))
543 (mime-charset . macintosh))) ; per IANA, rfc1345
544
545 (defconst diacritic-composition-pattern "\\C^\\c^+")
546
547 ;;;###autoload
548 (defun diacritic-compose-region (beg end)
549 "Compose diacritic characters in the region.
550 When called from a program, expects two arguments,
551 positions (integers or markers) specifying the region."
552 (interactive "r")
553 (save-restriction
554 (narrow-to-region beg end)
555 (goto-char (point-min))
556 (while (re-search-forward diacritic-composition-pattern nil t)
557 (compose-region (match-beginning 0) (match-end 0)))))
558
559 ;;;###autoload
560 (defun diacritic-compose-string (string)
561 "Compose diacritic characters in STRING and return the resulting string."
562 (let ((idx 0))
563 (while (setq idx (string-match diacritic-composition-pattern string idx))
564 (compose-string string idx (match-end 0))
565 (setq idx (match-end 0))))
566 string)
567
568 ;;;###autoload
569 (defun diacritic-compose-buffer ()
570 "Compose diacritic characters in the current buffer."
571 (interactive)
572 (diacritic-compose-region (point-min) (point-max)))
573
574 ;;;###autoload
575 (defun diacritic-post-read-conversion (len)
576 (diacritic-compose-region (point) (+ (point) len))
577 len)
578
579 ;;;###autoload
580 (defun diacritic-composition-function (from to pattern &optional string)
581 "Compose diacritic text in the region FROM and TO.
582 The text matches the regular expression PATTERN.
583 Optional 4th argument STRING, if non-nil, is a string containing text
584 to compose.
585
586 The return value is number of composed characters."
587 (if (< (1+ from) to)
588 (prog1 (- to from)
589 (if string
590 (compose-string string from to)
591 (compose-region from to))
592 (- to from))))
593
594 ;; Register a function to compose Unicode diacrtics and marks.
595 (let ((patterns '(("\\C^\\c^+" . diacrtic-composition-function))))
596 (let ((c #x300))
597 (while (<= c #x362)
598 (aset composition-function-table (decode-char 'ucs c) patterns)
599 (setq c (1+ c)))
600 (setq c #x20d0)
601 (while (<= c #x20e3)
602 (aset composition-function-table (decode-char 'ucs c) patterns)
603 (setq c (1+ c)))))
604
605 (provide 'european)
606
607 ;;; european.el ends here