]> code.delx.au - gnu-emacs/blobdiff - leim/quail/ipa.el
Fix last font-related change.
[gnu-emacs] / leim / quail / ipa.el
index 9b6a319391815533da6e5fa82d10296745a5b2bf..8b921faa1e26873ad414f114ccbc4ac450784ca0 100644 (file)
@@ -1,11 +1,11 @@
 ;;; ipa.el --- Quail package for inputting IPA characters  -*-coding: utf-8;-*-
 
+;; Copyright (C) 2009-2013 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007, 2008, 2009
+;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
 ;; Licensed to the Free Software Foundation.
-;; Copyright (C) 2009 Free Software Foundation, Inc.
 
 ;; Keywords: multilingual, input method, IPA
 
 ;;; Code:
 
 (require 'quail)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (quail-define-package
  "ipa" "IPA" "IPA" t
  "International Phonetic Alphabet for English, French, German and Italian
 
 Upside-down characters are obtained by a preceding slash (/)."
- nil t nil nil nil nil nil nil nil nil t)
+ nil nil nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
  ("i" ?i)
@@ -79,7 +79,7 @@ Upside-down characters are obtained by a preceding slash (/)."
  ("t" ?t)
  ("d" ?d)
  ("k" ?k)
- ("g" ?g)
+ ("g" ?ɡ)
  ("f" ?f)
  ("v" ?v)
  ("th" ?θ)
@@ -87,6 +87,7 @@ Upside-down characters are obtained by a preceding slash (/)."
  ("s" ?s)
  ("z" ?z)
  ("sh" ?ʃ)
+ ("tsh" ["ʧ" "tʃ" "t⁀ʃ"])
  ("zh" ?ʒ)
  ("3" ?ʒ)
  ("c," ?ç)
@@ -112,7 +113,7 @@ Upside-down characters are obtained by a preceding slash (/)."
  (":" ?ː))
 
 (quail-define-package
- "kirshenbaum-ipa" "IPA" "IPA-K" t
+ "ipa-kirshenbaum" "IPA" "IPA-K" t
  "The International Phonetic Alphabet, using Kirshenbaum ASCII translit.
 
 Kirshenbaum IPA is an ASCII transliteration of the phonetic alphabet, common
@@ -128,6 +129,7 @@ Unicode diacritics on reading and emitting them, it displays them,
 incorrectly, as separate from the modified glyphs.")
 
 (quail-define-rules
+ ("g" "ɡ")    ;; Voiced velar plosive                 U+0261
  ("r" "ɹ")    ;; Alveolar approximant                 U+0279
  ("A" "ɑ")    ;; Low back unrounded vowel             U+0251
  ("B" "β")    ;; Voiced bilabial fricative            U+03B2
@@ -147,10 +149,13 @@ incorrectly, as separate from the modified glyphs.")
  ("P" "ɸ")    ;; Voiceless bilabial fricative         U+0278
  ("Q" "ɣ")    ;; Voiced velar fricative               U+0263
  ("R" ["ʀ"    ;; Alveolar trill                       U+0280
-       "ɚ"])    ;; Rhotacised schwa                   U+025A
- ("@<r>" "ɚ") ;; Mid central rhotacised vowel         U+025A
- ("S" "ʃ")    ;; Voiced postalveolar fricative        U+0283
- ("T" "θ")    ;; Voiced dental fricative              U+03B8
+       "ɚ"])    ;; Rhotacized schwa                   U+025A
+ ("@<r>" "ɚ") ;; Mid central rhotacized vowel         U+025A
+ ("S" "ʃ")    ;; Voiceless postalveolar fricative     U+0283
+ ("tS" ["ʧ"   ;; Voiceless postalveolar affricate     U+02A7
+       "tʃ"   ;;                               U+0074 U+0283
+       "t⁀ʃ"]) ;;                        U+0074 U+2040 U+0283
+ ("T" "θ")    ;; Voiceless dental fricative           U+03B8
  ("U" "ʊ")    ;; Semi-high back rounded vowel         U+028A
  ("V" "ʌ")    ;; Low-mid back unrounded vowel         U+028C
  ("W" "œ")    ;; Low-mid front rounded vowel          U+0153
