Commit | Line | Data |
---|---|---|
edfb8eb9 MB |
1 | ;;; persian.el --- Quail package for inputting Persian/Farsi keyboard -*- coding: utf-8;-*- |
2 | ||
acaf905b | 3 | ;; Copyright (C) 2011-2012 Free Software Foundation, Inc. |
edfb8eb9 MB |
4 | |
5 | ;; Author: Mohsen BANAN <libre@mohsen.banan.1.byname.net> | |
6 | ;; http://mohsen.banan.1.byname.net/contact | |
7 | ||
8 | ;; Keywords: multilingual, input method, Farsi, Persian, keyboard | |
9 | ||
10 | ;; This file is part of GNU Emacs. | |
11 | ||
12 | ;; GNU Emacs is free software: you can redistribute it and/or modify | |
13 | ;; it under the terms of the GNU General Public License as published by | |
14 | ;; the Free Software Foundation, either version 3 of the License, or | |
15 | ;; (at your option) any later version. | |
16 | ||
17 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;; GNU General Public License for more details. | |
21 | ||
22 | ;; You should have received a copy of the GNU General Public License | |
23 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
25 | ;; This is a Halaal Poly-Existential intended to remain perpetually Halaal. | |
26 | ||
27 | ;;; Commentary: | |
28 | ;; | |
29 | ;; This file contains a collection of input methods for | |
a87ef899 | 30 | ;; Persian languages - Farsi, Urdu, Pashto (Afghani), ... |
edfb8eb9 MB |
31 | ;; |
32 | ;; At this time, the following input methods are specified: | |
33 | ;; | |
34 | ;; - (farsi) Persian Keyboard based on Islamic Republic of Iran's ISIR-9147 | |
35 | ;; - (farsi-translit) Intuitive transliteration keyboard layout for Persian | |
36 | ;; | |
37 | ||
38 | ;;; Code: | |
39 | ||
40 | (require 'quail) | |
41 | ||
42 | ;; | |
43 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
44 | ;; | |
45 | ;; farsi | |
46 | ;; | |
47 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
48 | ;; | |
49 | ;; The keyboard mapping defined here is based on: | |
50 | ;; | |
51 | ;; Institute of Standards and Industrial Research of Iran | |
52 | ;; Information Technology – Layout of Persian Letters and Symbols on Computer Keyboards | |
53 | ;; ISIRI 9147 -- 1st edition | |
54 | ;; http://www.isiri.org/UserStd/DownloadStd.aspx?id=9147 | |
55 | ;; | |
56 | ;; Only layers 1 and 2 of ISIRI-9147 are applicable to emacs. | |
57 | ;; | |
58 | ;; This input method was built using the Farsi table in X Keyboard Configuration Data Base. | |
59 | ;; | |
60 | ;; 0) Selected gnome keyboard "USA" | |
61 | ;; 1) Created a list of all keys | |
62 | ;; 2) Selected gnome keyboard "Iran" | |
63 | ;; 3) For each key just press it and get the mapped persian character | |
64 | ;; | |
65 | ||
66 | ||
67 | (quail-define-package | |
68 | "farsi" "Farsi" " ف" nil "Farsi input method. | |
69 | ||
70 | Based on ISIRI-9149 Layout of Persian Letters and Symbols on Computer Keyboards. | |
71 | " nil t t t t nil nil nil nil nil t) | |
72 | ||
73 | ;; +----------------------------------------------------------------+ | |
74 | ;; | ۱! | ۲٬ | ۳٫ | ۴﷼ | ۵٪ | ۶× | ۷، | ۸* | ۹) | ۰( | -ـ | =+ | `÷ | | |
75 | ;; +----------------------------------------------------------------+ | |
76 | ;; | ضْ| صٌ| ثٍ| قً| فُ| غِ| عَ| هّ| خ] | ح[ | ج} | چ{ | | |
77 | ;; +------------------------------------------------------------+ | |
78 | ;; | شؤ | سئ | یي | بإ | لأ | اآ | تة | ن» | م« | ک: | گ؛ | \| | | |
79 | ;; +-----------------------------------------------------------+ | |
80 | ;; | ظك | طٓ| زژ | رٰ| ذB | دٔ| پء | و> | .< | /؟ | | |
81 | ;; +-------------------------------------------+ | |
82 | ||
83 | (quail-define-rules | |
84 | ("1" ?۱) | |
85 | ("2" ?۲) | |
86 | ("3" ?۳) | |
87 | ("4" ?۴) | |
88 | ("5" ?۵) | |
89 | ("6" ?۶) | |
90 | ("7" ?۷) | |
91 | ("8" ?۸) | |
92 | ("9" ?۹) | |
93 | ("0" ?۰) | |
94 | ("-" ?-) | |
95 | ("=" ?=) | |
96 | ;;("`" ?\)) ;; اتصال مجازى | |
97 | ("q" ?ض) | |
98 | ("w" ?ص) | |
99 | ("e" ?ث) | |
100 | ("r" ?ق) | |
101 | ("t" ?ف) | |
102 | ("y" ?غ) | |
103 | ("u" ?ع) | |
104 | ("i" ?ه) | |
105 | ("o" ?خ) | |
106 | ("p" ?ح) | |
107 | ("[" ?ج) | |
108 | ("]" ?چ) | |
109 | ("a" ?ش) | |
110 | ("s" ?س) | |
111 | ("d" ?ی) | |
112 | ("f" ?ب) | |
113 | ("g" ?ل) | |
114 | ("h" ?ا) | |
115 | ("j" ?ت) | |
116 | ("k" ?ن) | |
117 | ("l" ?م) | |
118 | (";" ?ک) | |
119 | ("'" ?گ) | |
120 | ("\\" ?\\) ;; خط اريب وارو | |
121 | ("z" ?ظ) | |
122 | ("x" ?ط) | |
123 | ("c" ?ز) | |
124 | ("v" ?ر) | |
125 | ("b" ?ذ) | |
126 | ("n" ?د) | |
127 | ("m" ?پ) | |
128 | ("," ?و) | |
129 | ("." ?.) | |
130 | ("/" ?/) | |
131 | ||
132 | ("!" ?!) | |
133 | ("@" ?٬) | |
134 | ("#" ?٫) | |
135 | ("$" ?﷼) | |
136 | ("%" ?٪) | |
137 | ("^" ?×) | |
138 | ("&" ?،) | |
139 | ("*" ?*) | |
140 | ("(" ?\)) | |
141 | (")" ?\() | |
142 | ("_" ?ـ) | |
143 | ("+" ?+) | |
144 | ("~" ?÷) | |
145 | ("Q" ?ْ) ;; ساکن فارسى | |
146 | ("W" ?ٌ) ;; دو پيش فارسى -- تنوين رفع | |
147 | ("E" ?ٍ) ;; دو زير فارسى -- تنوين جر | |
148 | ("R" ?ً) ;; دو زبر فارسى -- تنوين نصب | |
149 | ("T" ?ُ) ;; پيش فارسى -- ضمه | |
150 | ("Y" ?ِ) ;; زير فارسى -- کسره | |
151 | ("U" ?َ) ;; زبر فارسى -- فتحه | |
152 | ("I" ?ّ) ;; تشديد فارسى | |
153 | ("O" ?\]) | |
154 | ("P" ?\[) | |
155 | ("{" ?}) | |
156 | ("}" ?{) | |
157 | ("A" ?ؤ) | |
158 | ("S" ?ئ) | |
159 | ("D" ?ي) | |
160 | ("F" ?إ) | |
161 | ("G" ?أ) | |
162 | ("H" ?آ) | |
163 | ("J" ?ة) | |
164 | ("K" ?») | |
165 | ("L" ?«) | |
166 | (":" ?:) | |
167 | ("\"" ?؛) | |
168 | ("|" ?|) | |
169 | ("Z" ?ك) | |
170 | ("X" ?ٓ) | |
171 | ("C" ?ژ) | |
172 | ("V" ?ٰ) | |
173 | ;; ("B" ?) ;; فاصلهً مجازى | |
174 | ("N" ?ٔ) ;; همزه فارسى بالا | |
175 | ("M" ?ء) ;; harf farsi hamzeh | |
176 | ("<" ?>) | |
177 | (">" ?<) | |
178 | ("?" ?؟) | |
179 | ) | |
180 | ||
181 | ;; | |
182 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
183 | ;; | |
184 | ;; farsi-translit | |
185 | ;; | |
186 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
187 | ;;; | |
188 | ;;; This is a persian/farsi transliteration keyboard designed | |
189 | ;;; for people who: | |
190 | ;;; - Know how to write in farsi | |
191 | ;;; - Are comfortable with the qwerty keyboard | |
192 | ;;; - Are familiar with two letter phonetic mapping to persian characters | |
193 | ;;; (e.g.: gh, kh, ch, sh, zh, hh, lh) | |
194 | ;;; | |
195 | ;;; This translit keyboard is designed to be intuitive such that | |
196 | ;;; mapping are easy and natural to remember for a persian writer. | |
fa463103 | 197 | ;;; For some persian characters there are multiple ways of inputting |
edfb8eb9 MB |
198 | ;;; the same character. |
199 | ;;; | |
200 | ;;; The letter 'h' is used for a number of two character mappings, | |
fa463103 | 201 | ;;; this means that some character sequence inputs need to be repeated |
edfb8eb9 MB |
202 | ;;; followed by a backspace followed by the 'h'. |
203 | ;;; For example: سحر = 's' 's' '<bs>' 'h' 'h' 'r' | |
204 | ;;; In practice such sequences are rare. | |
205 | ;;; | |
206 | ||
207 | ||
208 | ||
209 | (quail-define-package | |
210 | "farsi-translit" "Farsi" "پ" t | |
211 | "Intuitive transliteration keyboard layout for persian/farsi. | |
212 | " nil t t t t nil nil nil nil nil t) | |
213 | ||
214 | ||
215 | (quail-define-rules | |
216 | ("a" ?ا) | |
217 | ("A" ?آ) ;; alef madde | |
218 | ("b" ?ب) | |
219 | ("p" ?پ) | |
220 | ("t" ?ت) | |
221 | ("c" ?ث) | |
222 | ("j" ?ج) | |
223 | ("ch" ?چ) | |
224 | ("hh" ?ح) | |
225 | ("kh" ?خ) | |
226 | ("d" ?د) | |
227 | ("Z" ?ذ) | |
228 | ("r" ?ر) | |
229 | ("z" ?ز) | |
230 | ("zh" ?ژ) | |
231 | ("s" ?س) | |
232 | ("sh" ?ش) | |
233 | ("S" ?ص) | |
234 | ("x" ?ض) | |
235 | ("T" ?ط) | |
236 | ("X" ?ظ) | |
237 | ("w" ?ع) | |
238 | ("Q" ?غ) | |
239 | ("f" ?ف) | |
240 | ("q" ?ق) | |
241 | ("gh" ?ق) | |
242 | ("k" ?ک) | |
243 | ("K" ?ك) ;; Arabic kaf | |
244 | ("g" ?گ) | |
245 | ("l" ?ل) | |
246 | ("lh" ?ﻻ) | |
247 | ("m" ?م) | |
248 | ("n" ?ن) | |
249 | ("v" ?و) | |
250 | ("V" ?ؤ) | |
251 | ("u" ?و) | |
252 | ("H" ?ه) | |
253 | ("h" ?ه) | |
254 | ("th" ?ة) ;; ta marbuteh | |
255 | ("yh" ?ۀ) ;; he ye | |
256 | ("y" ?ى) | |
257 | ("i" ?ي) | |
258 | ("I" ?ئ) | |
259 | ||
260 | ("1" ?۱) | |
261 | ("2" ?۲) | |
262 | ("3" ?۳) | |
263 | ("4" ?۴) | |
264 | ("5" ?۵) | |
265 | ("6" ?۶) | |
266 | ("7" ?۷) | |
267 | ("8" ?۸) | |
268 | ("9" ?۹) | |
269 | ("0" ?۰) | |
270 | ||
271 | ("F" ?إ) | |
272 | ("G" ?أ) | |
273 | ||
274 | ("~" ?ّ) ;; tashdid ;; تشديد فارسى | |
275 | ("`" ?ٓ) | |
276 | ("e" ?ِ) ;; zir زير فارسى -- فتحه | |
277 | ("E" ?ٍ) ;; eizan ;; دو زير فارسى -- تنوين جر | |
278 | ("#" ?ً) ;; ً tanvin nasb ;; دو زبر فارسى -- تنوين نصب | |
279 | ("@" ?ْ) ;; ساکن فارسى | |
280 | ("^" ?َ) ;; zbar ;; زبر فارسى -- فتحه | |
281 | ("o" ?ُ) ;; peesh ;; پيش فارسى -- ضمه | |
282 | ("O" ?ٌ) ;; دو پيش فارسى -- تنوين رفع | |
283 | ("?" ?؟) ;; alamat soal | |
284 | ("&" ?ٔ) ;; همزه فارسى بالا | |
285 | ("$" ?ء) ;; hamzeh | |
286 | ("%" ?÷) ;; | |
287 | ("*" ?×) ;; | |
288 | (";" ?؛) ;; | |
289 | (",h" ?،) ;; farsi | |
290 | (",h" ?,) ;; latin | |
291 | ("." ?.) ;; | |
292 | ("_" ?ـ) ;; | |
293 | ) | |
294 | ||
295 | ||
296 | ;;; persian.el ends here |