1 ;;; persian.el --- Quail package for inputting Persian/Farsi keyboard -*- coding: utf-8;-*-
3 ;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
5 ;; Author: Mohsen BANAN <libre@mohsen.1.banan.byname.net>
6 ;; http://mohsen.1.banan.byname.net/contact
8 ;; Keywords: multilingual, input method, Farsi, Persian, keyboard
10 ;; This file is part of GNU Emacs.
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.
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.
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/>.
25 ;; This is a Halaal Poly-Existential intended to remain perpetually Halaal.
29 ;; This file contains a collection of input methods for
30 ;; Persian languages (Farsi, Urdu, Pashto/Afghanic, ...)
32 ;; At this time, the following input methods are specified:
34 ;; - (farsi-isiri-9149) Persian Keyboard based on Islamic Republic of Iran's ISIR-9147
35 ;; - (farsi-transliterate-banan) An intuitive transliteration keyboard for Farsi
37 ;; Additional documentation for these input methods can be found at:
38 ;; http://www.persoarabic.org/PLPC/120036
46 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
50 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
52 ;; The keyboard mapping defined here is based on:
54 ;; Institute of Standards and Industrial Research of Iran
55 ;; Information Technology – Layout of Persian Letters and Symbols
56 ;; on Computer Keyboards
57 ;; ISIRI 9147 -- 1st edition
58 ;; http://www.isiri.org/UserStd/DownloadStd.aspx?id=9147
60 ;; The specification is also republished at
61 ;; http://www.farsiweb.ir/wiki/Image:Isiri-9147.pdf
62 ;; and various other sites.
64 ;; ISIRI-6219 is also relevant.
66 ;; Layers 1, 2 and 3 of ISIRI-9147 are fully implemented with the
67 ;; exception of the Backslash, Alt-Backslash, Shift-Space and
70 ;; The Backslash key is used to replace کلید با دگر ساز راست -- the Alt or
73 ;; Layer 3 is then entered with the Backslash key and Layer 3 is
74 ;; implemented as two letter keys as specified in ISIRI-9147.
76 ;; The character corresponding to Backslash is entered with Backslash-Backslash.
77 ;; Alt-Backslash has been moved to Backslash-r.
78 ;; Alt-Space has been moved to Backslash-t.
79 ;; Shift-Space has been moved to Backslash-y.
81 ;; With these modifications, farsi-isiri-9147 is a full implementation
82 ;; of ISIRI-9147. Additionally, these modifications allow for this
83 ;; implementation to be ascii input stream based -- in addition to
84 ;; being a keyboard layout.
86 ;; If a key on Layer 1 was reserved to replace دگر ساز راست (the Alt
87 ;; or Meta key), then farsi-isiri-9147 could have claimed full
88 ;; compliance -- without the need for the above description. Perhaps
89 ;; this can be considered a flaw in the base ISIRI-9147 specification
90 ;; to be addressed in the next revision.
95 "farsi-isiri-9147" "Farsi" " ف" nil
"Farsi input method.
97 Based on ISIRI-9147 Layout of Persian Letters and Symbols on Computer Keyboards.
98 " nil t t t t nil nil nil nil nil t
)
100 ;; Note: the rows of keys below are enclosed in Left-To-Right Override
101 ;; embedding, to prevent them from being reordered by the Emacs
105 ;; +----------------------------------------------------------------+
106 ;; | ۱! | ۲٬ | ۳٫ | ۴﷼ | ۵٪ | ۶× | ۷، | ۸* | ۹( | ۰) | -ـ | =+ | `÷ |
107 ;; +----------------------------------------------------------------+
108 ;; | ضْ| صٌ| ثٍ| قً| فُ| غِ| عَ| هّ| خ] | ح[ | ج{ | چ} |
109 ;; +------------------------------------------------------------+
110 ;; | شؤ | سئ | یي | بإ | لأ | اآ | تة | ن« | م» | ک: | گ؛ | \| |
111 ;; +-----------------------------------------------------------+
112 ;; | ظك | طٓ| زژ | رٰ| ذB | دٔ| پء | و< | .> | /؟ |
113 ;; +-------------------------------------------+
128 ("`" ?
\u200D) ;; ZWJ -- ZERO WIDTH JOINER اتصال مجازى
177 ("Q" ?ْ
) ;; ساکن فارسى
178 ("W" ?ٌ
) ;; دو پيش فارسى -- تنوين رفع
179 ("E" ?ٍ
) ;; دو زير فارسى -- تنوين جر
180 ("R" ?ً
) ;; دو زبر فارسى -- تنوين نصب
181 ("T" ?ُ
) ;; پيش فارسى -- ضمه
182 ("Y" ?ِ
) ;; زير فارسى -- کسره
183 ("U" ?َ
) ;; زبر فارسى -- فتحه
184 ("I" ?ّ
) ;; تشديد فارسى
205 ("B" ?
\u200C) ;; ZWNJ -- ZERO WIDTH NON-JOINER فاصلهٔ مجازى
206 ("N" ?ٔ
) ;; همزه فارسى بالا
207 ("M" ?ء
) ;; harf farsi hamzeh
212 ;; Level 3 Entered with \
214 ("\\" ?
\\) ;; خط اريب وارو
232 ("\\r" ?
\u2010) ;; replacement for Alt-BSL
233 ("\\t" ?
\u00A0) ;; replacement for ALT-SPC
234 ("\\y" ?
\u200C) ;; replacement for SHIFT-SPC
262 ;;("\\\\" ?\u2010) ;; Moved to backslash r to leave room for BSL-BSL
266 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
268 ;; farsi-transliterate-banan
270 ;; Given a Qwerty keyboard, use Persian-to-Latin transliteration knowledge
271 ;; to reverse transliterate in persian
273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
275 ;;; See http://www.persoarabic.org/PLPC/120036 document for more complete
276 ;;; documentation of keyboard bindings and usage instructions.
279 ;; ISIRI-9147 Persian keyboard is generally not well suited for Iranian-Expatriates
280 ;; working/living in the West.
282 ;; The qwerty keyboard is usually second nature to Persian speaking expatriates and they
283 ;; don't want to learn/adapt to ISIRI-9147. They expect software to adapt to them.
285 ;; That is what the ``Banan Multi-Character (Reverse) Transliteration Persian Input Method'' does.
287 ;; The typical profile of the user is assumed to be one who:
289 ;; - can write in farsi (not just speak it).
290 ;; - is fully comfortable with a qwerty latin keyboard.
291 ;; - is not familiar with isir-9147 and does not wish to be trained.
292 ;; - communicates and writes in a mixed globish/persian -- not pure persian.
293 ;; - is intuitively familiar with transliteration of farsi/persian into latin based on two letter
294 ;; phonetic mapping to persian characters (e.g., gh ق -- kh خ -- sh ش -- ch چ -- zh ژ.
296 ;; This transliteration keyboard is designed to be intuitive such that
297 ;; mapping are easy and natural to remember for a persian writer.
298 ;; It is designed to be equivalent in capability to farsi-isiri-9147
299 ;; and provide for inputting all characters enumerated in ISIRI-6219.
301 ;; farsi-transliterate-banan is of course phonetic oriented. But it is very different from
302 ;; pinglish. Pinglish is word oriented where you sound out the word with latin letters --
303 ;; including the vowels. farsi-transliterate-banan is letter oriented where you enter the
304 ;; latin letter/letters closest to the persian letter. And usually omit vowels.
306 ;; For some persian characters there are multiple ways of inputting
307 ;; the same character. For example both ``i'' and ``y'' produce ی.
308 ;; For یک ``yk'', ``y'' is more natural and for این ``ain'', ``i'' is more natural.
310 ;; The more frequently used keys are mapped to lower case. The less frequently used letter moves to
311 ;; upper case. For example: ``s'' is س and ``S'' is ص. ``h'' is ح and ``H''
314 ;; Multi-character input is based on \, &, and / prefix
315 ;; characters. The letter 'h' is used as a postfix for the following two character mappings:
316 ;; gh ق -- kh خ -- sh ش -- ch چ -- zh ژ -- Th ة -- Yh ى.
319 ;; Prefix letter \ is used for two character inputs when an alternate form of a letter
320 ;; is desired for example \% is: ÷ when % is: ٪.
322 ;; Prefix letter & is used for multi-character inputs when special characters are
323 ;; desired based on their abbreviate name. For example you can enter ‎ to enter the
324 ;; ``LEFT-TO-RIGHT MARK'' character.
326 ;; Prefix letter / is used to provide two characters. / is: ``ZERO WIDTH NON-JOINER''
329 ;; The letter 'h' is used in a number of two character postfix mappings,
330 ;; for example ``sh'' ش. So if you need the sequence of ``s'' and ``h'' you
331 ;; need to repeat the ``s''. For example: سحر = 's' 's' 'h' 'r'.
335 (quail-define-package
336 "farsi-transliterate-banan" "Farsi" "ب" t
337 "Intuitive transliteration keyboard layout for persian/farsi.
338 " nil t t t t nil nil nil nil nil t
)
342 ;;;;;;;;;;; isiri-6219 Table 5 -- جدول ۵ - حروِفِ اصلیِ فارسی
344 ("A" ?آ
) ;; U+0622 & ARABIC LETTER ALEF WITH MADDA ABOVE & الف با کلاه
345 ("a" ?ا
) ;; U+0627 & ARABIC LETTER ALEF & الف
347 ("b" ?ب
) ;; U+0628 & ARABIC LETTER BEH &
348 ("p" ?پ
) ;; U+067e & ARABIC LETTER PEH &
392 ;;;;;;;;;;; isiri-6219 Table 6 -- جدول ۶ - حروِفِ عربی
394 ("D" ?
\u0671) ;; (ucs-insert #x0671)ٱ named: حرفِ الفِ وصل
395 ("K" ?ك
) ;; Arabic kaf
396 ("Th" ?ة
) ;; ta marbuteh
401 ;;;;;;;;;;; isiri-6219 Table 4 -- جدول ۴ - ارقام و علائم ریاضی
413 ("\\/" ?
\u066B) ;; (ucs-insert #x066B)٫ named: ممیزِ فارسی
414 ("\\," ?
\u066C) ;; (ucs-insert #x066C)٬ named: جداکنندهی هزارهای فارسی
415 ("%" ?
\u066A) ;; (ucs-insert #x066A)٪ named: درصدِ فارسی
416 ("+" ?
\u002B) ;; (ucs-insert #x002B)+ named: علامتِ بهاضافه
417 ("-" ?
\u2212) ;; (ucs-insert #x2212)− named: علامتِ منها
418 ("\\*" ?
\u00D7) ;; (ucs-insert #x00D7)× named: علامتِ ضرب
419 ("\\%" ?
\u007F) ;; (ucs-insert #x00F7)÷ named: علامتِ تقسیم
420 ("<" ?
\u003C) ;; (ucs-insert #x003C)< named: علامتِ کوچکتر
421 ("=" ?
\u003D) ;; (ucs-insert #x003D)= named: علامتِ مساوی
422 (">" ?
\u003E) ;; (ucs-insert #x003E)> named: علامتِ بزرگتر
425 ;;;;;;;;;;; isiri-6219 Table 2 -- جدول ۲ - علائم نقطه گذاریِ مشترک
428 (":" ?
\u003A) ;; (ucs-insert #x003A): named:
429 ("!" ?
\u0021) ;; (ucs-insert #x0021)! named:
430 ("\\." ?
\u2026) ;; (ucs-insert #x2026)… named:
431 ("\\-" ?
\u2010) ;; (ucs-insert #x2010)‐ named:
432 ("-" ?
\u002D) ;; (ucs-insert #x002D)- named:
436 ("*" ?
\u002A) ;; (ucs-insert #x002A)* named:
437 ("(" ?
\u0028) ;; (ucs-insert #x0028)( named:
438 (")" ?
\u0029) ;; (ucs-insert #x0029)) named:
439 ("[" ?
\u005B) ;; (ucs-insert #x005B)[ named:
440 ("[" ?
\u005D) ;; (ucs-insert #x005D)] named:
441 ("{" ?
\u007B) ;; (ucs-insert #x007B){ named:
442 ("}" ?
\u007D) ;; (ucs-insert #x007D)} named:
443 ("\\<" ?
\u00AB) ;; (ucs-insert #x00AB)« named:
444 ("\\>" ?
\u00BB) ;; (ucs-insert #x00BB)» named:
447 ;;;;;;;;;;; isiri-6219 Table 3 -- جدول ۳ - علائم نقطه گذاریِ فارسی
450 ("?" ?؟
) ;; alamat soal
454 ;;;;;;;;;;; isiri-6219 Table 1 -- جدول ۱ - نویسههای کنترلی
457 ("‌" ?
\u200C) ;; (ucs-insert #x200C) named: فاصلهی مجازی
459 ("‍" ?
\u200D) ;; (ucs-insert #x200D) named: اتصالِ مجازی
461 ("‎" ?
\u200E) ;; (ucs-insert #x200E) named: نشانهی چپبهراست
462 ("‏" ?
\u200F) ;; (ucs-insert #x200F) named: نشانهی راستبهچپ
463 ("&ls;" ?
\u2028) ;; (ucs-insert #x2028)
named: جداکنندهی سطرها
464 ("&ps;" ?
\u2028) ;; (ucs-insert #x2029)
named: جداکنندهی بندها
465 ("&lre;" ?
\u202A) ;; (ucs-insert #x202A) named: زیرمتنِ چپبهراست
466 ("&rle;" ?
\u202B) ;; (ucs-insert #x202B) named: زیرمتنِ راستبهچپ
467 ("&pdf;" ?
\u202C) ;; (ucs-insert #x202C) named: پایانِ زیرمتن
468 ("&lro;" ?
\u202D) ;; (ucs-insert #x202D) named: زیرمتنِ اکیداً چپبهراست
469 ("&rlo;" ?
\u202D) ;; (ucs-insert #x202E) named: زیرمتنِ اکیداً راستبهچپ
470 ("&bom;" ?
\uFEFF) ;; (ucs-insert #xFEFF) named: نشانهی ترتیبِ بایتها
473 ;;;;;;;;;;; isiri-6219 Table 7 -- جدول ۷ - نشانههایِ فارسی
474 ("^" ?َ
) ;; zbar ;; زبر فارسى
475 ("e" ?ِ
) ;; zir زير فارسى
476 ("o" ?ُ
) ;; peesh ;; پيش فارسى -- ضمه
477 ("E" ?ٍ
) ;; eizan ;; دو زير فارسى -- تنوين جر
479 ("O" ?ٌ
) ;; دو پيش فارسى -- تنوين رفع
480 ("~" ?ّ
) ;; tashdid ;; تشديد فارسى
481 ("@" ?ْ
) ;; ساکن فارسى
482 ("U" ?
\u0653) ;; (ucs-insert #x0653)ٓ named: مدِ فارسی
483 ("`" ?ٔ
) ;; همزه فارسى بالا
484 ("C" ?
\u0655) ;; (ucs-insert #x0655)ٕ named: همزه فارسى پایین
485 ("$" ?
\u0670) ;; (ucs-insert #x0670)ٰ named: الفِ مقصورهی فارسی
488 ;;;;;;;;;;; isiri-6219 Table 8 - Forbidden Characters -- جدول ۸ - نویسههایِ ممنوع
489 ;; ;; he ye (ucs-insert 1728) kills emacs-24.0.90
493 ;;;;;;; Latin Extensions
494 ("\\" ?
\\) ;; خط اريب وارو
499 ("\\$" ?
\uFDFC) ;; (ucs-insert #xFDFC)﷼ named:
514 ;;; persian.el ends here