# Finnish 6-dot braille based on the official specification document
#
#  Copyright (C) 2014,2015 Celia Library https://www.celia.fi
#
#  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/>.

# Created by Jukka Eerikäinen

# Based on official specification document available on
# https://github.com/liblouis/liblouis/tree/formal_braille_spec#pistekirjoituksen-perusteet

# Includes
include latinLetterDef6Dots.uti
include digits6Dots.uti
include braille-patterns.cti

# Finnish-specific letters
uplow \x00C5\x00E5 16 Åå
uplow \x00C4\x00E4 345 Ää
uplow \x00D6\x00F6 246 Öö

# Common foreign-language letters that have single sign
uplow \x00C9\x00E9 123456 Éé
uplow \x1E9E\x00DF 2346 ẞß
uplow \x00DC\x00FC 1256 Üü
uplow \x0152\x0153 246 Œœ
uplow \x00C6\x00E6 345 Ææ

# Other foreign letters with double sign
# From UTF-8 table. Does not include every possible letter-diacritic-combination.
# For foreign letters with no single specified sign, a generic "foreign letter" sign is used before the braille sign for the base letter.
uplow \x00C0\x00E0 45-1 Àà
uplow \x00C1\x00E1 45-1 Áá
uplow \x00C2\x00E2 45-1 Ââ
uplow \x00C3\x00E3 45-1 Ãã
uplow \x00C7\x00E7 45-14 Çç
uplow \x00C8\x00E8 45-15 Èè
uplow \x00CA\x00EA 45-15 Êê
uplow \x00CB\x00EB 45-15 Ëë
uplow \x00CC\x00EC 45-24 Ìì
uplow \x00CD\x00ED 45-24 Íí
uplow \x00CE\x00EE 45-24 Îî
uplow \x00CF\x00EF 45-24 Ïï
uplow \x00D0\x00F0 45-145 Ðð
uplow \x00D1\x00F1 45-1345 Ññ
uplow \x00D2\x00F2 45-135 Òò
uplow \x00D3\x00F3 45-135 Óó
uplow \x00D4\x00F4 45-135 Ôô
uplow \x00D5\x00F5 45-135 Õõ
uplow \x00D8\x00F8 45-135 Øø
uplow \x00D9\x00F9 45-136 Ùù
uplow \x00DA\x00FA 45-136 Úú
uplow \x00DB\x00FB 45-136 Ûû
uplow \x00DD\x00FD 45-13456 Ýý
uplow \x00DE\x00FE 45-145 Þþ
lowercase \x00FF 45-13456 ÿ

# Whitespace
space \s 0

# Punctuation
# For purposes of this table intended for general literary texts, some mathematical symbols and operators, such as < and > are considered as general punctuation. For reasoning, see section "General symbols" below.
punctuation . 3
punctuation , 2
punctuation : 25
punctuation ; 23
punctuation ! 256
punctuation ? 26
punctuation ' 5
punctuation " 56
punctuation ! 256
punctuation ? 26
punctuation \x0027 5 '
punctuation \x0022 56 "
punctuation ( 236
punctuation ) 356
punctuation [ 12356
punctuation ] 23456
punctuation { 1246
punctuation } 12456
punctuation < 126
punctuation > 156
punctuation / 34

# General symbols
# For purposes of this table intended for general literary texts, some mathematical symbols and operators, such as + and % are considered as general symbols.
# This is because in Finnish braille, mathematical symbols are always preceded with space. Hence, if "+" was considered a mathematical symbol, expressions such as "my grade from the exam was B+" would be incorrectly translated to "B +". In table intended for mathematical textbooks, the preference would lean towards mathematical way of writing, and "+" would be considered a math symbol.
sign \\ 146
sign | 456
sign / 34
sign + 235
sign % 1456
sign = 2356
sign ~ 45
sign @ 4
sign & 12346
sign \x00A3 123 £
sign $ 2346
sign \x20AC 4-15 €
sign \x00A2 4-14 ¢
sign * 35
sign \x00A7 3456 §
sign _ 346
sign # 3456
sign ^ 346
sign \x2022 3 • Bullet sign
sign \x00B7 3 · Interpunct
sign - 36 Hyphen, not a dash. Hyphens are spaced as in print text.
sign \x2013 36 – En-dash, not a hyphen.
sign \x2014 36 – Em-dash, not a hyphen.

