# Bulgarian 6 dots Literary Braille
#
#  Copyright (C) 2021 Румяна Каменска <rkamenska@gmail.com>
#
#  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/>.

#-index-name: Bulgarian
#-display-name: Bulgarian braille
#
#+language: bg
#+type: literary
#+dots: 6
#+contraction: no

# Created by Rumyana Kamenska <rkamenska@gmail.com>

# It includes Bulgarian, Russian, English letters and additional letters for Esperanto

include spaces.uti

punctuation ! 235
punctuation " 356
prepunc " 236
postpunc " 356
punctuation # 146
punctuation $ 1246
punctuation % 3456-356
punctuation & 12346
punctuation ' 3
punctuation ( 126
punctuation ) 345
punctuation * 35
punctuation + 235
always + 235
punctuation , 2
punctuation - 36
punctuation . 256
punctuation / 6-34
sign № 1345-1235-256-0
sign І 46-24
# signs for individual dot combinations used accidentally
sign \x00C0 46 Capital letter sign
sign \x00C1 3456 Digit sign
sign \x00C5 6-36 Long dash
sign \x00d2 12346
lowercase \x045d 12346
sign \x00b8 156
sign \x00be 1256
sign \x00d3 456
sign \x00F3 45
sign \x00F4 56
sign \x00f0 123456
sign \x00f7 123456
sign \x00F1 16
sign \x00f5 6
sign \x00f8 5
sign \x00fa 5-2

# Letters for esperanto
sign \x00E7 46-146
sign \x00E8 146
sign \x00E9 46-12456
sign \x00Ea 12456
sign \x00EB 46-346
sign \x00EC 346

# for quotes and other signs
punctuation \x00C9 236
punctuation \x2026 256-256-256
punctuation \x2018 3
punctuation \x2019 3

include digits6Dots.uti

punctuation : 25
punctuation ; 23
sign < 246
sign = 2356
sign > 135
punctuation ? 26
sign @ 2346

