figlet-maison

Du figlet artisanal - retour accueil

git clone git://bebou.netlib.re/figlet-maison

Log | Files | Refs |

txt2flf (819B)


      1 #! /bin/sh
      2 
      3 path="${1:?missing path to font dir}"
      4 [ ! -d "$path" ] \
      5 	&& { printf "%s not a directory\n" "$path";
      6 	     exit 1; }
      7 
      8 tmpd=$(mktemp -d)
      9 height="$(< $path/a.txt wc -l)"
     10 width=$(( $(< $path/a.txt tail -n1 | wc -c) + 1 ))
     11 
     12 createcar() {
     13 	local car;car="$1"
     14 	if [ -f "$path/$car.txt" ];then
     15 		< "$path/$car.txt" sed '1d;s/$/@/'
     16 		endline="$(yes ' ' | head -n$(( $width-2 )) | tr -d '\n')"
     17 	else
     18 		yes '@' | head -n$(( $height - 1 ))
     19 	fi
     20 	printf "%s@@\n" "$endline"
     21 }
     22 
     23 <<. grep -o . > $tmpd/cars
     24 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ÄÖÜäöüß
     25 .
     26 
     27 <<. cat
     28 flf2a$ $height $height $width 0 3 0 64 0
     29 From font: $path
     30 
     31 Font created with txt2tlf: http://bebou.netlib.re
     32 .
     33 
     34 createcar
     35 cat $tmpd/cars | while read car;do
     36 	createcar "$car"
     37 done
     38 
     39 rm -rf $tmpd