summaryrefslogtreecommitdiff
path: root/bin/embolden
diff options
context:
space:
mode:
authorDavid Wührer <def@gmx.at>2024-05-18 21:04:34 +0200
committerDavid Wührer <def@gmx.at>2024-05-18 21:04:34 +0200
commit77cfffee6177fb0421fa0fce15d6a1875bde4816 (patch)
tree251428cdd482ea50cfb019dbd3c3bafd79d2fd14 /bin/embolden
parent75b23ce1ff0daab363725a2a5755ea80bbeaa68e (diff)
manuals, sum-down, radix
Diffstat (limited to 'bin/embolden')
-rwxr-xr-xbin/embolden390
1 files changed, 390 insertions, 0 deletions
diff --git a/bin/embolden b/bin/embolden
new file mode 100755
index 0000000..75df549
--- /dev/null
+++ b/bin/embolden
@@ -0,0 +1,390 @@
+#!/bin/bash
+
+# For bold and italic we can use the Mathematical font variant mappings,
+# although those are only defined for Latin and Greek.
+# Latin bold capital: u1d400 - u1d419
+# Latin bold small: u1d41a - u1d433
+# Latin italic capital: u1d434 - u1d44d
+# Latin italic small: u1d44e - u1d467
+# Latin bold italic capital: u1d468 - u1d481
+# Latin bold italic small: u1d482 - u1d49b
+# (Script capital, script small, bold script capital, bold script small)
+# (Fraktur capital, fraktur small)
+# (Double-struck capital, double-struck small)
+# (some Hebrew symbol variants)
+# (Bold fraktur capital, bold fraktur small)
+# (Sans-serif capital, sans-serif small)
+# (Sans-serif bold capital, sans-serif bold small)
+# (Sans-serif italic capital, sans-serif italic small)
+# (Sans-serif bold italic capital, sans-serif bold italic small)
+# (Monospace capital, monospace small)
+# Greek bold capital: u1d6a8 - u1d6c0
+# Greek bold small: u1d6c2 - u1d6da
+# Greek italic capital: u1d6e2 - u1d6fa
+# Greek italic small: u1dcfc - u1d714
+# Greek bold italic capital: u1d71c - u1d734
+# Greek bold italic small: u1d736 - u1d74e
+# (Greek sans-serif bold capital: u1d756 - u1d76e)
+# (Greek sans-serif bold small: u1d770 - u1d788)
+# (Greek sans-serif bold italic capital: u1d790 - u1d7a8)
+# (Greek sans-serif bold italic small: u1d7aa - u1d7c2)
+# bold digits: u1d7ce - u1d7d7
+# (double-struck digits)
+# (sans-serif digits)
+# (sans-serif bold digits)
+# (monospace digits)
+# (Arabic mathematical)
+# (Arabic stretched)
+# (Arabic looped)
+# (Arabic double-struck)
+#
+# It turns out there are no Unicode control codes for marking text
+# bold or italic. There are for subscript and superscript,
+# and ASCII has similar codes which nobody ever uses.
+
+declare -A bold=(
+ [0]=$'\xf0\x9d\x9f\x8e'
+ [1]=$'\xf0\x9d\x9f\x8f'
+ [2]=$'\xf0\x9d\x9f\x90'
+ [3]=$'\xf0\x9d\x9f\x91'
+ [4]=$'\xf0\x9d\x9f\x92'
+ [5]=$'\xf0\x9d\x9f\x93'
+ [6]=$'\xf0\x9d\x9f\x94'
+ [7]=$'\xf0\x9d\x9f\x95'
+ [8]=$'\xf0\x9d\x9f\x96'
+ [9]=$'\xf0\x9d\x9f\x97'
+ [A]=$'\xf0\x9d\x90\x80'
+ [B]=$'\xf0\x9d\x90\x81'
+ [C]=$'\xf0\x9d\x90\x82'
+ [D]=$'\xf0\x9d\x90\x83'
+ [E]=$'\xf0\x9d\x90\x84'
+ [F]=$'\xf0\x9d\x90\x85'
+ [G]=$'\xf0\x9d\x90\x86'
+ [H]=$'\xf0\x9d\x90\x87'
+ [I]=$'\xf0\x9d\x90\x88'
+ [J]=$'\xf0\x9d\x90\x89'
+ [K]=$'\xf0\x9d\x90\x8a'
+ [L]=$'\xf0\x9d\x90\x8b'
+ [M]=$'\xf0\x9d\x90\x8c'
+ [N]=$'\xf0\x9d\x90\x8d'
+ [O]=$'\xf0\x9d\x90\x8e'
+ [P]=$'\xf0\x9d\x90\x8f'
+ [Q]=$'\xf0\x9d\x90\x90'
+ [R]=$'\xf0\x9d\x90\x91'
+ [S]=$'\xf0\x9d\x90\x92'
+ [T]=$'\xf0\x9d\x90\x93'
+ [U]=$'\xf0\x9d\x90\x94'
+ [V]=$'\xf0\x9d\x90\x95'
+ [W]=$'\xf0\x9d\x90\x96'
+ [X]=$'\xf0\x9d\x90\x97'
+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̱]=
+# [𝐷̱]=
+# [𝐸̱]=
+# [𝐹̱]=
+# [𝐺̱]=
+# [𝐻̱]=
+# [𝐼̱]=
+# [𝐽̱]=
+# [𝐾̱]=
+# [𝐿̱]=
+# [𝑀̱]=
+# [𝑁̱]=
+# [𝑂̱]=
+# [𝑃̱]=
+# [𝑄̱]=
+# [𝑅̱]=
+# [𝑆̱]=
+# [𝑇̱]=
+# [𝑈̱]=
+# [𝑉̱]=
+# [𝑊̱]=
+# [𝑋̱]=
+# [𝑌̱]=
+# [𝑍̱]=
+# [𝑎̱]=
+# [𝑏̱]=
+# [𝑐̱]=
+# [𝑑̱]=
+# [𝑒̱]=
+# [𝑓̱]=
+# [𝑔̱]=
+# [𝘩̱]=
+# [𝑖̱]=
+# [𝑗̱]=
+# [𝑘̱]=
+# [𝑙̱]=
+# [𝑚̱]=
+# [𝑛̱]=
+# [𝑜̱]=
+# [𝑝̱]=
+# [𝑞̱]=
+# [𝑟̱]=
+# [𝑠̱]=
+# [𝑡̱]=
+# [𝑢̱]=
+# [𝑣̱]=
+# [𝑤̱]=
+# [𝑥̱]=
+# [𝑦̱]=
+# [𝑧]=
+ [𝟢]=$'\xf0\x9d\x9f\xac'
+ [𝟣]=$'\xf0\x9d\x9f\xad'
+ [𝟤]=$'\xf0\x9d\x9f\xae'
+ [𝟥]=$'\xf0\x9d\x9f\xaf'
+ [𝟦]=$'\xf0\x9d\x9f\xb0'
+ [𝟧]=$'\xf0\x9d\x9f\xb1'
+ [𝟨]=$'\xf0\x9d\x9f\xb2'
+ [𝟩]=$'\xf0\x9d\x9f\xb3'
+ [𝟪]=$'\xf0\x9d\x9f\xb4'
+ [𝟫]=$'\xf0\x9d\x9f\xb5'
+)
+
+declare -A italic=(
+ [A]=$'\xf0\x9d\x90\xb4'
+ [B]=$'\xf0\x9d\x90\xb5'
+ [C]=$'\xf0\x9d\x90\xb6'
+ [D]=$'\xf0\x9d\x90\xb7'
+ [E]=$'\xf0\x9d\x90\xb8'
+ [F]=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̱]=
+# [𝐰̱]=
+# [𝐱̱]=
+# [𝐲̱]=
+# [𝐳]=
+)
+
+# case $0 in embolden) italicise) script) fracture) double-strike) sans-serif) monospace) stretch) loop) mathise)
+
+while IFS= read -r line
+do for i in $(seq 0 $((${#line}-1)))
+ do
+ c1=${line:$i:1}
+ # if [[ ${bold[$c1]} ]]
+ if [[ $c1 =~ [0-9a-zA-Zα-ωΑ-Ω𝐴̱-𝑍̱𝑎̱-𝑧] ]]
+ then replacement+=${bold[$c1]}
+ else replacement+=$'\u0331'$c1
+ fi
+ done
+ echo "$replacement"
+done