;; latn1-pre.mim -- Latin input method simulating "US International Keyboard"
;; Copyright (C) 2014  Florêncio Neves  <florencioneves@gmail.com>

;; This file is part of the m17n database, a sub-part of the m17n library.

;; The m17n library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.

;; The m17n library is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with the m17n library; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Input method for Latin script with prefix modifiers and AltGr combinations.

;; | mark       | prefix | examples
;; |------------+--------+----------
;; | acute      |   '    | 'a -> á
;; | grave      |   `    | `a -> à
;; | circumflex |   ^    | ^a -> â
;; | diaeresis  |   "    | "a -> ä
;; | tilde      |   ~    | ~a -> ã
;; | cedilla    |   '    | 'c -> ç
;; | symbol     |        | AltGr-/ -> ¿  AltGr-5 ~> €
;; | symbol     |        | AltGr-z -> æ  AltGr-s -> ß

(input-method t latn1-pre)

(description
 "Latin1 input method simulating \"US International Keyboard\"
which uses prefix modifiers and AltGr combinations as this:
 | mark       | prefix | examples
 |------------+--------+----------
 | acute      |   '    | 'a -> á
 | grave      |   `    | `a -> à
 | circumflex |   ^    | ^a -> â
 | diaeresis  |   \"    | \"a -> ä
 | tilde      |   ~    | ~a -> ã
 | cedilla    |   '    | 'c -> ç
 | symbol     |        | AltGr-/ -> ¿,  AltGr-z -> æ,  AltGr-s -> ß

For Western European languages, these characters are supported too:
   \"Y -> Ÿ, AltGr-x -> œ, AltGr-X -> Œ, AltGr-5 -> €,
  AltGr-{ -> ª, AltGr-} ?º, AltGr-( -> “, AltGr-) -> ”")

(title "latin1")

(map
 (us-international-keyboard
  ;; Dead keys
  ("' " ?')
  ("'A" ?Á)
  ("'E" ?É)
  ("'I" ?Í)
  ("'O" ?Ó)
  ("'U" ?Ú)
  ("'Y" ?Ý)
  ("'C" ?Ç)
  ("'a" ?á)
  ("'e" ?é)
  ("'i" ?í)
  ("'o" ?ó)
  ("'u" ?ú)
  ("'y" ?ý)
  ("'c" ?ç)
  ("\" " ?\")
  ("\"A" ?Ä)
  ("\"E" ?Ë)
  ("\"I" ?Ï)
  ("\"O" ?Ö)
  ("\"U" ?Ü)
  ("\"a" ?ä)
  ("\"e" ?ë)
  ("\"i" ?ï)
  ("\"o" ?ö)
  ("\"u" ?ü)
  ("\"y" ?ÿ)
  ("^ " ?^)
  ("^A" ?Â)
  ("^E" ?Ê)
  ("^I" ?Î)
  ("^O" ?Ô)
  ("^U" ?Û)
  ("^a" ?â)
  ("^e" ?ê)
  ("^i" ?î)
  ("^o" ?ô)
  ("^u" ?û)
  ("` " ?`)
  ("`A" ?À)
  ("`E" ?È)
  ("`I" ?Ì)
  ("`O" ?Ò)
  ("`U" ?Ù)
  ("`a" ?à)
  ("`e" ?è)
  ("`i" ?ì)
  ("`o" ?ò)
  ("`u" ?ù)
  ("~ " ?~)
  ("~A" ?Ã)
  ("~N" ?Ñ)
  ("~O" ?Õ)
  ("~a" ?ã)
  ("~n" ?ñ)
  ("~o" ?õ)

  ;; AltGr combinations
  ((G-1) ?¡)
  ((G-2) ?²)
  ((G-3) ?³)
  ((G-4) ?¤)
  ((G-6) ?¼)
  ((G-7) ?½)
  ((G-8) ?¾)     
  ((G-9) ?‘)
  ((G-0) ?’)
  ((G--) ?¥)
  ((G-=) ?×)
  ((G-!) ?¹)
  ((G-$) ?£)
  ((G-+) ?÷)
  ((G-q) ?ä)
  ((G-w) ?å)
  ((G-e) ?é)
  ((G-r) ?®)
  ((G-t) ?þ)
  ((G-y) ?ü)
  ((G-u) ?ú)
  ((G-i) ?í)
  ((G-o) ?ó)
  ((G-p) ?ö)
  ((G-\[) ?«)
  ((G-\]) ?»)
  ((G-a) ?á)
  ((G-s) ?ß)
  ((G-d) ?ð)
  ((G-l) ?ø)
  ((G-\;) ?¶)
  ((G-\') ?´)
  ((G-\\) ?¬)
  ((G-z) ?æ)
  ((G-c) ?©)
  ((G-n) ?ñ)
  ((G-m) ?µ)
  ((G-,) ?ç)
  ((G-/) ?¿)
  ((G-Q) ?Ä)
  ((G-W) ?Å)
  ((G-E) ?É)
  ((G-T) ?Þ)
  ((G-Y) ?Ü)
  ((G-U) ?Ú)
  ((G-I) ?Í)
  ((G-O) ?Ó)
  ((G-P) ?Ö)
  ((G-A) ?Á)
  ((G-S) ?§)
  ((G-D) ?Ð)
  ((G-L) ?Ø)
  ((G-:) ?°)
  ((G-\") ?¨)
  ((G-|) ?¦)
  ((G-Z) ?Æ)
  ((G-C) ?¢)
  ((G-N) ?Ñ)
  ((G-<) ?Ç))

 (extra
  ;; Not in "US International Keyboard, but needed in some Western
  ;; European languages.
  ("\"Y" ?Ÿ)
  ((G-x) ?œ)
  ((G-X) ?Œ)
  ((G-5) ?€)
  ((G-{) ?ª)
  ((G-}) ?º)
  ((G-\() ?“)
  ((G-\)) ?”)
  ))

(state
  (init
   (us-international-keyboard)
   (extra)))

;; Local Variables:
;; coding: utf-8
;; mode: emacs-lisp
;; End:
