summaryrefslogtreecommitdiff
path: root/leim/quail/persian.el
blob: b6b3146cc8d9117c4ac0514a95c42dfcfdbae147 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
;;; persian.el  --- Quail package for inputting Persian/Farsi keyboard	-*- coding: utf-8;-*-

;; Copyright (C) 2011  Free Software Foundation, Inc.

;; Author: Mohsen BANAN  <libre@mohsen.banan.1.byname.net>
;; http://mohsen.banan.1.byname.net/contact

;; Keywords: multilingual, input method, Farsi, Persian, keyboard

;; This file is part of GNU Emacs.

;; GNU Emacs 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 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs 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 GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

;; This is a Halaal Poly-Existential intended to remain perpetually Halaal.

;;; Commentary:
;;
;; This file contains a collection of input methods for
;; Persian languages - Farsi, Urdu, Pashto (Afghani), ...
;;
;; At this time, the following input methods are specified:
;;
;;  - (farsi) Persian Keyboard based on Islamic Republic of Iran's ISIR-9147
;;  - (farsi-translit) Intuitive transliteration keyboard layout for Persian
;;

;;; Code:

(require 'quail)

;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; farsi
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; The keyboard mapping defined here is based on:
;;
;;   Institute of Standards and Industrial Research of Iran
;;   Information Technology – Layout of Persian Letters and Symbols on Computer Keyboards
;;   ISIRI 9147 -- 1st edition
;;   http://www.isiri.org/UserStd/DownloadStd.aspx?id=9147
;;
;;  Only layers 1 and 2 of ISIRI-9147 are applicable to emacs.
;;
;;  This input method was built using the Farsi table in X Keyboard Configuration Data Base.
;;
;;  0) Selected gnome keyboard "USA"
;;  1) Created a list of all keys
;;  2) Selected gnome keyboard "Iran"
;;  3) For each key just press it and get the mapped persian character
;;


(quail-define-package
 "farsi" "Farsi" " ف" nil "Farsi input method.

Based on ISIRI-9149 Layout of Persian Letters and Symbols on Computer Keyboards.
" nil t t t t nil nil nil nil nil t)

;; +----------------------------------------------------------------+
;; | ۱! | ۲٬ | ۳٫ | ۴﷼ | ۵٪ | ۶× | ۷، | ۸* | ۹) | ۰( | -ـ | =+ | `÷ |
;; +----------------------------------------------------------------+
;;   | ضْ| صٌ| ثٍ| قً| فُ| غِ| عَ| هّ| خ] | ح[ | ج} | چ{ |
;;   +------------------------------------------------------------+
;;    | شؤ | سئ | یي | بإ | لأ | اآ | تة | ن» | م« | ک: | گ؛ | \| |
;;    +-----------------------------------------------------------+
;;      | ظك | طٓ| زژ | رٰ| ذB | دٔ| پء | و> | .< | /؟ |
;;      +-------------------------------------------+

(quail-define-rules
 ("1" ?۱)
 ("2" ?۲)
 ("3" ?۳)
 ("4" ?۴)
 ("5" ?۵)
 ("6" ?۶)
 ("7" ?۷)
 ("8" ?۸)
 ("9" ?۹)
 ("0" ?۰)
 ("-" ?-)
 ("=" ?=)
 ;;("`" ?‍\))  ;; اتصال مجازى
 ("q" ?ض)
 ("w" ?ص)
 ("e" ?ث)
 ("r" ?ق)
 ("t" ?ف)
 ("y" ?غ)
 ("u" ?ع)
 ("i" ?ه)
 ("o" ?خ)
 ("p" ?ح)
 ("[" ?ج)
 ("]" ?چ)
 ("a" ?ش)
 ("s" ?س)
 ("d" ?ی)
 ("f" ?ب)
 ("g" ?ل)
 ("h" ?ا)
 ("j" ?ت)
 ("k" ?ن)
 ("l" ?م)
 (";" ?ک)
 ("'" ?گ)
 ("\\" ?\\)  ;; خط اريب وارو
 ("z" ?ظ)
 ("x" ?ط)
 ("c" ?ز)
 ("v" ?ر)
 ("b" ?ذ)
 ("n" ?د)
 ("m" ?پ)
 ("," ?و)
 ("." ?.)
 ("/" ?/)

 ("!" ?!)
 ("@" ?٬)
 ("#" ?٫)
 ("$" ?﷼)
 ("%" ?٪)
 ("^" ?×)
 ("&" ?،)
 ("*" ?*)
 ("(" ?\))
 (")" ?\()
 ("_" ?ـ)
 ("+" ?+)
 ("~" ?÷)
 ("Q" ?ْ)  ;; ساکن فارسى
 ("W" ?ٌ)  ;; دو پيش فارسى -- تنوين رفع
 ("E" ?ٍ)  ;; دو زير فارسى -- تنوين جر
 ("R" ?ً)  ;; دو زبر فارسى -- تنوين نصب
 ("T" ?ُ)  ;; پيش فارسى -- ضمه
 ("Y" ?ِ)  ;; زير فارسى -- کسره
 ("U" ?َ)  ;; زبر فارسى -- فتحه
 ("I" ?ّ)  ;; تشديد فارسى
 ("O" ?\])
 ("P" ?\[)
 ("{" ?})
 ("}" ?{)
 ("A" ?ؤ)
 ("S" ?ئ)
 ("D" ?ي)
 ("F" ?إ)
 ("G" ?أ)
 ("H" ?آ)
 ("J" ?ة)
 ("K" ?»)
 ("L" ?«)
 (":" ?:)
 ("\"" ?؛)
 ("|" ?|)
 ("Z" ?ك)
 ("X" ?ٓ)
 ("C" ?ژ)
 ("V" ?ٰ)
 ;; ("B" ?‌‌) ;; فاصلهً مجازى
 ("N" ?ٔ)  ;; همزه فارسى بالا
 ("M" ?ء)   ;;  harf farsi hamzeh
 ("<" ?>)
 (">" ?<)
 ("?" ?؟)
  )

;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; farsi-translit
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;;  This is a persian/farsi transliteration keyboard designed
;;;  for people who:
;;;   - Know how to write in farsi
;;;   - Are comfortable with the qwerty keyboard
;;;   - Are familiar with two letter phonetic mapping to persian characters
;;;     (e.g.: gh, kh, ch, sh, zh, hh, lh)
;;;
;;;  This translit keyboard is designed to be intuitive such that
;;;  mapping are easy and natural to remember for a persian writer.
;;;  For some persian characters there are multiple ways of inputting
;;;  the same character.
;;;
;;;  The letter 'h' is used for a number of two character mappings,
;;;  this means that some character sequence inputs need to be repeated
;;;  followed by a backspace followed by the 'h'.
;;;    For example:  سحر = 's' 's' '<bs>' 'h' 'h' 'r'
;;;  In practice such sequences are rare.
;;;



(quail-define-package
 "farsi-translit" "Farsi" "پ" t
 "Intuitive transliteration keyboard layout for persian/farsi.
" nil t t t t nil nil nil nil nil t)


(quail-define-rules
 ("a"  ?ا)
 ("A"  ?آ)  ;; alef madde
 ("b"  ?ب)
 ("p"  ?پ)
 ("t"  ?ت)
 ("c"  ?ث)
 ("j"  ?ج)
 ("ch" ?چ)
 ("hh" ?ح)
 ("kh" ?خ)
 ("d"  ?د)
 ("Z"  ?ذ)
 ("r"  ?ر)
 ("z"  ?ز)
 ("zh" ?ژ)
 ("s"  ?س)
 ("sh" ?ش)
 ("S"  ?ص)
 ("x"  ?ض)
 ("T"  ?ط)
 ("X"  ?ظ)
 ("w"  ?ع)
 ("Q"  ?غ)
 ("f"  ?ف)
 ("q"  ?ق)
 ("gh" ?ق)
 ("k"  ?ک)
 ("K"  ?ك)  ;;  Arabic kaf
 ("g"  ?گ)
 ("l"  ?ل)
 ("lh" ?ﻻ)
 ("m"  ?م)
 ("n"  ?ن)
 ("v"  ?و)
 ("V" ?ؤ)
 ("u"  ?و)
 ("H"  ?ه)
 ("h"  ?ه)
 ("th" ?ة)  ;; ta marbuteh
 ("yh" ?ۀ)  ;; he ye
 ("y"  ?ى)
 ("i"  ?ي)
 ("I" ?ئ)

 ("1"  ?۱)
 ("2"  ?۲)
 ("3"  ?۳)
 ("4"  ?۴)
 ("5"  ?۵)
 ("6"  ?۶)
 ("7"  ?۷)
 ("8"  ?۸)
 ("9"  ?۹)
 ("0"  ?۰)

 ("F" ?إ)
 ("G" ?أ)

 ("~"  ?ّ)  ;; tashdid ;;  تشديد فارسى
 ("`" ?ٓ)
 ("e"  ?ِ)  ;; zir   زير فارسى -- فتحه
 ("E"  ?ٍ)  ;; eizan ;; دو زير فارسى -- تنوين جر
 ("#"  ?ً)  ;; ً tanvin nasb ;; دو زبر فارسى -- تنوين نصب
 ("@" ?ْ)  ;; ساکن فارسى
 ("^"  ?َ)  ;; zbar ;; زبر فارسى -- فتحه
 ("o"  ?ُ)  ;; peesh ;; پيش فارسى -- ضمه
 ("O" ?ٌ)  ;; دو پيش فارسى -- تنوين رفع
 ("?"  ?؟)  ;; alamat soal
 ("&" ?ٔ)  ;; همزه فارسى بالا
 ("$"  ?ء)  ;; hamzeh
 ("%"  ?÷)  ;;
 ("*"  ?×)  ;;
 (";"  ?؛)  ;;
 (",h" ?،)  ;; farsi
 (",h" ?,)  ;; latin
 ("."  ?.)  ;;
 ("_"  ?ـ)  ;;
)


;;; persian.el ends here