# Finnish 6-dot braille based on the official specification document
#
# -----------
#-index-name: Finnish
#-display-name: Finnish braille
#
#+language:fi
#+type:literary
#+contraction:no
#+dots:6
# Marked as "direction:forward" by Bue Vester-Andersen
# as tests only run forward.
#+direction:forward
#
# TODO: Please correct the metadata above. It is not meant to be
# accurate nor complete. It hasn't been verified by the table
# author yet. It is merely an attempt by the liblouis maintainers
# to get some sensible initial values in place.
#
# TODO: Please add a reference to official documentation about
# the implemented braille code. Preferably submit the documents
# to https://github.com/liblouis/braille-specs.
# -----------
#
#  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
space \x00a0 a
include spaces.uti
include latinLetterDef6Dots.uti
include digits6Dots.uti
include litdigits6Dots.uti
include braille-patterns.cti

# Finnish-specific letters
lowercase \x00E5 16 å
lowercase \x00E4 345 ä
lowercase \x00F6 246 ö

# Common foreign-language letters that have single sign
lowercase \x00E9 123456 é
lowercase \x00DF 2346 ß
lowercase \x00FC 1256 ü
lowercase \x0153 246 œ
lowercase \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.
lowercase \x00E0 45-1 à
lowercase \x00E1 45-1 á
lowercase \x00E2 45-1 â
lowercase \x00E3 45-1 ã
lowercase \x00E7 45-14 ç
lowercase \x00E8 45-15 è
lowercase \x00EA 45-15 ê
lowercase \x00EB 45-15 ë
lowercase \x00EC 45-24 ì
lowercase \x00ED 45-24 í
lowercase \x00EE 45-24 î
lowercase \x00EF 45-24 ï
lowercase \x00F0 45-145 ð
lowercase \x00F1 45-1345 ñ
lowercase \x00F2 45-135 ò
lowercase \x00F3 45-135 ó
lowercase \x00F4 45-135 ô
lowercase \x00F5 45-135 õ
lowercase \x00F8 45-135 ø
lowercase \x00F9 45-136 ù
lowercase \x00FA 45-136 ú
lowercase \x00FB 45-136 û
lowercase \x00FD 45-13456 ý
lowercase \x00FE 45-145 þ
lowercase \x00FF 45-13456 ÿ

# Uppercase letters
base uppercase \x00C0 \x00E0 Àà
base uppercase \x00C1 \x00E1 Áá
base uppercase \x00C2 \x00E2 Ââ
base uppercase \x00C3 \x00E3 Ãã
base uppercase \x00C4 \x00E4 Ää
base uppercase \x00C5 \x00E5 Åå
base uppercase \x00C6 \x00E6 Ææ
base uppercase \x00C7 \x00E7 Çç
base uppercase \x00C8 \x00E8 Èè
base uppercase \x00C9 \x00E9 Éé
base uppercase \x00CA \x00EA Êê
base uppercase \x00CB \x00EB Ëë
base uppercase \x00CC \x00EC Ìì
base uppercase \x00CD \x00ED Íí
base uppercase \x00CE \x00EE Îî
base uppercase \x00CF \x00EF Ïï
base uppercase \x00D0 \x00F0 Ðð
base uppercase \x00D1 \x00F1 Ññ
base uppercase \x00D2 \x00F2 Òò
base uppercase \x00D3 \x00F3 Óó
base uppercase \x00D4 \x00F4 Ôô
base uppercase \x00D5 \x00F5 Õõ
base uppercase \x00D6 \x00F6 Öö
base uppercase \x00D8 \x00F8 Øø
base uppercase \x00D9 \x00F9 Ùù
base uppercase \x00DA \x00FA Úú
base uppercase \x00DB \x00FB Ûû
base uppercase \x00DC \x00FC Üü
base uppercase \x00DD \x00FD Ýý
base uppercase \x00DE \x00FE Þþ
base uppercase \x0152 \x0153 Œœ
base uppercase \x1E9E \x00DF ẞß

# 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
attribute 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