1 ;;; persian.el --- Quail package for inputting Persian/Farsi keyboard -*- coding: utf-8;-*-
3 ;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
5 ;; Author: Mohsen BANAN <libre@mohsen.1.banan.byname.net>
6 ;; X-URL: 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/>.
27 ;; This file contains a collection of input methods for
28 ;; Persian languages (Farsi, Urdu, Pashto/Afghanic, ...)
30 ;; At this time, the following input methods are specified:
32 ;; - (farsi-isiri-9149) Persian Keyboard based on Islamic Republic of Iran's ISIRI-9147
33 ;; - (farsi-transliterate-banan) An intuitive transliteration keyboard for Farsi
35 ;; Additional documentation for these input methods can be found at:
36 ;; http://www.persoarabic.org/PLPC/120036
44 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
48 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
50 ;; The keyboard mapping defined here is based on:
51 ;; فنّاوریِ اطلاعات - چیدمان حروف و علائم فارسی بر صفحه کلید رایانه
52 ;; استاندارد ملی ایران ۹۱۴۷ − چاپ اول
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 ;; Published at: http://www.isiri.org/portal/files/std/9147.pdf
59 ;; Re-Published at: http://www.persoarabic.org/Repub/fpf-isiri-9147
62 ;; Specification of Iran's Persian Character Set is also relevant:
63 ;; فنّاوریِ اطلاعات -- تبادل و شیوهی نمایش اطلاعاتِ فارسی بر اساس یونی کُد
64 ;; استاندارد ملی ایران ۶۲۱۹ −− نسخهی نهایی
66 ;; Institute of Standards and Industrial Research of Iran
67 ;; Information Technology – Persian Information Interchange and Display Mechanism, using Unicode
68 ;; ISIRI-6219 Final Version
69 ;; Published at: http://www.isiri.org/portal/files/std/6219.htm
70 ;; Re-Published at: http://www.persoarabic.org/Repub/fpf-isiri-6219
72 ;; Layers 1, 2 and 3 of ISIRI-9147 are fully implemented with the
73 ;; exception of the Backslash, Alt-Backslash, Shift-Space and
76 ;; The Backslash key is used to replace کلید با دگر ساز راست -- the Alt or
79 ;; Layer 3 is then entered with the Backslash key and Layer 3 is
80 ;; implemented as two letter keys as specified in ISIRI-9147.
82 ;; The character corresponding to Backslash is entered with Backslash-Backslash.
83 ;; Alt-Backslash has been moved to Backslash-r.
84 ;; Alt-Space has been moved to Backslash-t.
85 ;; Shift-Space has been moved to Backslash-y.
87 ;; With these modifications, farsi-isiri-9147 is a full implementation
88 ;; of ISIRI-9147. Additionally, these modifications allow for this
89 ;; implementation to be ascii input stream based -- in addition to
90 ;; being a keyboard layout.
92 ;; If a key on Layer 1 was reserved to replace دگر ساز راست (the Alt
93 ;; or Meta key), then farsi-isiri-9147 could have claimed full
94 ;; compliance -- without the need for the above description. Perhaps
95 ;; this can be considered a flaw in the base ISIRI-9147 specification
96 ;; to be addressed in the next revision.
100 (quail-define-package
101 "farsi-isiri-9147" "Persian" " ف" nil
102 "Farsi keyboard based on ISIRI-9147.
103 See http://www.persoarabic.org/PLPC/120036 for additional documentation."
104 nil t t t t nil nil nil nil nil t
)
106 ;; Note: the rows of keys below are enclosed in Left-To-Right Override
107 ;; embedding, to prevent them from being reordered by the Emacs
111 ;; +----------------------------------------------------------------+
112 ;; | ۱! | ۲٬ | ۳٫ | ۴﷼ | ۵٪ | ۶× | ۷، | ۸* | ۹( | ۰) | -ـ | =+ | `÷ |
113 ;; +----------------------------------------------------------------+
114 ;; | ضْ| صٌ| ثٍ| قً| فُ| غِ| عَ| هّ| خ] | ح[ | ج{ | چ} |
115 ;; +------------------------------------------------------------+
116 ;; | شؤ | سئ | یي | بإ | لأ | اآ | تة | ن« | م» | ک: | گ؛ | \| |
117 ;; +-----------------------------------------------------------+
118 ;; | ظك | طٓ| زژ | رٰ| ذB | دٔ| پء | و< | .> | /؟ |
119 ;; +-------------------------------------------+
134 ("`" ?
\u200D) ;; ZWJ -- ZERO WIDTH JOINER اتصال مجازى
183 ("Q" ?ْ
) ;; ساکن فارسى
184 ("W" ?ٌ
) ;; دو پيش فارسى -- تنوين رفع
185 ("E" ?ٍ
) ;; دو زير فارسى -- تنوين جر
186 ("R" ?ً
) ;; دو زبر فارسى -- تنوين نصب
187 ("T" ?ُ
) ;; پيش فارسى -- ضمه
188 ("Y" ?ِ
) ;; زير فارسى -- کسره
189 ("U" ?َ
) ;; زبر فارسى -- فتحه
190 ("I" ?ّ
) ;; تشديد فارسى
211 ("B" ?
\u200C) ;; ZWNJ -- ZERO WIDTH NON-JOINER فاصلهٔ مجازى
212 ("N" ?ٔ
) ;; همزه فارسى بالا
213 ("M" ?ء
) ;; harf farsi hamzeh
218 ;; Level 3 Entered with \
220 ("\\" ?
\\) ;; خط اريب وارو
238 ("\\r" ?
\u2010) ;; replacement for Alt-BSL
239 ("\\t" ?
\u00A0) ;; replacement for ALT-SPC
240 ("\\y" ?
\u200C) ;; replacement for SHIFT-SPC
268 ;;("\\\\" ?\u2010) ;; Moved to backslash r to leave room for BSL-BSL
272 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
274 ;; farsi-transliterate-banan
276 ;; Given a Qwerty keyboard, use Persian-to-Latin transliteration knowledge
277 ;; to reverse transliterate in persian
279 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
281 ;;; See http://www.persoarabic.org/PLPC/120036 document for more complete
282 ;;; documentation of keyboard bindings and usage instructions.
285 ;; ISIRI-9147 Persian keyboard is generally not well suited for Iranian-Expatriates
286 ;; working/living in the West.
288 ;; The qwerty keyboard is usually second nature to Persian speaking expatriates and they
289 ;; don't want to learn/adapt to ISIRI-9147. They expect software to adapt to them.
291 ;; That is what the ``Banan Multi-Character (Reverse) Transliteration Persian Input Method'' does.
293 ;; The typical profile of the user is assumed to be one who:
295 ;; - can write in farsi (not just speak it).
296 ;; - is fully comfortable with a qwerty latin keyboard.
297 ;; - is not familiar with isir-9147 and does not wish to be trained.
298 ;; - communicates and writes in a mixed globish/persian -- not pure persian.
299 ;; - is intuitively familiar with transliteration of farsi/persian into latin based on two letter
300 ;; phonetic mapping to persian characters (e.g., gh ق -- kh خ -- sh ش -- ch چ -- zh ژ.
302 ;; This transliteration keyboard is designed to be intuitive such that
303 ;; mapping are easy and natural to remember for a persian writer.
304 ;; It is designed to be equivalent in capability to farsi-isiri-9147
305 ;; and provide for inputting all characters enumerated in ISIRI-6219.
307 ;; farsi-transliterate-banan is of course phonetic oriented. But it is very different from
308 ;; pinglish. Pinglish is word oriented where you sound out the word with latin letters --
309 ;; including the vowels. farsi-transliterate-banan is letter oriented where you enter the
310 ;; latin letter/letters closest to the persian letter. And usually omit vowels.
312 ;; For some persian characters there are multiple ways of inputting
313 ;; the same character. For example both ``i'' and ``y'' produce ی.
314 ;; For یک ``yk'', ``y'' is more natural and for این ``ain'', ``i'' is more natural.
316 ;; The more frequently used keys are mapped to lower case. The less frequently used letter moves to
317 ;; upper case. For example: ``s'' is س and ``S'' is ص. ``h'' is ه and ``H''
320 ;; Multi-character input is based on \, &, and / prefix
321 ;; characters. The letter 'h' is used as a postfix for the following two character mappings:
322 ;; gh ق -- kh خ -- sh ش -- ch چ -- zh ژ -- Th ة -- Yh ى.
325 ;; Prefix letter \ is used for two character inputs when an alternate form of a letter
326 ;; is desired for example '\-' is: '÷' when '-' is: '-'.
328 ;; Prefix letter & is used for multi-character inputs when special characters are
329 ;; desired based on their abbreviate name. For example you can enter ‎ to enter the
330 ;; ``LEFT-TO-RIGHT MARK'' character.
332 ;; Prefix letter / is used to provide two characters. / is: ``ZERO WIDTH NON-JOINER''
335 ;; The letter 'h' is used in a number of two character postfix mappings,
336 ;; for example ``sh'' ش. So if you need the sequence of ``s'' and ``h'' you
337 ;; need to repeat the ``s''. For example: سهم = 's' 's' 'h' 'm'.
341 (quail-define-package
342 "farsi-transliterate-banan" "Persian" "ب" t
343 "Intuitive transliteration keyboard layout for persian/farsi.
344 See http://www.persoarabic.org/PLPC/120036 for additional documentation."
345 nil t t t t nil nil nil nil nil t
)
349 ;;;;;;;;;;; isiri-6219 Table 5 -- جدول ۵ - حروِفِ اصلیِ فارسی
351 ("A" ?آ
) ;; U+0622 & ARABIC LETTER ALEF WITH MADDA ABOVE & الف با کلاه
352 ("a" ?ا
) ;; U+0627 & ARABIC LETTER ALEF & الف
354 ("b" ?ب
) ;; U+0628 & ARABIC LETTER BEH &
355 ("p" ?پ
) ;; U+067e & ARABIC LETTER PEH &
403 ;;;;;;;;;;; isiri-6219 Table 6 -- جدول ۶ - حروِفِ عربی
405 ("D" ?
\u0671) ;; (ucs-insert #x0671)ٱ named: حرفِ الفِ وصل
406 ("K" ?ك
) ;; Arabic kaf
407 ("Th" ?ة
) ;; ta marbuteh
412 ;;;;;;;;;;; isiri-6219 Table 4 -- جدول ۴ - ارقام و علائم ریاضی
424 ("\\/" ?
\u066B) ;; (ucs-insert #x066B)٫ named: ممیزِ فارسی
425 ("\\," ?
\u066C) ;; (ucs-insert #x066C)٬ named: جداکنندهی هزارهای فارسی
426 ("%" ?
\u066A) ;; (ucs-insert #x066A)٪ named: درصدِ فارسی
427 ("+" ?
\u002B) ;; (ucs-insert #x002B)+ named: علامتِ بهاضافه
428 ("-" ?
\u2212) ;; (ucs-insert #x2212)− named: علامتِ منها
429 ("\\*" ?
\u00D7) ;; (ucs-insert #x00D7)× named: علامتِ ضرب
430 ("\\-" ?
\u00F7) ;; (ucs-insert #x00F7)÷ named: علامتِ تقسیم
431 ("<" ?
\u003C) ;; (ucs-insert #x003C)< named: علامتِ کوچکتر
432 ("=" ?
\u003D) ;; (ucs-insert #x003D)= named: علامتِ مساوی
433 (">" ?
\u003E) ;; (ucs-insert #x003E)> named: علامتِ بزرگتر
436 ;;;;;;;;;;; isiri-6219 Table 2 -- جدول ۲ - علائم نقطه گذاریِ مشترک
439 (":" ?
\u003A) ;; (ucs-insert #x003A): named:
440 ("!" ?
\u0021) ;; (ucs-insert #x0021)! named:
441 ("\\." ?
\u2026) ;; (ucs-insert #x2026)… named:
442 ("\\-" ?
\u2010) ;; (ucs-insert #x2010)‐ named:
443 ("-" ?
\u002D) ;; (ucs-insert #x002D)- named:
447 ("*" ?
\u002A) ;; (ucs-insert #x002A)* named:
448 ("(" ?
\u0028) ;; (ucs-insert #x0028)( named:
449 (")" ?
\u0029) ;; (ucs-insert #x0029)) named:
450 ("[" ?
\u005B) ;; (ucs-insert #x005B)[ named:
451 ("[" ?
\u005D) ;; (ucs-insert #x005D)] named:
452 ("{" ?
\u007B) ;; (ucs-insert #x007B){ named:
453 ("}" ?
\u007D) ;; (ucs-insert #x007D)} named:
454 ("\\<" ?
\u00AB) ;; (ucs-insert #x00AB)« named:
455 ("\\>" ?
\u00BB) ;; (ucs-insert #x00BB)» named:
456 ("N" ?
\u00AB) ;; (ucs-insert #x00AB)« named:
457 ("M" ?
\u00BB) ;; (ucs-insert #x00BB)» named:
459 ;;;;;;;;;;; isiri-6219 Table 3 -- جدول ۳ - علائم نقطه گذاریِ فارسی
462 ("?" ?؟
) ;; alamat soal
466 ;;;;;;;;;;; isiri-6219 Table 1 -- جدول ۱ - نویسههای کنترلی
469 ("‌" ?
\u200C) ;; (ucs-insert #x200C) named: فاصلهی مجازی
471 ("‍" ?
\u200D) ;; (ucs-insert #x200D) named: اتصالِ مجازی
473 ("‎" ?
\u200E) ;; (ucs-insert #x200E) named: نشانهی چپبهراست
474 ("‏" ?
\u200F) ;; (ucs-insert #x200F) named: نشانهی راستبهچپ
475 ("&ls;" ?
\u2028) ;; (ucs-insert #x2028)
named: جداکنندهی سطرها
476 ("&ps;" ?
\u2028) ;; (ucs-insert #x2029)
named: جداکنندهی بندها
477 ("&lre;" ?
\u202A) ;; (ucs-insert #x202A) named: زیرمتنِ چپبهراست
478 ("&rle;" ?
\u202B) ;; (ucs-insert #x202B) named: زیرمتنِ راستبهچپ
479 ("&pdf;" ?
\u202C) ;; (ucs-insert #x202C) named: پایانِ زیرمتن
480 ("&lro;" ?
\u202D) ;; (ucs-insert #x202D) named: زیرمتنِ اکیداً چپبهراست
481 ("&rlo;" ?
\u202D) ;; (ucs-insert #x202E) named: زیرمتنِ اکیداً راستبهچپ
482 ("&bom;" ?
\uFEFF) ;; (ucs-insert #xFEFF) named: نشانهی ترتیبِ بایتها
485 ;;;;;;;;;;; isiri-6219 Table 7 -- جدول ۷ - نشانههایِ فارسی
486 ("^" ?َ
) ;; zbar ;; زبر فارسى
487 ("e" ?ِ
) ;; zir زير فارسى
488 ("o" ?ُ
) ;; peesh ;; پيش فارسى -- ضمه
489 ("E" ?ٍ
) ;; eizan ;; دو زير فارسى -- تنوين جر
491 ("O" ?ٌ
) ;; دو پيش فارسى -- تنوين رفع
492 ("~" ?ّ
) ;; tashdid ;; تشديد فارسى
493 ("@" ?ْ
) ;; ساکن فارسى
494 ("U" ?
\u0653) ;; (ucs-insert #x0653)ٓ named: مدِ فارسی
495 ("`" ?ٔ
) ;; همزه فارسى بالا
496 ("C" ?
\u0655) ;; (ucs-insert #x0655)ٕ named: همزه فارسى پایین
497 ("$" ?
\u0670) ;; (ucs-insert #x0670)ٰ named: الفِ مقصورهی فارسی
500 ;;;;;;;;;;; isiri-6219 Table 8 - Forbidden Characters -- جدول ۸ - نویسههایِ ممنوع
501 ;; ;; he ye (ucs-insert 1728) (ucs-insert #x06c0) kills emacs-24.0.90
505 ;;;;;;; Latin Extensions
506 ("\\" ?
\\) ;; خط اريب وارو
511 ("\\$" ?
\uFDFC) ;; (ucs-insert #xFDFC)﷼ named:
526 ;;; persian.el ends here