@@ -165,20 +170,20 @@ incorrectly, as separate from the modified glyphs.")
  ("a~" "ã")   ;; Low central unrounded vowel, nasal   U+00E3
  ("o~" "õ")   ;; Upper-mid back rounded vowel, nasal  U+00F5
  ("u~" "ũ")   ;; High back rounded vowel, nasal       U+0169
- ("~" "̃")    ;; +Nasalised modifier                  U+0303
+ ("~" "̃")    ;; +Nasalized modifier                  U+0303
  (":" "ː")    ;; +Long modifier                       U+02D0
  ("-" "̩")    ;; +Syllabic modifier                   U+0329
  ("." "̣")    ;; +Retroflex modifier                  U+0323
  ("`" "ʼ")    ;; +Ejective modifier                   U+02BC
  ("[" "̪")    ;; +Dental modifier                     U+032A
- (";" "ʲ")    ;; +Palatalised modifier                U+02B2
- ("<H>" "̴")  ;; +Pharyngealised modifier             U+0334
+ (";" "ʲ")    ;; +Palatalized modifier                U+02B2
+ ("<H>" "̴")  ;; +Pharyngealized modifier             U+0334
  ("<h>" "ʰ")  ;; +Aspirated modifier                  U+02B0
  ("<o>" ["̥"  ;; +Voiceless modifier                  U+0325
         "˚"]) ;; +Unexploded modifier                 U+02DA
- ("<r>" "ʳ")  ;; +Rhotacised modifier                 U+02B3
- ("<w>" "ʷ")  ;; +Labialised modifier                 U+02B7
- ("<?>" "ʱ")  ;; +Murmured modififer                  U+02B1
+ ("<r>" "ʳ")  ;; +Rhotacized modifier                 U+02B3
+ ("<w>" "ʷ")  ;; +Labialized modifier                 U+02B7
+ ("<?>" "ʱ")  ;; +Murmured modifier                   U+02B1
 
  ("b<trl>" "ʙ")       ;; Bilabial trill                       U+0299
  ("b`" "ɓ")   ;; Bilabial implosive                   U+0253
@@ -232,7 +237,7 @@ incorrectly, as separate from the modified glyphs.")
  ("u\"" "ʉ")  ;; High central rounded vowel           U+0289
  ("@<umd>" "ɘ")       ;; Upper-mid central unrounded vowel    U+0258
 
- ("R<umd>" "ɝ")       ;; Upper-mid central rhotacised vowel   U+025D
+ ("R<umd>" "ɝ")       ;; Upper-mid central rhotacized vowel   U+025D
 
  ("@." "ɵ")   ;; Mid central rounded vowel            U+0275
  ("V\"" "ɜ")  ;; Lower-mid central unrounded vowel    U+025C
@@ -241,6 +246,19 @@ incorrectly, as separate from the modified glyphs.")
  ("o-" "ɤ")   ;; Upper-mid back unrounded vowel       U+0264
  ("A." "ɒ"))  ;; Lower back rounded vowel             U+0252
 
+
+(defconst ipa-x-sampa-implosive-submap
+  '(("b_<"   ?ɓ)   ;; Voiced bilabial implosive U+0253
+    ("d_<"   ?ɗ)   ;; Voiced alveolar implosive U+0257
+    ("g_<"   ?ɠ)   ;; Voiced velar implosive    U+0260
+    ("G\\_<" ?ʛ)   ;; Voiced uvular implosive   U+029B
+    ("J\\_<" ?ʄ))  ;; Voiced palatal implosive  U+0284
+  "A map from the X-SAMPA for some implosive consonants to characters.
+This is used because their X-SAMPA syntax is quasi-diacritic, but the
+corresponding Unicode characters themselves don't have diacritics, they are
+separate code points.  So we need to implement some extra logic that isn't
+normally provided by Quail.")
+
 ;; On XEmacs, with the supplied X-SAMPA data, this function is capably
 ;; implemented with:
 ;;
@@ -248,7 +266,7 @@ incorrectly, as separate from the modified glyphs.")
 ;;
 ;; Supporting GNU Emacs too makes it a good deal more complicated.
 