# Additional general symbols
# These are not covered by the specification document, but reflect the conventions.
sign \x00A9 236-14-356 © Copyright symbol
sign \x00AE 236-1235-356 ® Registered trademark symbol
sign \x2122 2345-134 ™ Trademark symbol
noback sign \X25CF 35	# 9679 black circle

# Undefined characters
# Not covered by the specification document, but conventionally replaced with an asterisk.
undefined 35

# Mathematical symbols - these are ONLY used in mathematical context
# Thus, these may have special rules
math \x2212 36 − Minus sign, not a hyphen
math \x2030 25-1456 ‰ Per mille sign
math \x221E 123456 ∞ Infinity sign
math \x221A 146 √ Root sign
math \x00B0 356 ° Degree symbol
math \x2219 3 ∙ Bullet operator
math \x22C5 3 ⋅ Dot operator
math \x00D7 3 × Multiplication sign
math \x00F7 25 ÷ Division sign; Obelus
decpoint , 2 Decimal comma

# Vulgar fractions
# This is not the mathematically correct notation for fractions; rather, the fractions are converted to division-like notation to ease reading of literary texts, cookbooks et cetera. For _mathematical_ texts, another table must be written.
math \x00BC 3456-1-0-34-3456-145 ¼
math \x00BD 3456-1-0-34-3456-12 ½
math \x00BE 3456-14-0-34-3456-145 ¾
math \x2153 3456-1-0-34-3456-14 ⅓
math \x2154 3456-12-0-34-3456-14 ⅔
math \x2155 3456-1-0-34-3456-15 ⅕
math \x2156 3456-12-0-34-3456-15 ⅖
math \x2157 3456-14-0-34-3456-15 ⅗
math \x2158 3456-145-0-34-3456-15 ⅘
math \x2159 3456-1-0-34-3456-124 ⅙
math \x215A 3456-15-0-34-3456-124 ⅚
math \x215B 3456-1-0-34-3456-125 ⅛
math \x215C 3456-14-0-34-3456-125 ⅜
math \x215D 3456-15-0-34-3456-125 ⅝
math \x215E 3456-1245-0-34-3456-125 ⅞


# Braille indicators
numsign 3456
capsletter 6 
begcapsword 6-6
endcapsword 56

# Emphasis
emphclass italic
emphclass underline
emphclass bold

begemphphrase underline 346-346
endemphphrase underline before 346
begemphword underline 346
endemphword underline 346
lenemphphrase underline 3

begemphphrase bold 346-346
endemphphrase bold before 346
begemphword bold 346
endemphword bold 346
lenemphphrase bold 3

begemphphrase italic 46-46
endemphphrase italic before 46
begemphword italic 46
endemphword italic 46
lenemphphrase italic 3

# Longer number expressions
midnum . 3
midnum : 25

# Context rules for transition from digits to letters
class digitletter abcdefhjiklmnopqrstuvwxyz\x00E5\x00E4\x00F6
noback context $d[]%digitletter @56

# Second power
# Powers are generally marked using power sign. However, if the power is two, the number is omitted.
noback context ["^2\s"] @346-0
noback context ["^2"]$p @346

# Numbers and mathematical symbols
# Slash is always preceded by space within number expressions.
noback context $d[]"/" @0
# Degree sign is always preceded by space, even when it's adjacent to preceding digit in print text.
noback context $d[]"\x00B0" @0 Degree sign
# Mathematical symbols and operators are always preceded by space.
noback context $d[]$m @0
# Dashes, not a hyphen. Dashes always have spaces around them.
noback context !$s["\x2013"]!$s @0-36-0
noback context !$s["\x2014"]!$s @0-36-0
