# liblouis: Arabic Grade 1 table without math character definitions

# Based on the official Unified Arabic Braille Project website
# <https://mip.qa/braille>: a comprehensive resource containing all
# details about Arabic braille, including complete references,
# tutorials and awareness articles. It also provides a platform for
# suggestions and comments to improve Arabic braille further.

# This table was originally built by Leon Ungier
# <Leon.Ungier@ViewPlus.com> with help and guidance from Mohammed
# R. Ramadan <mramadan@nattiq.com>, and improved over the years.

# Copyright (C) 1995-2004 by The BRLTTY Team. 
# Copyright (C) 2004 by ViewPlus Technologies, Inc.,  www.viewplustech.com
# Copyright (C) 2004 by Computers to Help People, Inc., www.chpi.org  
# Copyright (C) 2011-2012 by Mesar Hameed <mesar.hameed@gmail.com>
# Copyright (C) 2018,2020 by Ikrami Ahmad <ikrami.ahmad@gmail.com>
# Copyright (C) 2020 Mada, Qatar Assistive Technology Center <Braille@mada.org.qa>

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

# This file 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
# Lesser General Public License for more details.

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

include text_nabcc.dis All display opcodes
include spaces.uti
include braille-patterns.cti # unicode braille.

# Arabic characters
letter ء 3 # arabic individual hamza (\x0621)
letter آ 345 # arabic alef madd (\x0622)
letter أ 34 # arabic hamza above alef (\x0623)
letter ؤ 1256 # arabic hamza on waw (\x0624)
letter إ 46 # arabic hamza below alef (\x0625)
letter ئ 13456 # arabic hamza on iaa (\x0626)
letter ا 1 # arabic Alef (\x0626)
letter ب 12 # arabic baa (\x0628)
letter ة 16 # arabic taa marbuta (\x0629)
letter ث 1456 # arabic thaa (\x062B)
letter ت 2345 # arabic Taa (\x062A)
letter ج 245 # arabic jeem (\x062C)
letter ح 156 # arabic strong haa (\x062D)
letter خ 1346 # arabic Khaa (\x062E)
letter د 145 # arabic dal (\x062F)
letter ذ 2346 # arabic thal (\x0630)
letter ر 1235 # arabic raa (\x0631)
letter ز 1356 # arabic zaai (\x0632)
letter س 234 # arabic seen (\x0633)
letter ش 146 # arabic sheen (\x0634)
letter ص 12346 # arabic saad (\x0635)
letter ض 1246 # arabic dhaad (\x0636)
letter ط 23456 # arabic strong taa (\x0637)
letter ظ 123456 # arabic strong thaa (\x0638)
letter ع 12356 # arabic ayn (\x0639)
letter غ 126 # arabic ghayn (\x063A)
letter ف 124 # arabic faa (\x0641)
letter ق 12345 # arabic strong qaaf (\x0642)
letter ك 13 # arabic kaaf (\x0643)
letter ل 123 # arabic laam (\x0644)
letter م 134 # arabic meem (\x0645)
letter ن 1345 # arabic noon (\x0646)
letter ه 125 # arabic soft haa (\x0647)
letter و 2456 # arabic waaw (\x0648)
letter ى 135 # arabic alef maqsoora (\x0649)
letter ي 24 # arabic iaa (\x064A)
letter َ 2 # arabic diacritic symbol fathah (\x064E)
letter ِ 15 # arabic diacritic symbol kasrah (\x0650)
letter ً 23 # arabic diacritic symbol tanween fath (\x064B)
letter ٌ 26 # arabic diacritic symbol tanween dham (\x064C)
letter ٍ 35 # arabic diacritic symbol tanween kasr (\x064D)
letter ُ 136 # arabic diacritic symbol dhamma (\x064F)
letter ّ 6 # arabic diacritic symbol shadda (\x0651)
letter ْ 25 # arabic diacritic symbol sukoon (\x0652)
#additional forms
letter \x067E 12 #Arabic letter Peh
letter \x0686 245 # arabic letter gtcheh چ
letter \x06a4 124 # arabic letter Veh ڤ
letter \x06af 13 # arabic letter gaf گ

