- leichter Umbau der Shellskripte. Extrakt des Fonts getrennt von test des Fonts
This commit is contained in:
+64
-14
@@ -1,35 +1,85 @@
|
||||
#!/bin/bash
|
||||
. setenv.sh
|
||||
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "please give a .svg file of a glyph as input"
|
||||
if [ -z "$PICCREATE" ]; then
|
||||
echo "please source the environment"
|
||||
exit 1
|
||||
fi
|
||||
if [ -s "$1" ]; then
|
||||
export BASE=`basename $1 .svg`
|
||||
|
||||
O_ARGS=0
|
||||
E_OPTERROR=85
|
||||
|
||||
USAGE="create a jpg file with the purl inside
|
||||
Usage: `basename $0` [-hie]
|
||||
-i id
|
||||
-e extract
|
||||
Examples:
|
||||
to test the glyph later with inkscape:
|
||||
`basename $0` -i ../in/buchstabe_a.svg
|
||||
to extract the points and text from the glyph:
|
||||
`basename $0` -i ../in/buchstabe_a.svg -e "
|
||||
|
||||
|
||||
while getopts "i:eu:" Option
|
||||
do
|
||||
case $Option in
|
||||
i) ID=$OPTARG;;
|
||||
e) EXTRACT=$OPTARG;;
|
||||
*) echo "$USAGE" >&2; exit 1; # Default.
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
if [ -z $ID ] ; then
|
||||
echo "-> no id/filename given"
|
||||
echo "$USAGE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$ID" ]; then
|
||||
echo "please give a .svg file of a glyph as input"
|
||||
echo "$USAGE" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -s "$ID" ]; then
|
||||
export BASE=`basename $ID .svg`
|
||||
export TARGET=$PICCREATE_OUT/$BASE.svg
|
||||
else
|
||||
echo "input file does not exist"
|
||||
echo "$USAGE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# extrahiere die wichtigen Zeilen aus dem Font
|
||||
cat $1 | egrep '<\<line\>|x1|x2|y1|y2|/>|style' | egrep -v '\<text\>|id=|http:' > line-$BASE.svg
|
||||
cat $1 | egrep 'circle|translate|\<r\>' > circles-$BASE.svg
|
||||
cat $1 | egrep '<\<text|text\>>|\<x\>=|\<y\>=|tspan' | egrep -v '\<transform-center-x\>|\<window-|\<id\>=' > text-$BASE.svg
|
||||
cat $ID | egrep '<\<line\>|x1|x2|y1|y2|/>|style' | egrep -v '\<text\>|id=|http:' > line-$BASE.svg
|
||||
cat $ID | egrep 'circle|translate|\<r\>' > circles-$BASE.svg
|
||||
cat $ID | egrep '<\<text|text\>>|\<x\>=|\<y\>=|tspan|style|preserve' | egrep -v '\<transform-center-x\>|\<window-|\<id\>=' > text-$BASE.svg
|
||||
|
||||
# reduziere einige Zeilen um bestimmte Muster
|
||||
cat line-$BASE.svg | sed -e 's/inkscape:transform-center-x=".*"//g' > $$; mv $$ line-$BASE.svg
|
||||
cat text-$BASE.svg | sed -e 's/inkscape:transform-center-y=".*"//g' > $$; mv $$ text-$BASE.svg
|
||||
|
||||
# schreib einen neuen Buchstaben
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">' > $TARGET
|
||||
cat text-$BASE.svg >> $TARGET
|
||||
cat circles-$BASE.svg >> $TARGET
|
||||
cat line-$BASE.svg >> $TARGET
|
||||
echo '</svg>' >> $TARGET
|
||||
|
||||
if [ -z "$EXTRACT" ];
|
||||
then
|
||||
# schreib einen kompletten neuen Buchstaben zum testen
|
||||
echo '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">' > $TARGET
|
||||
cat text-$BASE.svg >> $TARGET
|
||||
cat circles-$BASE.svg >> $TARGET
|
||||
cat line-$BASE.svg >> $TARGET
|
||||
echo '</svg>' >> $TARGET
|
||||
else
|
||||
# schreib nur das extract zur Verwertung als Font in die Ausgabe
|
||||
touch $TARGET
|
||||
cat text-$BASE.svg >> $TARGET
|
||||
cat circles-$BASE.svg >> $TARGET
|
||||
cat line-$BASE.svg >> $TARGET
|
||||
fi
|
||||
|
||||
rm line-$BASE.svg
|
||||
rm circles-$BASE.svg
|
||||
rm text-$BASE.svg
|
||||
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -5,8 +5,8 @@ if [ -z "$1" ]; then
|
||||
echo "please give a directory in the templates folder with .svg glyphs as input"
|
||||
exit 1
|
||||
fi
|
||||
if [ -d "$PICCREATE_TEMPLATES/$1" ]; then
|
||||
export SOURCE="$PICCREATE_TEMPLATES/$1"
|
||||
if [ -d "$PICCREATE_IN/$1" ]; then
|
||||
export SOURCE="$PICCREATE_IN/$1"
|
||||
elif [ ! -d "$1" ]; then
|
||||
export SOURCE="$1"
|
||||
else
|
||||
@@ -19,6 +19,6 @@ export TARGET=$PICCREATE_OUT
|
||||
for i in `ls $SOURCE/*.svg`
|
||||
do
|
||||
echo `basename $i .svg`
|
||||
$PICCREATE_BIN/extract-glyph.sh $i
|
||||
$PICCREATE_BIN/extract-glyph.sh -i $i -e
|
||||
done
|
||||
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
. setenv.sh
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "please give a directory in the templates folder with .svg glyphs as input"
|
||||
exit 1
|
||||
fi
|
||||
if [ -d "$PICCREATE_IN/$1" ]; then
|
||||
export SOURCE="$PICCREATE_IN/$1"
|
||||
elif [ ! -d "$1" ]; then
|
||||
export SOURCE="$1"
|
||||
else
|
||||
echo "directory does not exist"
|
||||
echo "please give a directory with .svg files as input"
|
||||
exit 1
|
||||
fi
|
||||
export TARGET=$PICCREATE_OUT
|
||||
|
||||
for i in `ls $SOURCE/*.svg`
|
||||
do
|
||||
echo `basename $i .svg`
|
||||
$PICCREATE_BIN/extract-glyph.sh -i $i
|
||||
done
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
. setenv.sh
|
||||
|
||||
# Startet das Programm
|
||||
python $MAPSGEN_LIBS/melt.py "$@"
|
||||
+1
-1
@@ -12,7 +12,7 @@ echo setting environment to $PICCREATE
|
||||
export PICCREATE_BIN=$PICCREATE/bin
|
||||
export PICCREATE_CFG=$PICCREATE/cfg
|
||||
export PICCREATE_LIBS=$PICCREATE/libs
|
||||
export PICCREATE_TEMPLATES=$PICCREATE/templates
|
||||
export PICCREATE_FONTS=$PICCREATE/fonts
|
||||
export PICCREATE_IN=$PICCREATE/in
|
||||
export PICCREATE_OUT=$PICCREATE/out
|
||||
export PICCREATE_BACKGROUNDS=$PICCREATE/backgrounds
|
||||
|
||||
Reference in New Issue
Block a user