-(defun x-sampa-prepend-to-keymap-entry (to-prepend quail-keymap)
+(defun ipa-x-sampa-prepend-to-keymap-entry (to-prepend quail-keymap)
   "Return QUAIL-KEYMAP with TO-PREPEND at the beginning of each result.
 
 QUAIL-KEYMAP is a cons that satisfies `quail-map-p'; TO-PREPEND is a
@@ -259,18 +277,18 @@ string."
       (setq quail-keymap (list (string quail-keymap)))
     (if (stringp quail-keymap)
        (setq quail-keymap (list quail-keymap))
-      (assert (vectorp quail-keymap) t)
+      (cl-assert (vectorp quail-keymap) t)
       (setq quail-keymap (append quail-keymap nil))))
   (list
    (apply 'vector
          (mapcar
           #'(lambda (entry)
-               (assert (char-or-string-p entry) t)
+               (cl-assert (char-or-string-p entry) t)
                (format "%s%s" to-prepend
                        (if (integerp entry) (string entry) entry)))
           quail-keymap))))
 
-(defun x-sampa-underscore-implosive (input-string length)
+(defun ipa-x-sampa-underscore-implosive (input-string length)
   "Return keymap with IPA implosives, for INPUT-STRING, length LENGTH.
 
 The implosive consonants in X-SAMPA are represented with more or less a
@@ -290,7 +308,7 @@ particular sequence of keys, and the result will be cached by Quail."
         (pre-underscore (car split-input))
         (pre-underscore-map (quail-lookup-key pre-underscore))
         (x-sampa-submap-entry
-         (assoc (format "%s<" input-string) x-sampa-implosive-submap))
+         (assoc (format "%s<" input-string) ipa-x-sampa-implosive-submap))
         underscore-map-entry)
     (if (and (consp pre-underscore-map) (car pre-underscore-map))
        (setq pre-underscore-map (car pre-underscore-map))
@@ -300,21 +318,21 @@ particular sequence of keys, and the result will be cached by Quail."
     (dolist (underscoring underscore-map)
       (cond ((null underscoring))
            ((eq (length underscoring) 2)
-            (setq underscore-map-entry (second underscoring))
-            (setcdr underscoring (x-sampa-prepend-to-keymap-entry
+            (setq underscore-map-entry (cl-second underscoring))
+            (setcdr underscoring (ipa-x-sampa-prepend-to-keymap-entry
                                   pre-underscore-map underscore-map-entry)))
            ((eq (length underscoring) 3)
-            (setq underscore-map-entry (second (third underscoring)))
-            (setcdr (third underscoring)
-                    (x-sampa-prepend-to-keymap-entry
+            (setq underscore-map-entry (cl-second (cl-third underscoring)))
+            (setcdr (cl-third underscoring)
+                    (ipa-x-sampa-prepend-to-keymap-entry
                      pre-underscore-map underscore-map-entry)))
            (t
-            (assert (null t) t
-                    "Can't handle subtrees of this level right now."))))
-    (append underscore-map (list (list ?< (second x-sampa-submap-entry))))))
+            (cl-assert (null t) t
+                        "Can't handle subtrees of this level right now."))))
+    (append underscore-map (list (list ?< (cl-second x-sampa-submap-entry))))))
 
 (quail-define-package
- "x-sampa-ipa" "IPA" "IPA-X" t
+ "ipa-x-sampa" "IPA" "IPA-X" t
  "The International Phonetic Alphabet, using J.C. Wells' X-SAMPA.
 
 X-SAMPA is an ASCII transliteration of the IPA, normally used for data
@@ -323,20 +341,16 @@ uses this transliteration to allow you to produce the IPA in your editor
 with a keyboard that's limited to ASCII.
 
 See http://www.phon.ucl.ac.uk/home/sampa/ipasam-x.pdf for a full definition
-of the mapping. A caveat with regard to that document; while XEmacs
+of the mapping.  A caveat with regard to that document; while XEmacs
 currently preserves Unicode diacritics on reading and emitting them, it
-displays them, incorrectly, as separate from the modified glyphs." nil t t)
+displays them, incorrectly, as separate from the modified glyphs.")
 
 (quail-define-rules
  ;; Table taken from http://en.wikipedia.org/wiki/X-SAMPA, checked with
  ;; http://www.phon.ucl.ac.uk/home/sampa/ipasam-x.pdf
 
  ("d`" "ɖ")   ;; Voiced retroflex plosive             U+0256
-
- ;; In the Wikipedia article, they list ASCII g as mapping to U+0261, LATIN
- ;; SMALL LETTER SCRIPT G. The typeset g is equally acceptable as the voiced
- ;; velar plosive, however, and we don't override the identity mapping here.
-
+ ("g" "ɡ")    ;; Voiced velar plosive                 U+0261
  ("h\\" "ɦ")  ;; Voiced glottal fricative             U+0266
  ("j\\" "ʝ")  ;; Voiced palatal fricative             U+029D
  ("l`" "ɭ")   ;; Retroflex lateral approximant        U+026D
@@ -383,6 +397,9 @@ displays them, incorrectly, as separate from the modified glyphs." nil t t)
  ("R" "ʁ")    ;; Voiced uvular fricative              U+0281
  ("R\\" "ʀ")  ;; Uvular trill                         U+0280
  ("S" "ʃ")    ;; Voiceless postalveolar fricative     U+0283
+ ("tS" ["ʧ"   ;; Voiceless postalveolar affricate     U+02A7
+       "tʃ"   ;;                               U+0074 U+0283
+       "t⁀ʃ"]) ;;                        U+0074 U+2040 U+0283
  ("T" "θ")    ;; Voiceless dental fricative           U+03B8
  ("U" "ʊ")    ;; Near-close near-back rounded vowel   U+028A
  ("U\\" ["ʊ̵"])      ;; Central lax close rounded vowel, U+028A U+0335
@@ -399,7 +416,7 @@ displays them, incorrectly, as separate from the modified glyphs." nil t t)
  (":\\" "ˑ")  ;; Half-long                            U+02D1
  ("@" "ə")    ;; Schwa                                U+0259
  ("@\\" "ɘ")  ;; Close-mid central unrounded vowel    U+0258
- ("@`" "ɚ")   ;; Rhotacised schwa                     U+025A
+ ("@`" "ɚ")   ;; Rhotacized schwa                     U+025A
  ("{" "æ")    ;; Near-open front unrounded vowel      U+00E6
  ("}" "ʉ")    ;; Close central rounded vowel          U+0289
  ("1" "ɨ")    ;; Close central unrounded vowel        U+0268
@@ -407,7 +424,7 @@ displays them, incorrectly, as separate from the modified glyphs." nil t t)
  ("3" "ɜ")    ;; Open-mid central unrounded vowel     U+025C
  ("3\\" "ɞ")  ;; Open-mid central rounded vowel       U+025E
  ("4" "ɾ")    ;; Alveolar flap                        U+027E
- ("5" "ɫ")    ;; Velarised alveolar lateral approximant       U+026B
+ ("5" "ɫ")    ;; Velarized alveolar lateral approximant       U+026B
  ("6" "ɐ")    ;; Near-open central vowel              U+0250
  ("7" "ɤ")    ;; Close-mid back unrounded vowel       U+0264
  ("8" "ɵ")    ;; Close-mid central rounded vowel      U+0275
@@ -434,7 +451,7 @@ displays them, incorrectly, as separate from the modified glyphs." nil t t)
  ;; them, and the recipient's client is capable, they will get through,
  ;; though.
 
- ("_\"" "̈")  ;; Centralised                          U+0308
+ ("_\"" "̈")  ;; Centralized                          U+0308
  ("_+" "̟")   ;; Advanced                             U+031F
  ("_-" "̠")   ;; Retracted                            U+0320
  ("_/" "ˇ")   ;; Rising tone                          U+02C7
@@ -442,31 +459,31 @@ displays them, incorrectly, as separate from the modified glyphs." nil t t)
  ("_=" "̩")   ;; Syllabic                             U+0329
  ("=" "̩")    ;; Syllabic                             U+0329
  ("_>" "ʼ")   ;; Ejective                             U+02BC
- ("_?\\" "ˤ") ;; Pharyngealised                       U+02E4
+ ("_?\\" "ˤ") ;; Pharyngealized                       U+02E4
  ("_\\" "ˆ")  ;; Falling Tone                         U+02C6
  ("_^" "̯")   ;; Non-syllabic                         U+032F
  ("_}" "̚")   ;; No audible release                   U+031A
  ;; ` is alternatively; retroflexion in consonants
  ("`" "˞")    ;; Rhotacization in vowels              U+02DE
- ("_~" "̃")   ;; Nasalisation                         U+0303
- ("~" "̃")    ;; Nasalisation                         U+0303
+ ("_~" "̃")   ;; Nasalization                         U+0303
+ ("~" "̃")    ;; Nasalization                         U+0303
  ("_A" "̘")   ;; Advanced tongue root                 U+0318
  ("_a" "̺")   ;; Apical                               U+033A
  ("_B" "̏")   ;; Extra low tone                       U+030F
  ;; _B_L omitted, no Unicode code point for "low rising tone."
  ("_c" "̜")   ;; Less rounded                         U+031C
  ("_d" "̪")   ;; Dental                               U+032A
- ("_e" "̴")   ;; Velarised or pharyngeal              U+0334
+ ("_e" "̴")   ;; Velarized or pharyngeal              U+0334
 
  ("<F>" "↙") ;; Global fall; SOUTH EAST ARROW; may be a bit smaller than
                ;; intended.
  ("_F" "̂")   ;; Falling tone                         U+0302
- ("_G" "ˠ")   ;; Velarised                            U+02E0
+ ("_G" "ˠ")   ;; Velarized                            U+02E0
  ("_H" "́")   ;; High tone                            U+0301
  ;; "_H_T omitted, no Unicode code point for "high rising tone"
  ("_h" "ʰ")   ;; Aspirated                            U+02B0
- ("_j" "ʲ")   ;; Palatalised                          U+02B2
- ("'" "ʲ")    ;; Palatalised                          U+02B2
+ ("_j" "ʲ")   ;; Palatalized                          U+02B2
+ ("'" "ʲ")    ;; Palatalized                          U+02B2
  ("_k" "̰")   ;; Creaky voice                         U+0330
  ("_L" "̀")   ;; Low tone                             U+0300
  ("_l" "ˡ")   ;; Lateral release                      U+02E1
@@ -484,32 +501,19 @@ displays them, incorrectly, as separate from the modified glyphs." nil t t)
  ("_T" "̋")   ;; Extra high tone                      U+030B
  ("_t" "̤")   ;; Breathy voice                        U+0324
  ("_v" "̬")   ;; Voiced                               U+032C
- ("_w" "ʷ")   ;; Labialised                           U+02B7
+ ("_w" "ʷ")   ;; Labialized                           U+02B7
  ("_X" "̆")   ;; Extra-short                          U+0306
- ("_x" "̽"))  ;; Mid-centralised                      U+033D
-
-(defconst x-sampa-implosive-submap
-  '(("b_<"   ?ɓ)   ;; Voiced bilabial implosive U+0253
-    ("d_<"   ?ɗ)   ;; Voiced alveolar implosive U+0257
-    ("g_<"   ?ɠ)   ;; Voiced velar implosive    U+0260
-    ("G\\_<" ?ʛ)   ;; Voiced uvular implosive   U+029B
-    ("J\\_<" ?ʄ))  ;; Voiced palatal implosive  U+0284
-  "A map from the X-SAMPA for some implosive consonants to characters.
-This is used because their X-SAMPA syntax is quasi-diacritic, but the
-corresponding Unicode characters themselves don't have diacritics, they are
-separate code points.  So we need to implement some extra logic that isn't
-normally provided by Quail.")
+ ("_x" "̽"))  ;; Mid-centralized                      U+033D
 
 ;; Putting in place rules for the implosives like for the others above
 ;; breaks the "_<diacritic>" rules for b, d, g, G and J a little--you need
 ;; to interrupt Quail before typing the underscore if you want the
 ;; diacritic. To avoid this, handle the input specially with the function
-;; x-sampa-underscore-implosive.
+;; ipa-x-sampa-underscore-implosive.
 
-(dolist (implosive-x-sampa (mapcar 'car x-sampa-implosive-submap))
+(dolist (implosive-x-sampa (mapcar 'car ipa-x-sampa-implosive-submap))
   (setq implosive-x-sampa (car (split-string implosive-x-sampa "_")))
   (quail-defrule (format "%s_" implosive-x-sampa)
-                'x-sampa-underscore-implosive))
+                'ipa-x-sampa-underscore-implosive))
 
-;; arch-tag: cf2614cc-ecce-4ef5-ba51-37faeed41691
 ;;; ipa.el ends here