noback sign ـ 25-25 # arabic tatweel (\x0640)

always \x0644\x0627 1236 # to join lam and alef together in one cell if they come in one word
midendword \x0651 6 # to indicate that Shadda can never come at the beginning of a word
midendword \x0652 25 # arabic diacritic symbol sukoon (\x0652)
midendword َ 2

#the following to correct Shadda symbol, which should be written before the character in Arabic braille code. this will consists of every arabic character followed by the Shadda diacritic symbol, and a dot pattern of the braille shadda followed by the character.
noback always ءّ 6-3
noback always آّ 6-345
noback always أّ 6-34
noback always ؤّ 6-1256
noback always إّ 6-46
noback always ئّ 6-13456
noback always اّ 6-1
noback always بّ 6-12
noback always ةّ 6-16
noback always ثّ 6-1456
noback always تّ 6-2345
noback always جّ 6-245
noback always حّ 6-156
noback always خّ 6-1346
noback always دّ 6-145
noback always ذّ 6-2346
noback always رّ 6-1235
noback always زّ 6-1356
noback always سّ 6-234
noback always شّ 6-146
noback always صّ 6-12346
noback always ضّ 6-1246
noback always طّ 6-23456
noback always ظّ 6-123456
noback always عّ 6-12356
noback always غّ 6-126
noback always فّ 6-124
noback always قّ 6-12345
noback always كّ 6-13
noback always لّ 6-123
noback always مّ 6-134
noback always نّ 6-1345
noback always هّ 6-125
noback always وّ 6-2456
noback always يّ 6-24
noback always لاّ 6-1236