# including cyrillic characters first
# from ru.ctb cyrillic letters
# no dot 7 and \x419 and \x439 changed to 13456 and 13456 respectively
uppercase \x0401 16		CYRILLIC CAPITAL LETTER IO
uppercase \x0410 1		CYRILLIC CAPITAL LETTER A
uppercase \x0411 12		CYRILLIC CAPITAL LETTER BE
uppercase \x0412 2456		CYRILLIC CAPITAL LETTER VE
uppercase \x0413 1245		CYRILLIC CAPITAL LETTER GHE
uppercase \x0414 145		CYRILLIC CAPITAL LETTER DE
uppercase \x0415 15		CYRILLIC CAPITAL LETTER IE
uppercase \x0416 245		CYRILLIC CAPITAL LETTER ZHE
uppercase \x0417 1356		CYRILLIC CAPITAL LETTER ZE
uppercase \x0418 24		CYRILLIC CAPITAL LETTER I
uppercase \x0419 13456		CYRILLIC CAPITAL LETTER SHORT I
uppercase \x041a 13		CYRILLIC CAPITAL LETTER KA
uppercase \x041b 123		CYRILLIC CAPITAL LETTER EL
uppercase \x041c 134		CYRILLIC CAPITAL LETTER EM
uppercase \x041d 1345		CYRILLIC CAPITAL LETTER EN
uppercase \x041e 135		CYRILLIC CAPITAL LETTER O
uppercase \x041f 1234		CYRILLIC CAPITAL LETTER PE
uppercase \x0420 1235		CYRILLIC CAPITAL LETTER ER
uppercase \x0421 234		CYRILLIC CAPITAL LETTER ES
uppercase \x0422 2345		CYRILLIC CAPITAL LETTER TE
uppercase \x0423 136		CYRILLIC CAPITAL LETTER U
uppercase \x0424 124		CYRILLIC CAPITAL LETTER EF
uppercase \x0425 125		CYRILLIC CAPITAL LETTER HA
uppercase \x0426 14		CYRILLIC CAPITAL LETTER TSE
uppercase \x0427 12345		CYRILLIC CAPITAL LETTER CHE
uppercase \x0428 156		CYRILLIC CAPITAL LETTER SHA
uppercase \x0429 1346		CYRILLIC CAPITAL LETTER SHCHA
uppercase \x042a 12356		CYRILLIC CAPITAL LETTER HARD SIGN
uppercase \x042b 2346		CYRILLIC CAPITAL LETTER YERU
uppercase \x042c 23456		CYRILLIC CAPITAL LETTER SOFT SIGN
uppercase \x042d 246		CYRILLIC CAPITAL LETTER E
uppercase \x042e 1256		CYRILLIC CAPITAL LETTER YU
uppercase \x042f 1246		CYRILLIC CAPITAL LETTER YA
lowercase \x0430 1		CYRILLIC SMALL LETTER A
lowercase \x0431 12		CYRILLIC SMALL LETTER BE
lowercase \x0432 2456		CYRILLIC SMALL LETTER VE
lowercase \x0433 1245		CYRILLIC SMALL LETTER GHE
lowercase \x0434 145		CYRILLIC SMALL LETTER DE
lowercase \x0435 15		CYRILLIC SMALL LETTER IE
lowercase \x0436 245		CYRILLIC SMALL LETTER ZHE
lowercase \x0437 1356		CYRILLIC SMALL LETTER ZE
lowercase \x0438 24		CYRILLIC SMALL LETTER I
lowercase \x0439 13456		CYRILLIC SMALL LETTER SHORT I
lowercase \x043a 13		CYRILLIC SMALL LETTER KA
lowercase \x043b 123		CYRILLIC SMALL LETTER EL
lowercase \x043c 134		CYRILLIC SMALL LETTER EM
lowercase \x043d 1345		CYRILLIC SMALL LETTER EN
lowercase \x043e 135		CYRILLIC SMALL LETTER O
lowercase \x043f 1234		CYRILLIC SMALL LETTER PE
lowercase \x0440 1235		CYRILLIC SMALL LETTER ER
lowercase \x0441 234		CYRILLIC SMALL LETTER ES
lowercase \x0442 2345		CYRILLIC SMALL LETTER TE
lowercase \x0443 136		CYRILLIC SMALL LETTER U
lowercase \x0444 124		CYRILLIC SMALL LETTER EF
lowercase \x0445 125		CYRILLIC SMALL LETTER HA
lowercase \x0446 14		CYRILLIC SMALL LETTER TSE
lowercase \x0447 12345		CYRILLIC SMALL LETTER CHE
lowercase \x0448 156		CYRILLIC SMALL LETTER SHA
lowercase \x0449 1346		CYRILLIC SMALL LETTER SHCHA
lowercase \x044a 12356		CYRILLIC SMALL LETTER HARD SIGN
lowercase \x044b 2346		CYRILLIC SMALL LETTER YERU
lowercase \x044c 23456		CYRILLIC SMALL LETTER SOFT SIGN
lowercase \x044d 246		CYRILLIC SMALL LETTER E
lowercase \x044e 1256		CYRILLIC SMALL LETTER YU
lowercase \x044f 1246		CYRILLIC SMALL LETTER YA
lowercase \x0451 16		CYRILLIC SMALL LETTER IO
uppercase \x0462 345		CYRILLIC CAPITAL LETTER YAT
lowercase \x0463 345		CYRILLIC SMALL LETTER YAT
uppercase \x046a 246		CYRILLIC CAPITAL LETTER BIG YUS
lowercase \x046b 246		CYRILLIC SMALL LETTER BIG YUS

include latinLetterDef6Dots.uti

