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