punctuation ، 5 # Arabic comma (\x060C)
# Arabic semi-colon: in the old standard it was dots 56; had to be changed to make way for the implementation of the
# grade 1 indicator.
punctuation \x061B 5-23
noback punctuation ; 5-23
punctuation : 5-2
punctuation \x061F 236 # Arabic question mark ؟
noback punctuation ? 236
punctuation \x06D4 256 # Arabic Full stop
punctuation . 256
noback punctuation , 2
punctuation ! 235
punctuation " 2356
# number sign: the old standard mapped it to 3456, but had to be changed in order to distinguish other uses beside
# preceding numbers.
sign # 456-35
# dollar sign: in the old standard it is mapped to dots 12456 but this would conflict with the contraction هم in grade 2.
sign $ 4-256
punctuation % 25-1234
sign & 4-12346
noback punctuation ' 3 # apostrophe
punctuation ) 356
punctuation ( 236
sign * 56-35
math + 56-235
punctuation - 36-36
nofor punctuation - 36-0
# forward slash: originally mapped to dots 34; had to be changed so that it does not conflict with the letter \x0623
# (arabic hamza above alef)
math / 456-36

# Arabic numbers
digit \x0660 245 # 0 (٠)
digit \x0661 1 # 1 (١)
digit \x0662 12 # 2 (٢)
digit \x0663 14 # 3 (٣)
digit \x0664 145 # 4 (٤)
digit \x0665 15 # 5 (٥)
digit \x0666 124 # 6 (٦)
digit \x0667 1245 # 7 (٧)
digit \x0668 125 # 8 (٨)
digit \x0669 24 # 9 (٩)
litdigit \x0660 245 # 0 (٠)
litdigit \x0661 1 # 1 (١)
litdigit \x0662 12 # 2 (٢)
litdigit \x0663 14 # 3 (٣)
litdigit \x0664 145 # 4 (٤)
litdigit \x0665 15 # 5 (٥)
litdigit \x0666 124 # 6 (٦)
litdigit \x0667 1245 # 7 (٧)
litdigit \x0668 125 # 8 (٨)
litdigit \x0669 24 # 9 (٩)

# Latin numbers
include loweredDigits6Dots.uti
include litdigits6Dots.uti

# less than sign: the old standard mapped it to dots 246, which conflicted with a contraction in grade 2
math < 45-26
math = 56-2356 
# greater than sign: the old standard mapped it to dots 135, which conflicted with a character and a contraction
math > 45-35
# at sign: the old standard used dot 4; it was changed to match the UEB representation, in order to make it readable
# also in grade 2
sign @ 4-1

include latinLetterDef6Dots.uti
punctuation [ 6-236
sign \\ 45-36 # not mentioned in the Unified arabic braille code.
punctuation ] 356-3 
# caret sign: changed to match the UEB representation because dots 346 is used as a prefix for many math symbols
sign ^ 4-26
sign _ 6-36 # underscore
noback sign ` 4 # grave accent
punctuation { 5-236
# vertical bar: changed so that it can not be confused with latin letter g or the contraction of the word كان
sign | 456-25
punctuation } 356-2
# tilde: the old standard mapped it to dots 45; had to be changed so that it can be read in grade 2 context
math ~ 45-25

punctuation \x00Ad 36-36 # soft hyphen

sign \x00AB 6-2356 # LEFT-POINTING DOUBLE ANGLE QUOTATION
sign \x00BB 2356-3 # RIGHT-POINTING DOUBLE ANGLE QUOTATION
noback punctuation \x2018 3 # smart single left quotation mark
noback punctuation \x2019 3 # smart single right quotation mark
punctuation \x201C 2356 # smart opening double quote
punctuation \x201D 2356 # smart closing double quote
punctuation \x201E 2356 # smart double low quotation mark
punctuation \x201F 2356 # smart double high reverse quotation mark
sign \x2329 2356 〈
sign \x232A 2356 〉
math \x3008 2356 〈
math \x3009 2356 〉

punctuation \x00bf 45-56-236 ¿
sign \x00a1 45-56-235 ¡
math \x2212 56-36 # − minus الطرح
math \x00D7 56-236 # × multiplication sign
math \x2715 56-236 MULTIPLICATION SIGN
math \x00F7 56-256 # ÷ division sign

sign \x200C 9 # ZERO WIDTH NON-JOINER
punctuation \x2010 36-36 # hyphen
punctuation \x2011 36-36 #  non-breaking hyphen
punctuation \x2013 5-36-36 –
punctuation \x2014 45-36-36 —
punctuation \x2015 456-36-36 ―

# smart ellipsis: was changed from dots 3-3-3, so as to keep consistency with the period
punctuation \x2026 256-256-256
sign \x2022 456-256 •   bullet
noback sign \x25CF 35 # BLACK CIRCLE not representing filled circle shape as it is mostly used in password fields to represent hidden characters

#additional rules
postpunc ) 356
prepunc ( 236
begnum # 456-35
midnum . 256
# the old standard assigned the math comma to dot 3, which is awkward; changed to match other braille codes and to be in
# the upper part of the cell like the numbers
midnum , 2
noback postpunc , 2
decpoint . 256
midnum - 36-36
hyphen - 36-36
postpunc ، 5 # Arabic comma (\x060C)
postpunc . 256
postpunc \x06D4 256 # Arabic Full stop
postpunc ; 5-23
postpunc \x061B 5-23 # Arabic semiColon
midnum : 5-2
postpunc : 5-2
midnum / 456-36
postpunc \x061F 236 # Arabic question mark ؟
postpunc ? 236
endnum % 25-1234
midnum ^ 4-26

# Braille indicators
numsign 3456  number sign, just a dots operand
numericmodechars .,
nocontractsign 56
nonumsign 56
numericnocontchars ابدِبهيجabcdefghij

noback multind 56-6 letsign capsletter
noback capsletter 6
noback begcapsword 6-6
noback endcapsword 6-3
emphclass italic
emphclass underline
emphclass bold
noback begemph italic 46
noback endemph italic 46-46
noback begemph bold 456
noback endemph bold 456-456