From 420eeee620a287ac5bf133f8a17329a7182d5bbf Mon Sep 17 00:00:00 2001 From: epoch Date: Tue, 5 Feb 2019 21:48:29 -0600 Subject: forgot to add bin dir that contains a LOT of the handy stuff --- bin/makelabel.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 bin/makelabel.sh (limited to 'bin/makelabel.sh') diff --git a/bin/makelabel.sh b/bin/makelabel.sh new file mode 100755 index 0000000..aa6a811 --- /dev/null +++ b/bin/makelabel.sh @@ -0,0 +1,37 @@ +#!/bin/bash +USAGE="usage: makelabel.sh labelname x y z < labelcontent" +target="$1" +xoffset=$2 +yoffset=$3 +zoffset=$4 +if [ "_$PREFIX" = "_" ];then + echo '$PREFIX' is not set. I use this to find where my font files are stored. + exit 1 +fi +if [ "_$1" = "_-h" -o "_$1" = "_--help" -o "_$1" = "_-help" ];then + echo $USAGE + exit 0 #we were asked for help and we succeeded with supplying help. :) +fi +if [ "_" = "_$1" -o "_" = "_$2" -o "_" = "_$3" -o "_" = "_$4" ];then + echo "something is not right. maybe this will help:" >&2 + echo $USAGE >&2 + exit 1 #something fucked up, but let's tell them how they should have done it. +fi +if grep ' ' <<<$1;then + echo 'fuck. no spaces in $1.' + exit 1 +fi +##target should not have any spaces or else it fucks shit up. >_>... oh well. hex encode it. +while read -rN 1 c;do + name="$(printf "%02x" "'$c")" + if [ "$name" = "0a" ]; then + xoffset=-6 + yoffset="$(printf '%d - %d\n' $yoffset 10 | bc)" + fi + if grep "^$name " ${PREFIX}/share/hackvr/font/font.hackvr 2>&1 > /dev/null;then #don't do this shit unless we actually have something to draw. awk in offsetshape bitches when there's nothing. + grep "^$name " ${PREFIX}/share/hackvr/font.hackvr \ + | sed 's/^'"$name"'/'"$target"'/' \ + | offsetshape.sh "$xoffset" "$yoffset" "$zoffset" + fi + xoffset="$(printf '%d + %d\n' $xoffset 6 | bc)" +done -- cgit v1.2.3