#-index-name: Kazakh
#-display-name: Kazakh braille

#+language: kk
#+type: literary
#+dots: 6
#+contraction: no
#+direction: forward

#  Copyright (C) 2021 Andrey Yakuboy <braille@yakuboy.ru>
#
#  This file is part of liblouis.
#
#  liblouis 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.
#
#  liblouis 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 liblouis. If not, see
#  <http://www.gnu.org/licenses/>.
#
# Based on the Russian braille.

#-maintainer: Andrey Yakuboy

# The Kazakh alphabet has 9 letters that are not in the Russian
# alphabet, namely Ә, Ғ, Қ, Ң, Ө, Ұ, Ү, Һ and І. Like in ru-litbrl.ctb, the
# following definitions have dot 9 set to make them distinguishable
# from the Latin letters.

lowercase \x04d9 3459
lowercase \x0493 124569
lowercase \x049b 14569
lowercase \x04a3 1469
lowercase \x04e9 1269
lowercase \x04b1 3469
lowercase \x04af 349
lowercase \x04bb 12369
lowercase \x0456 134569 # conflicts with a definition in ru-litbrl.ctb

# base rules for Ә, Ғ, Қ, Ң, Ө, Ұ, Ү and Һ (the base rule for І is already in ru-litbrl.ctb)
base uppercase \x04d8 \x04d9
base uppercase \x0492 \x0493
base uppercase \x049a \x049b
base uppercase \x04a2 \x04a3
base uppercase \x04e8 \x04e9
base uppercase \x04b0 \x04b1
base uppercase \x04ae \x04af
base uppercase \x04ba \x04bb

# As some Kazakh letters' definitions conflict with parentheses, the definitions of parentheses should be changed
punctuation ( 2356
punctuation ) 2356

include ru-litbrl.ctb

# Extend classes defined in ru-litbrl.ctb
attribute uppercyrillic \x04d8\x0492\x049a\x04a2\x04e8\x04b0\x04ae\x04ba
attribute lowercyrillic \x04d9\x0493\x049b\x04a3\x04e9\x04b1\x04af\x04bb

# In spite of conflicts of letters and parentheses, in math text parentheses should be marked like in the Russian braille
# The correct opcode is used to avoid conflicts with rules in ru-litbrl.ctb
noback correct $m["("] "\x2823"#4=1                # \x2823 is the dots 126
noback correct ["("]$m "\x2823"#4=1
noback correct $d["("] "\x2823"#4=1
noback correct ["("]$d "\x2823"#4=1
noback correct #4=1[")"] "\x281c"#4=0                # \x281c is the dots 345
noback correct $m[")"] "\x281c"#4=0
noback correct [")"]$m "\x281c"#4=0
noback correct $d[")"] "\x281c"#4=0
noback correct [")"]$d "\x281c"#4=0