bazar/BEPO/BEPO.sh

177 lines
8 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
#Générateur de BEPO.svg
#Dotted Circle = ◌
DEST=./BEPO.svg
########################################################
# #
# Bloc des données #
########################################################
BASE=( '$' '"' « » '(' ')' '@' '+' '-' '/' '*' '=' % '⌫' \
'⇥' b é p o è '̂◌' v d l j z w '⎆' \
'⇫' a u i e ',' c t s r n m ç '⎆' \
'⇧' ê à y x . k q g h f '⇧' '⇧')
HBASE=('⎈' '⌘' '⎇' '⇮' '⌘' '⌥' '⎈')
SHIFT=('#' 1 2 3 4 5 6 7 8 9 0 ° '`' ' ' \
'⇤' B É P O È '!' V D L J Z W '⏎' \
' ' A U I E ';' C T S R N M Ç '⏎' \
' ' Ê À Y X ':' K '?' Q G H F '⇧' '⇧')
ALTER=('–' '—' '<' '>' '[' ']' '^' ± '-' ÷ × '≠' '‰' ' ' \
' ' '|' '́◌' '&' œ '̀◌' ¡ '̌◌' '−' 'ø' ü '̶◌' ö '⎆' \
' ' æ ù '̈◌'\' '̧◌' 'ᵉ' ß '̆◌' '̃◌' '̄◌' © '⎆' \
' ' '/' '\' '{' '}''~' ¿ '̊◌' µ '̣◌' '̨◌' '⇧' '⇧')
ALTSH=('¶' '„' '“' '”' '≤' '≥' '‖' '¬' '¼' '½' '¾' '′' '″' ' ' \
' ' _ § Œ '`' '^' 'ˇ' '∝' £ Ü '̵◌' Ö '⏎' \
' ' Æ Ù '̇◌' '¤' '̦◌' © ™ 'ſ' '®' '~' '-' '🄯' '⏎' \
' ' '^' ',' '‑' '̓◌' '̕◌' '†' '‡' '•' '⇧' '⇧')
########################################################
# #
# Bloc de style #
########################################################
echo '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
width="1680"
height="620"
viewBox="0 0 1680 620"
lang="fr">
<title>Disposition BÉPO</title>
<desc>Personalisation du clavier BÉPO avec la norme ISO/IEC 9995-7.</desc>
<style>
/*Style densemble*/
svg
{
background: #e1e1e1;
color: #908f90;
}
/*Styles des caractères*/
text
{
font-family: monospace;
font-size: 40px;
}
text.base
{
fill: purple;
}
text.shift
{
fill: blue;
}
text.alt
{
fill: green;
}
text.combo
{
fill: orange;
}
text.dead
{
font-weight: bold;
}
image#cc_circle
{
height: 22px!important;
margin-left: 3px;
vertical-align: text-bottom;
}
image#cc_zero
{
height: 22px!important;
margin-left: 3px;
vertical-align: text-bottom;
}
</style>''' > $DEST
########################################################
# #
# Bloc des touches #
########################################################
## Lignes orthogonales de 0 à 3 ########################
for KL in {0..3}
do
KY=$((10+$KL*120))
for KC in {0..13}
do
KX=$((10+$KC*120))
echo ' <g id="keyl'$KL'c'$KC'" transform="translate('$KX' '$KY')">' >> $DEST
echo ' <rect x="0" y="0" width="100" height="100" fill="#fffcf7" stroke="#a09fa0" rx="10"/>' >> $DEST
echo ' <text class="base" x="10" y="90">'${BASE[$(($KC+14*$KL))]}'</text>' >> $DEST
echo ' <text class="shift" x="10" y="45">'${SHIFT[$(($KC+14*$KL))]}'</text>' >> $DEST
echo ' <text class="alt" x="50" y="90">'${ALTER[$(($KC+14*$KL))]}'</text>' >> $DEST
echo ' <text class="combo" x="50" y="45">'${ALTSH[$(($KC+14*$KL))]}'</text>' >> $DEST
echo ' </g>' >> $DEST
done
done
## Ligne 4 sans espace #################################
KL=4
KY=$((10+$KL*120))
for KC in {0..2}
do
KX=$((10+$KC*120))
echo ' <g id="keyl'$KL'c'$KC'" transform="translate('$KX' '$KY')">' >> $DEST
echo ' <rect x="0" y="0" width="100" height="100" fill="#fffcf7" stroke="#a09fa0" rx="10"/>' >> $DEST
echo ' <text class="base" x="10" y="90">'${HBASE[$(($KC))]}'</text>' >> $DEST
echo ' <text class="shift" x="10" y="45"></text>' >> $DEST
echo ' <text class="alt" x="50" y="90"></text>' >> $DEST
echo ' <text class="combo" x="50" y="45"></text>' >> $DEST
echo ' </g>' >> $DEST
done
for KC in {10..13}
do
KX=$((10+$KC*120))
echo ' <g id="keyl'$KL'c'$KC'" transform="translate('$KX' '$KY')">' >> $DEST
echo ' <rect x="0" y="0" width="100" height="100" fill="#fffcf7" stroke="#a09fa0" rx="10"/>' >> $DEST
echo ' <text class="base" x="10" y="90">'${HBASE[$(($KC-7))]}'</text>' >> $DEST
echo ' <text class="shift" x="10" y="45"></text>' >> $DEST
echo ' <text class="alt" x="50" y="90"></text>' >> $DEST
echo ' <text class="combo" x="50" y="45"></text>' >> $DEST
echo ' </g>' >> $DEST
done
## Barre despace ######################################
KC=3
KX=$((10+$KC*120))
echo ' <g id="keyl'$KL'c'$KC'" transform="translate('$KX' '$KY')">' >> $DEST
echo ' <rect x="0" y="0" width="820" height="100" fill="#fffcf7" stroke="#a09fa0" rx="10"/>' >> $DEST
echo ' <text class="base" x="10" y="80">&#x2423;</text>' >> $DEST
echo ' <text class="shift" x="10" y="35">&#x2336;</text>' >> $DEST
echo ' <text class="alt" x="770" y="80">_</text>' >> $DEST
echo ' <text class="combo" x="770" y="35">&#x237d;</text>' >> $DEST
echo ' </g>' >> $DEST
## Touche Entrée à droite ##############################
KL=1
KY=$((10+$KL*120))
KC=13
KX=$((10+$KC*120))
echo ' <g id="keyl'$KL'c'$KC'" transform="translate('$KX' '$KY')">' >> $DEST
echo ' <rect x="0" y="0" width="100" height="220" fill="#fffcf7" stroke="#a09fa0" rx="10"/>' >> $DEST
echo ' <text class="base" x="10" y="190">&#9094;</text>' >> $DEST
echo ' <text class="shift" x="10" y="45">&#9166;</text>' >> $DEST
echo ' <text class="alt" x="50" y="190"></text>' >> $DEST
echo ' <text class="combo" x="50" y="45"></text>' >> $DEST
echo ' </g>' >> $DEST
## Touche Capital à droite #############################
KL=3
KY=$((10+$KL*120))
KC=12
KX=$((10+$KC*120))
echo ' <g id="keyl'$KL'c'$KC'" transform="translate('$KX' '$KY')">' >> $DEST
echo ' <rect x="0" y="0" width="220" height="100" fill="#fffcf7" stroke="#a09fa0" rx="10"/>' >> $DEST
echo ' <text class="base" x="10" y="90">&#8679;</text>' >> $DEST
echo ' <text class="shift" x="10" y="45"></text>' >> $DEST
echo ' <text class="alt" x="150" y="90"></text>' >> $DEST
echo ' <text class="combo" x="150" y="45"></text>' >> $DEST
echo ' </g>' >> $DEST
## Signature ###########################################
echo ''' <g xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/" transform="translate(50 610)">
<text style="color: black; font-size: 1em; font-family: sans;">
<a property="dct:title" rel="cc:attributionURL" href="https://www.alnotz.fr/">BÉPO Orthogonal avec ISO/IEC 9995-7</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.alnotz.fr/">Alnotz</a> is licensed under <a href="https://creativecommons.org/licenses/by/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">Attribution 4.0 International</a>
</text>
<a href="https://creativecommons.org/publicdomain/zero/1.0?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">
<image x="48em" y="-1em" id="cc_circle" href="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1"/>
<image x="calc(48em + 22px)" y="-1em" id="cc_zero" href="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1"/>
</a>
</g>''' >> $DEST
echo '</svg>' >> $DEST