iso-country-flags-svg-colle.../scripts/sheets.sh

56 lines
1.1 KiB
Bash
Raw Normal View History

2011-12-18 20:21:41 +01:00
#!/bin/sh
2014-02-16 19:08:48 +01:00
set -e
2011-12-18 20:21:41 +01:00
2011-12-18 21:01:14 +01:00
BGS="lightgrey white black transparent"
2011-12-18 20:21:41 +01:00
echo "Generating sheets .."
2013-08-29 09:58:05 +02:00
TILE=15
2011-12-18 20:21:41 +01:00
for f in $(cd build; ls -d1 png-*); do
for res in $(cd build/$f; ls -d1 res-*); do
2011-12-18 21:01:14 +01:00
echo " processing build/$f/$res";
2011-12-18 20:21:41 +01:00
2011-12-18 21:01:14 +01:00
OUTPD="build/$f/sheets";
FLAGS="build/$f/$res/??.png";
RES=`echo $res | sed s/^res-//g`
RESX=`echo $RES | sed s/x.*$//g`
RESY=`echo $RES | sed s/^.*x//g`
if [ "$RESX" -gt 300 -o "$RESY" -gt 300 ]; then
2011-12-18 21:01:14 +01:00
echo " skipping big resolution $RES.";
else
for bg in $BGS; do
2011-12-18 20:21:41 +01:00
# echo " $bg";
2011-12-18 21:01:14 +01:00
SHEET="$OUTPD/$res-$bg.png";
2013-08-29 09:58:05 +02:00
CSS="$OUTPD/$res-$bg.css";
HTML="$OUTPD/$res-$bg.html";
2011-12-18 21:01:14 +01:00
mkdir -p $OUTPD;
echo " $SHEET";
montage \
-limit memory 512 -limit map 512 \
-font DroidSans-Bold.ttf \
-pointsize 8 \
2013-08-29 09:58:05 +02:00
-tile ${TILE}x \
2011-12-18 21:01:14 +01:00
-geometry $RES! \
$FLAGS \
-label "%f" \
-fill Black \
-background $bg \
$SHEET;
2013-08-29 09:58:05 +02:00
echo " $CSS"
./scripts/css.py --cmd css --tile $TILE --resx $RESX --resy $RESY --image $res-$bg.png $FLAGS > $CSS
echo " $HTML"
./scripts/css.py --cmd html --css $res-$bg.css $FLAGS > $HTML
2011-12-18 21:01:14 +01:00
done
fi
2011-12-18 20:21:41 +01:00
done
done
2013-08-29 09:58:05 +02:00
echo "done."