# Finnish 6-dot braille based on the official specification document
#
# -----------
#-index-name: Finnish
#-display-name: Finnish braille
#-name: Suomenkielinen 6-pisteen pistekirjoitustaulukko
#
#+language: fi
#+language: sv-FI
#+type: literary
#+contraction: no
#+dots: 6
#+direction: forward
#
#-authority: Finnish delegation for braille <braille@celia.fi>
#-maintainer: Sami Määttä <sami.maatta@celia.fi>
#-maintainer: Finnish delegation for braille <braille@celia.fi>
#-author: Sami Määttä <sami.maatta@celia.fi>
#-author: Kirsi Ylänne <kirsi.ylanne@celia.fi>
#-author: Jukka Eerikäinen (created by)
#-copyright: 2014, 2015, 2024, Accessibility Library Celia, <https://www.celia.fi/en>
#-updated: 2024-06-17
# 
# Based on the official documentation "Pistekirjoituksen perusteet" on the website (in Finnish) https://www.pistekirjoitus.fi/julkaisut/pistekirjoituksen-perusteet/. 
# Also based on the mathematical braille on the website "Matematiikan, fysiikan ja kemian pistemerkinnät" and "Matematiikan, fysiikan ja kemian merkinnät elektronisissa oppikirjoissa" (in Finnish) https://www.pistekirjoitus.fi/julkaisut/matematiikka-ja-tietotekniikka/.
# On GitHub: https://github.com/liblouis/braille-specs/tree/master/finnish.
#
# TODO: Please add a reference to official documentation about
# the implemented braille code. Preferably submit the documents
# to https://github.com/liblouis/braille-specs.
# -----------
#
#  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/>.

# 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 ÿ
lowercase \x0161 45-234 š

# 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 ẞß
base uppercase \x0160 \x0161 Šš

# 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 ! 256
punctuation ? 26
punctuation ? 26
punctuation ( 236
punctuation ) 356
punctuation [ 12356
punctuation ] 23456
punctuation { 1246
punctuation } 12456
punctuation < 126
punctuation > 156
punctuation / 34
punctuation ' 5
punctuation \x0027 5 '
punctuation " 56
punctuation \x0022 56 "
punctuation \x201D 56  ” # left-pointing bould angle quotation  
punctuation \x00BB 56  # right-pointing double angle quotation 

# 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 # 3456
sign _ 346
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.
sign ← 126-36       # left arrow
sign → 36-156       # right arrow
sign ↑ 34-156       # up arrow
sign ↓ 16-156       # down arrow
sign ↖ 126-26      # north west arrow (not strictly in the standards)
sign ↗ 35-156       # north east arrow
sign ↘ 26-156       # south east arrow
sign ↙ 126-35       # south west arrow (not strictly in the standards)
sign ↔ 126-36-156   # left right arrow
sign ⇐ 126-36-36    # leftwards double arrow
sign ⇒ 36-36-156       # rightwards double arrow
sign ⇑ 34-34-156       # upwards double arrow (not in the standards)
sign ⇓ 16-16-156       # downwards double arrow (not in the standards)
sign ⇖ 126-26-26  # North West Double Arrow (not in the standards) 
sign ⇗ 35-35-156  # North East Double Arrow (not in the standards)
sign ⇘ 26-26-156  # South East Double Arrow (not in the standards)
sign ⇙ 126-35-35  # South West Double Arrow (not in the standards)
sign ↦ 456-36-156   # right arrow from bar
sign ↤ 126-36-456   # left arrow from bar

# 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
math ± 235-36       # plus minus sign
math ∓ 36-235       # minus plus sign
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

# Lowercase Greek alphabet
lowercase α 46-1                 # alpha
lowercase β 46-12                # beta
lowercase γ 46-1245              # gamma
lowercase δ 46-145               # delta
lowercase ε 46-15                # epsilon
lowercase ζ 46-1356              # zeta
lowercase η 46-345               # eta
lowercase θ 46-1456              # theta
lowercase ι 46-24                # iota
lowercase κ 46-13                # kappa
lowercase λ 46-123               # lambda
lowercase μ 46-134               # mu
lowercase ν 46-1345              # nu
lowercase ξ 46-1346              # xi
lowercase ο 46-135               # omicron
lowercase π 46-1234              # pi
lowercase ρ 46-1235              # rho
lowercase ς 46-234               # sigma
lowercase τ 46-2345              # tau
lowercase υ 46-13456             # upsilon
lowercase φ 46-124               # fii
lowercase χ 46-125               # chi
lowercase ψ 46-12346             # psi
lowercase ω 46-245               # omega

# Uppercase Greek letter alphabet
letter        \x0391        456-1            # Α Capital Alpha
letter        \x0392        456-12            # Β Capital Beta
letter        \x0393        456-1245        # Γ Capital Gamma
letter        \x0394        456-145            # Δ Capital Delta
letter        \x0395        456-15            # Ε Capital Epsilon
letter        \x0396        456-1356        # Ζ Capital Zeta
letter        \x0397        456-345            # Η Capital Eta
letter        \x0398        456-1456        # Θ Capital Theta
letter        \x0399        456-24            # Ι Capital Iota
letter        \x039A        456-13            # Κ Capital Kappa
letter        \x039B        456-123            # Λ Capital Lambda
letter        \x039C        456-134            # Μ Capital Mu
letter        \x039D        456-1345        # Ν Capital Nu
letter        \x039E        456-1346        # Ξ Capital Xi
letter        \x039F        456-135            # Ο Capital Omicron
letter        \x03A0        456-1234        # Π Capital Pi
letter        \x03A1        456-1235        # Ρ Capital Rho
letter        \x03A3        456-234            # Σ Capital Sigma
letter        \x03A4        456-2345        # Τ Capital Tau
letter        \x03A5        456-13456        # Υ Capital Upsilon
letter        \x03A6        456-124            # Φ Capital Phi
letter        \x03A7        456-125            # Χ Capital Chi
letter        \x03A8        456-13456        # Ψ Capital Psi
letter        \x03A9        456-245            # Ω Capital Omega