-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmksvgspcimen.sh
42 lines (38 loc) · 1.65 KB
/
mksvgspcimen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
usage(){
echo "USAGE: $0 font-family color-up color-dn [fontname] [favouriteword]"; exit 1;
}
# This script is relased under CC0.
## SAMPLE:
# mksvgspcimen.sh Iosevka \#8888ff \#4e4eff " [ˈmæs.tɚ]" > Iosevka_todo_topath.svg
: ${font_family=$1} ${color_up=$2} ${color_dn=$3} ${fontname=${4:-${font_family}}} ${favouriteword=${5:-Lorem Ipsum}}
echo "mksvgspeciman 0.1
CMDLINE $(printf '%q ' "$0" "$@")
FAMILY ${font_family}
NAME ${fontname}
UP ${color_up}
DN ${color_dn}
WORD ${favouriteword}
">&2
[ "$3" ] || usage
echo "<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns='http://www.w3.org/2000/svg' height='486' width='396' version='1.1' viewBox='0 0 396 486'>
<g style='font-family: "${font_family}";' xml:space='preserve'>
<rect height='186' width='396' y='300' x='0' fill='${color_dn}'/>
<rect height='300' width='396' y='0' x='0' fill='${color_up}'/>
<text font-size='70px' y='75' x='20'>${fontname}</text>
<text font-size='60px' y='145' x='20'>Aa Ee Rr</text>
<text font-size='60px' y='210' x='20' style='font-style: italic'>Bb Gg Jj</text>
<text font-size='50px' y='270' x='20'>${favouriteword}</text>
<text font-size='50px' y='355' x='20'><tspan>abcdefghijklm</tspan><tspan x='20' dy='45'>nopqrstuvwxyz</tspan></text>
<text font-size='180px' y='200' x='260' fill='white'>A</text>
<text font-size='50px' y='455' x='20' fill='white'>0123456789</text>
</g>
</svg>
<!-- Generated by mksvgspeciman -->"
_ret=$?
if [ $_ret == 0 ]; then
echo "Done. Convert the text to paths and do other necessary adjustments in your svg editor.">&2
else
echo "cat: $_ret"
fi