punctuation [ 12356
punctuation \\ 16-3
punctuation ] 23456
sign ^ 34
sign _ 456
sign § 346
sign ` 4

# above a-z
punctuation { 246-3
sign | 1456
punctuation } 4-135
punctuation ~ 6-346

# Additional characters for Bulgarian
math \x00B1 235-36 PLUS-MINUS SIGN PLUS-OR-MINUS SIGN
math \x00BC 3456-1-256 VULGAR FRACTION ONE QUARTER No 0031 2044
math \x00BD 3456-1-23 2 VULGAR FRACTION ONE HALF No 0031 2044 0032
math \x00BE 3456-3-256 VULGAR FRACTION THREE QUARTERS No 0033
math \x00D7 0-236	 MULTIPLICATION SIGN
math \x00F7 0-256 DIVISION SIGN
noback punctuation \x0092 3 RIGHT SINGLE QUOTATION MARK
noback punctuation \x0097 6-36 LEFT SINGLE QUOTATION MARK
punctuation \x00A1 235 INVERTED EXCLAMATION MARK
punctuation \x00ad 36 SOFT HYPHEN
punctuation \x00BF 236 INVERTED QUESTION MARK
punctuation \x2011 36 NON-BREAKING HYPHEN
punctuation \x2014 6-36 EM DASH
noback punctuation \x2018 6-236 LEFT SINGLE QUOTATION MARK
punctuation \x201c 236 LEFT DOUBLE QUOTATION MARK
punctuation \x201d 356 RIGHT DOUBLE QUOTATION MARK
sign \x2122 45-2345 trademark sign
sign \x00A2 4-14 CENT SIGN
sign \x00A3 3456 POUND SIGN
sign \x00A4 1246 CURRENCY SIGN
sign \x00A7 4-234 SECTION SIGN
sign \x00A9 45-14 COPYRIGHT SIGN
sign \x00AE 45-1235 REGISTERED SIGN REGISTERED TRADE MARK SIGN
sign \x00B0 46-356 DEGREE SIGN
sign \x00B4 b4 ACUTE ACCENT 0020 0301 SPACING ACUTE
sign \x00B5 46-134 MICRO SIGN 03BC 039C 039C
# sign \x00A5 YEN SIGN
punctuation \x00A6 456-1256 BROKEN BAR BROKEN VERTICAL BAR
punctuation \x0093 236 LEFT DOUBLE QUOTATION MARK
punctuation \x0094 356 RIGHT DOUBLE QUOTATION MARK
punctuation \x0096 36 EN DASH
noback sign \x25CF 6-36 BLACK CIRCLE

# Braille indicators:
numsign 3456  number sign, just a dots operand
# Capital letters also inserted using context rules.
capsletter 46
begcapsword 56

# Punctuations:
midendnumericmodechars ',
noback always , 2
prepunc " 236
postpunc " 356
undefined 26

# Replaces various quotes with a quote
noback correct "„" "\""
noback correct "“" "\""
noback correct "”" "\""
noback correct "«" "\""
noback correct "»" "\""

noback always . 256
noback always , 2

# Symbol classes for special rules below:
attribute upperlatin ABCDEFGHIJKLMNOPQRSTUVWXYZĈĜĤĴŜŬ
attribute lowerlatin abcdefghijklmnopqrstuvwxyzĉĝĥŝĵŭ
attribute uppercyrillic \x0401\x0410\x0411\x0412\x0413\x0414\x0415\x0416\x0417\x0418\x0419\x041A\x041B\x041C\x041D\x041E\x041F\x0420\x0421\x0422\x0423\x0424\x0425\x0426\x0427\x0428\x0429\x042A\x042B\x042C\x042D\x042E\x042F
attribute lowercyrillic \x0430\x0431\x0432\x0433\x0434\x0435\x0436\x0437\x0438\x0439\x043A\x043B\x043C\x043D\x043E\x043F\x0440\x0441\x0442\x0443\x0444\x0445\x0446\x0447\x0448\x0449\x044A\x044B\x044C\x044D\x044E\x044F\x0451
attribute latin ABCDEFGHIJKLMNOPQRSTUVWXYZĈĜĤŜĴŬabcdefghijklmnopqrstuvwxyzĉĝĥŝĵŭ
attribute cyrillic \x0401\x0410\x0411\x0412\x0413\x0414\x0415\x0416\x0417\x0418\x0419\x041A\x041B\x041C\x041D\x041E\x041F\x0420\x0421\x0422\x0423\x0424\x0425\x0426\x0427\x0428\x0429\x042A\x042B\x042C\x042D\x042E\x042F\x0430\x0431\x0432\x0433\x0434\x0435\x0436\x0437\x0438\x0439\x043A\x043B\x043C\x043D\x043E\x043F\x0440\x0441\x0442\x0443\x0444\x0445\x0446\x0447\x0448\x0449\x044A\x044B\x044C\x044D\x044E\x044F\x0451

swapcd updigit 1234567890 1,12,14,145,15,124,1245,125,24,245


# Mark letters immediately following digits. (Some changes for bulgarian)
noback context [$d]%lowerlatin %updigit@6
noback context [$d]%lowercyrillic %updigit@5
noback context [$d","]%lowerlatin %updigit@2@6
noback context [$d","]%lowercyrillic %updigit@2@5
# One ore more lower after two  upper, last upper is cap letter - insert capsletter sign
noback context %upperlatin[]%upperlatin%lowerlatin. @46

# Cyrillic upper and lower mixing
# One or more lower after one upper (when the upper cyrillic is after latin upper letters)
noback context %uppercyrillic%lowercyrillic. @46*
# One ore more lower after two  upper, last upper is cap letter - insert capsletter sign
noback context %uppercyrillic[]%uppercyrillic%lowercyrillic. @46
noback context %upperlatin[]%upperlatin%lowerlatin. @46
# also for one position to the left
noback context __%uppercyrillic%uppercyrillic[%lowercyrillic.] @5*
# two or more upper cyrillic after one upper latin - insert cyrillic capsword sign
noback context _%upperlatin[%uppercyrillic%uppercyrillic.] @56*
# clear extra cyrillic caps letter 46-46] @46
noback pass2 [@46-46] @46
# Replaces cyrillic letters \x0439 and \x0419, when it means the pronoun with dots 12346
noback context `["\x0419"]$sSpm @12346
noback context $s["\x0419"]$sSpm @12346
noback context `["\x0439"]$sSpm @12346
noback context $s["\x0439"]$sSpm @12346
# Replaces the short dash with long dash
noback correct "\x2022" "-"
# bullets 6-36
noback correct "\x2013" "-"
noback correct "\x00B7" "-"
noback context `["-"$s]$U @6-36
noback context `$s["-"$s]$U @6-36
noback context `["-"]$s @6-36
noback context `$s["-"]$s @6-36
noback context [$s"-"$s] @6-36-0
hyphen - 36
noback pass2 [@46-236] @236

# additional letters for Esperanto
lowercase ĉ 146		LATIN LETTER C WITH CIRCUMFLEX
lowercase ĝ 12456		LATIN LETTER G WITH CIRCUMFLEX
lowercase ĥ 1256		LATIN LETTER H WITH CIRCUMFLEX
lowercase ĵ 2456		LATIN LETTER J WITH CIRCUMFLEX
lowercase ŝ 2346		LATIN LETTER S WITH CIRCUMFLEX
lowercase ŭ 346		LATIN LETTER U WITH BREVE

# Uppercase letters
base uppercase \x040D \x045d
base uppercase Ĉ ĉ	LATIN LETTER C WITH CIRCUMFLEX
base uppercase Ĝ ĝ	LATIN LETTER G WITH CIRCUMFLEX
base uppercase Ĥ ĥ	LATIN LETTER H WITH CIRCUMFLEX
base uppercase Ĵ ĵ	LATIN LETTER J WITH CIRCUMFLEX
base uppercase Ŝ ŝ	LATIN LETTER S WITH CIRCUMFLEX
base uppercase Ŭ ŭ	LATIN LETTER U WITH BREVE
