- baut jetzt konvertierbare Files

This commit is contained in:
Michael Stangl
2012-07-27 01:30:11 +02:00
parent 62b7b697c5
commit bb8ab51489
38 changed files with 330 additions and 351 deletions
-1
View File
@@ -22,6 +22,5 @@ do
$PICCREATE_BIN/extract-glyph.sh -i $i -e $PICCREATE_BIN/extract-glyph.sh -i $i -e
done done
set -xv
CONFIG=`basename $SOURCE` CONFIG=`basename $SOURCE`
( cd $TARGET; cat *.cfg >> $CONFIG.cfg_ ; rm *.cfg; mv $CONFIG.cfg_ $CONFIG.cfg) ( cd $TARGET; cat *.cfg >> $CONFIG.cfg_ ; rm *.cfg; mv $CONFIG.cfg_ $CONFIG.cfg)
+7 -6
View File
@@ -78,7 +78,8 @@ then
echo '</svg>' >> $GLYPH echo '</svg>' >> $GLYPH
else else
# schreib nur das extract zur Verwertung als Font in die Ausgabe # schreib nur das extract zur Verwertung als Font in die Ausgabe
echo '<g translate(${posx},${posy})>' >> $GLYPH #echo '<g transform="translate(${posx},${posy})">' >> $GLYPH
echo '<g transform="translate(${posx},${posy})">' >> $GLYPH
cat text-$BASE.svg >> $GLYPH cat text-$BASE.svg >> $GLYPH
cat circles-$BASE.svg >> $GLYPH cat circles-$BASE.svg >> $GLYPH
cat line-$BASE.svg >> $GLYPH cat line-$BASE.svg >> $GLYPH
@@ -89,13 +90,12 @@ rm circles-$BASE.svg
rm text-$BASE.svg rm text-$BASE.svg
## alle Zusatzinfos zum Buchstaben rausholen ## alle Zusatzinfos zum Buchstaben rausholen
XCOORDS=./xcoords XCOORDS=./xcoords
# hole das Minium und Maxium der X-Koordinaten um die Schrittweite des Buchstabens zu bestimmen # hole das Minium und Maxium der X-Koordinaten um die Schrittweite des Buchstabens zu bestimmen
# zuerst aus den Texten # zuerst aus den Texten
cat $GLYPH | grep x= | sed "s/^\s\+//g;s/x=//g;s/\"//g" > $XCOORDS cat $GLYPH | egrep "\<x\>=" | sed "s/^\s\+//g;s/x=//g;s/\"//g" > $XCOORDS
# dann aus Kreisen # dann aus Kreisen
cat $GLYPH | egrep "transform=" | sed 's/^\s\+//g;s/translate//g;s/transform=//g;s/["|(|)]//g;s/,.*//g' >> $XCOORDS cat $GLYPH | egrep -v '<g' | egrep "transform=" | sed 's/^\s\+//g;s/translate//g;s/transform=//g;s/["|(|)]//g;s/,.*//g' >> $XCOORDS
# dann aus den Linien # dann aus den Linien
cat $GLYPH | grep x1= | sed "s/^\s\+//g;s/x1=//g;s/\"//g" >> $XCOORDS cat $GLYPH | grep x1= | sed "s/^\s\+//g;s/x1=//g;s/\"//g" >> $XCOORDS
cat $GLYPH | grep x2= | sed "s/^\s\+//g;s/x2=//g;s/\"//g" >> $XCOORDS cat $GLYPH | grep x2= | sed "s/^\s\+//g;s/x2=//g;s/\"//g" >> $XCOORDS
@@ -111,7 +111,7 @@ YCOORDS=./ycoords
# zuerst aus den Texten # zuerst aus den Texten
cat $GLYPH | grep y= | sed "s/^\s\+//g;s/y=//g;s/\"//g" > $YCOORDS cat $GLYPH | grep y= | sed "s/^\s\+//g;s/y=//g;s/\"//g" > $YCOORDS
# dann aus Kreisen # dann aus Kreisen
cat $GLYPH | egrep "transform=" | sed 's/^\s\+//g;s/translate//g;s/transform=//g;s/["|(|)]//g;s/.*,//g' >> $YCOORDS cat $GLYPH | egrep -v '<g' | egrep "transform=" | sed 's/^\s\+//g;s/translate//g;s/transform=//g;s/["|(|)]//g;s/.*,//g' >> $YCOORDS
# dann aus den Linien # dann aus den Linien
cat $GLYPH | grep y1= | sed "s/^\s\+//g;s/y1=//g;s/\"//g" >> $YCOORDS cat $GLYPH | grep y1= | sed "s/^\s\+//g;s/y1=//g;s/\"//g" >> $YCOORDS
cat $GLYPH | grep y2= | sed "s/^\s\+//g;s/y2=//g;s/\"//g" >> $YCOORDS cat $GLYPH | grep y2= | sed "s/^\s\+//g;s/y2=//g;s/\"//g" >> $YCOORDS
@@ -130,7 +130,7 @@ NPATTERN=`cat $GLYPH | egrep ">x[0-9]+<" | sed "s/.*\(x[0-9]\+\).*/\1/g" | wc -
## und in die Buchstabenconfig schreiben ## und in die Buchstabenconfig schreiben
rm -f $CONFIG rm -f $CONFIG
echo [$BASE.svg] >> $CONFIG echo [$BASE] >> $CONFIG
echo "XSTEP=$XSTEP" >> $CONFIG echo "XSTEP=$XSTEP" >> $CONFIG
echo "XMIN=$XMIN" >> $CONFIG echo "XMIN=$XMIN" >> $CONFIG
echo "XMAX=$XMAX" >> $CONFIG echo "XMAX=$XMAX" >> $CONFIG
@@ -138,6 +138,7 @@ echo "YSTEP=$YSTEP" >> $CONFIG
echo "YMIN=$YMIN" >> $CONFIG echo "YMIN=$YMIN" >> $CONFIG
echo "YMAX=$YMAX" >> $CONFIG echo "YMAX=$YMAX" >> $CONFIG
echo "NPATTERN=$NPATTERN" >> $CONFIG echo "NPATTERN=$NPATTERN" >> $CONFIG
echo "FILENAME=$BASE.svg" >> $CONFIG
echo "#" >> $CONFIG echo "#" >> $CONFIG
+1 -1
View File
@@ -2,4 +2,4 @@
. setenv.sh . setenv.sh
# Startet das Programm # Startet das Programm
python $MAPSGEN_LIBS/routesgen.py "$@" python $PICCREATE_LIBS/piccreate.py "$@"
+13 -5
View File
@@ -1,18 +1,26 @@
# wie gross soll das Bild werden # wie gross soll das Bild werden
[globals] [globals]
# angabe als default in punkt. Ansonsten mm hinten dran.
width=1200 width=1200
height=1200 height=1200
content=PunkteName # was soll wohin geschrieben werden (,..,..)
lines=PunkteName
# Die Überschriften der csv-Eingabedatei werden so nach intern übersetzt:
# Die Eingabedatei sieht so aus
[translation] [translation]
customerid=Kennummer customerid=Kennummer
name = Name name = Name
# das ist der erste und einzige Inhalt # das ist die TextZeile die auf das Bild kommt
[PunkteName] [PunkteName]
# hier der Inhalt aus der Eingabedatei, der geschrieben werden soll
content=${name} content=${name}
# Ab dem Punkt wird zu schreiben begonnen
x=10 x=10
y=20 y=20
font=ausgangsschrift length=200
# Fontname und Fonttyp
fontname=ausgangsschrift
fonttype=replace_strings
#align=center,left,right
align=left
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+60 -300
View File
@@ -1,4 +1,4 @@
[a.svg] [a]
XSTEP=48.926113 XSTEP=48.926113
XMIN=37.793247 XMIN=37.793247
XMAX=86.71936 XMAX=86.71936
@@ -6,8 +6,9 @@ YSTEP=59.01624
YMIN=82.02858 YMIN=82.02858
YMAX=141.04482 YMAX=141.04482
NPATTERN=11 NPATTERN=11
FILENAME=a.svg
# #
[A.svg] [A]
XSTEP=91.00950 XSTEP=91.00950
XMIN=161.38126 XMIN=161.38126
XMAX=252.39076 XMAX=252.39076
@@ -15,8 +16,9 @@ YSTEP=78.142116
YMIN=98.253494 YMIN=98.253494
YMAX=176.39561 YMAX=176.39561
NPATTERN=6 NPATTERN=6
FILENAME=A.svg
# #
[ä.svg] [ä]
XSTEP=48.926113 XSTEP=48.926113
XMIN=37.793247 XMIN=37.793247
XMAX=86.71936 XMAX=86.71936
@@ -24,35 +26,9 @@ YSTEP=53.585981
YMIN=87.458839 YMIN=87.458839
YMAX=141.04482 YMAX=141.04482
NPATTERN=11 NPATTERN=11
FILENAME=ä.svg
# #
[a.svg] [b]
XSTEP=48.926113
XMIN=37.793247
XMAX=86.71936
YSTEP=59.01624
YMIN=82.02858
YMAX=141.04482
NPATTERN=11
#
[A.svg]
XSTEP=91.00950
XMIN=161.38126
XMAX=252.39076
YSTEP=78.142116
YMIN=98.253494
YMAX=176.39561
NPATTERN=6
#
[ä.svg]
XSTEP=48.926113
XMIN=37.793247
XMAX=86.71936
YSTEP=53.585981
YMIN=87.458839
YMAX=141.04482
NPATTERN=11
#
[b.svg]
XSTEP=47.496597 XSTEP=47.496597
XMIN=40.670943 XMIN=40.670943
XMAX=88.16754 XMAX=88.16754
@@ -60,8 +36,9 @@ YSTEP=82.180159
YMIN=58.597641 YMIN=58.597641
YMAX=140.7778 YMAX=140.7778
NPATTERN=8 NPATTERN=8
FILENAME=b.svg
# #
[c.svg] [c]
XSTEP=48.818663 XSTEP=48.818663
XMIN=25.357141 XMIN=25.357141
XMAX=74.175804 XMAX=74.175804
@@ -69,8 +46,9 @@ YSTEP=55.129491
YMIN=86.146469 YMIN=86.146469
YMAX=141.27596 YMAX=141.27596
NPATTERN=7 NPATTERN=7
FILENAME=c.svg
# #
[d.svg] [d]
XSTEP=45.671574 XSTEP=45.671574
XMIN=37.857143 XMIN=37.857143
XMAX=83.528717 XMAX=83.528717
@@ -78,8 +56,9 @@ YSTEP=84.426027
YMIN=56.351773 YMIN=56.351773
YMAX=140.7778 YMAX=140.7778
NPATTERN=9 NPATTERN=9
FILENAME=d.svg
# #
[e.svg] [e]
XSTEP=45.671574 XSTEP=45.671574
XMIN=37.857143 XMIN=37.857143
XMAX=83.528717 XMAX=83.528717
@@ -87,8 +66,9 @@ YSTEP=84.426027
YMIN=56.351773 YMIN=56.351773
YMAX=140.7778 YMAX=140.7778
NPATTERN=8 NPATTERN=8
FILENAME=e.svg
# #
[f.svg] [f]
XSTEP=62.222975 XSTEP=62.222975
XMIN=26.070276 XMIN=26.070276
XMAX=88.293251 XMAX=88.293251
@@ -96,8 +76,9 @@ YSTEP=112.194137
YMIN=56.351773 YMIN=56.351773
YMAX=168.54591 YMAX=168.54591
NPATTERN=7 NPATTERN=7
FILENAME=f.svg
# #
[g.svg] [g]
XSTEP=40.361546 XSTEP=40.361546
XMIN=37.857143 XMIN=37.857143
XMAX=78.218689 XMAX=78.218689
@@ -105,8 +86,9 @@ YSTEP=79.043151
YMIN=86.933609 YMIN=86.933609
YMAX=165.97676 YMAX=165.97676
NPATTERN=10 NPATTERN=10
FILENAME=g.svg
# #
[h.svg] [h]
XSTEP=44.844379 XSTEP=44.844379
XMIN=40.923481 XMIN=40.923481
XMAX=85.76786 XMAX=85.76786
@@ -114,8 +96,9 @@ YSTEP=83.657337
YMIN=56.351773 YMIN=56.351773
YMAX=140.00911 YMAX=140.00911
NPATTERN=8 NPATTERN=8
FILENAME=h.svg
# #
[i.svg] [i]
XSTEP=26.920635 XSTEP=26.920635
XMIN=40.923481 XMIN=40.923481
XMAX=67.844116 XMAX=67.844116
@@ -123,8 +106,9 @@ YSTEP=49.075497
YMIN=90.933613 YMIN=90.933613
YMAX=140.00911 YMAX=140.00911
NPATTERN=3 NPATTERN=3
FILENAME=i.svg
# #
[j.svg] [j]
XSTEP=32.778714 XSTEP=32.778714
XMIN=39.69973 XMIN=39.69973
XMAX=72.478444 XMAX=72.478444
@@ -132,8 +116,9 @@ YSTEP=86.873117
YMIN=90.949503 YMIN=90.949503
YMAX=177.82262 YMAX=177.82262
NPATTERN=4 NPATTERN=4
FILENAME=j.svg
# #
[k.svg] [k]
XSTEP=44.844379 XSTEP=44.844379
XMIN=40.923481 XMIN=40.923481
XMAX=85.76786 XMAX=85.76786
@@ -141,8 +126,9 @@ YSTEP=83.657337
YMIN=56.351773 YMIN=56.351773
YMAX=140.00911 YMAX=140.00911
NPATTERN=9 NPATTERN=9
FILENAME=k.svg
# #
[l.svg] [l]
XSTEP=30.443329 XSTEP=30.443329
XMIN=39.155411 XMIN=39.155411
XMAX=69.59874 XMAX=69.59874
@@ -150,8 +136,9 @@ YSTEP=85.361007
YMIN=54.351773 YMIN=54.351773
YMAX=139.71278 YMAX=139.71278
NPATTERN=5 NPATTERN=5
FILENAME=l.svg
# #
[m.svg] [m]
XSTEP=56.972673 XSTEP=56.972673
XMIN=40.670943 XMIN=40.670943
XMAX=97.643616 XMAX=97.643616
@@ -159,8 +146,9 @@ YSTEP=50.021549
YMIN=89.943771 YMIN=89.943771
YMAX=139.96532 YMAX=139.96532
NPATTERN=6 NPATTERN=6
FILENAME=m.svg
# #
[n.svg] [n]
XSTEP=33.861527 XSTEP=33.861527
XMIN=40.670631 XMIN=40.670631
XMAX=74.532158 XMAX=74.532158
@@ -168,8 +156,9 @@ YSTEP=51.034898
YMIN=89.923462 YMIN=89.923462
YMAX=140.95836 YMAX=140.95836
NPATTERN=4 NPATTERN=4
FILENAME=n.svg
# #
[o.svg] [o]
XSTEP=44.189552 XSTEP=44.189552
XMIN=37.604607 XMIN=37.604607
XMAX=81.794159 XMAX=81.794159
@@ -177,8 +166,9 @@ YSTEP=52.851279
YMIN=86.949501 YMIN=86.949501
YMAX=139.80078 YMAX=139.80078
NPATTERN=7 NPATTERN=7
FILENAME=o.svg
# #
[ö.svg] [ö]
XSTEP=44.189552 XSTEP=44.189552
XMIN=37.604607 XMIN=37.604607
XMAX=81.794159 XMAX=81.794159
@@ -186,8 +176,9 @@ YSTEP=52.851279
YMIN=86.949501 YMIN=86.949501
YMAX=139.80078 YMAX=139.80078
NPATTERN=7 NPATTERN=7
FILENAME=ö.svg
# #
[p.svg] [p]
XSTEP=59.892257 XSTEP=59.892257
XMIN=40.670943 XMIN=40.670943
XMAX=100.5632 XMAX=100.5632
@@ -195,8 +186,9 @@ YSTEP=81.135549
YMIN=86.949501 YMIN=86.949501
YMAX=168.08505 YMAX=168.08505
NPATTERN=6 NPATTERN=6
FILENAME=p.svg
# #
[q.svg] [q]
XSTEP=43.330403 XSTEP=43.330403
XMIN=37.857143 XMIN=37.857143
XMAX=81.187546 XMAX=81.187546
@@ -204,8 +196,9 @@ YSTEP=87.881971
YMIN=86.933609 YMIN=86.933609
YMAX=174.81558 YMAX=174.81558
NPATTERN=9 NPATTERN=9
FILENAME=q.svg
# #
[r.svg] [r]
XSTEP=41.892259 XSTEP=41.892259
XMIN=40.670943 XMIN=40.670943
XMAX=82.563202 XMAX=82.563202
@@ -213,8 +206,9 @@ YSTEP=52.883019
YMIN=86.949501 YMIN=86.949501
YMAX=139.83252 YMAX=139.83252
NPATTERN=5 NPATTERN=5
FILENAME=r.svg
# #
[s.svg] [s]
XSTEP=51.170281 XSTEP=51.170281
XMIN=32.464355 XMIN=32.464355
XMAX=83.634636 XMAX=83.634636
@@ -222,8 +216,9 @@ YSTEP=51.570249
YMIN=87.556641 YMIN=87.556641
YMAX=139.12689 YMAX=139.12689
NPATTERN=9 NPATTERN=9
FILENAME=s.svg
# #
[t.svg] [t]
XSTEP=35.957913 XSTEP=35.957913
XMIN=39.857143 XMIN=39.857143
XMAX=75.815056 XMAX=75.815056
@@ -231,8 +226,9 @@ YSTEP=89.266571
YMIN=50.648319 YMIN=50.648319
YMAX=139.91489 YMAX=139.91489
NPATTERN=6 NPATTERN=6
FILENAME=t.svg
# #
[u.svg] [u]
XSTEP=38.788182 XSTEP=38.788182
XMIN=37.857143 XMIN=37.857143
XMAX=76.645325 XMAX=76.645325
@@ -240,8 +236,9 @@ YSTEP=51.759197
YMIN=88.155693 YMIN=88.155693
YMAX=139.91489 YMAX=139.91489
NPATTERN=6 NPATTERN=6
FILENAME=u.svg
# #
[ü.svg] [ü]
XSTEP=38.788182 XSTEP=38.788182
XMIN=37.857143 XMIN=37.857143
XMAX=76.645325 XMAX=76.645325
@@ -249,8 +246,9 @@ YSTEP=51.759197
YMIN=88.155693 YMIN=88.155693
YMAX=139.91489 YMAX=139.91489
NPATTERN=6 NPATTERN=6
FILENAME=ü.svg
# #
[v.svg] [v]
XSTEP=33.641430 XSTEP=33.641430
XMIN=43.596195 XMIN=43.596195
XMAX=77.237625 XMAX=77.237625
@@ -258,8 +256,9 @@ YSTEP=51.759197
YMIN=88.155693 YMIN=88.155693
YMAX=139.91489 YMAX=139.91489
NPATTERN=3 NPATTERN=3
FILENAME=v.svg
# #
[w.svg] [w]
XSTEP=54.652701 XSTEP=54.652701
XMIN=46.178969 XMIN=46.178969
XMAX=100.83167 XMAX=100.83167
@@ -267,8 +266,9 @@ YSTEP=52.712848
YMIN=87.202042 YMIN=87.202042
YMAX=139.91489 YMAX=139.91489
NPATTERN=5 NPATTERN=5
FILENAME=w.svg
# #
[x.svg] [x]
XSTEP=32.819220 XSTEP=32.819220
XMIN=40.418405 XMIN=40.418405
XMAX=73.237625 XMAX=73.237625
@@ -276,8 +276,9 @@ YSTEP=52.832917
YMIN=87.220413 YMIN=87.220413
YMAX=140.05333 YMAX=140.05333
NPATTERN=5 NPATTERN=5
FILENAME=x.svg
# #
[y.svg] [y]
XSTEP=54.550602 XSTEP=54.550602
XMIN=30.800945 XMIN=30.800945
XMAX=85.351547 XMAX=85.351547
@@ -285,251 +286,9 @@ YSTEP=80.906087
YMIN=87.220413 YMIN=87.220413
YMAX=168.1265 YMAX=168.1265
NPATTERN=8 NPATTERN=8
FILENAME=y.svg
# #
[z.svg] [z]
XSTEP=32.865477
XMIN=40.846478
XMAX=73.711955
YSTEP=80.906087
YMIN=87.220413
YMAX=168.1265
NPATTERN=6
#
[b.svg]
XSTEP=47.496597
XMIN=40.670943
XMAX=88.16754
YSTEP=82.180159
YMIN=58.597641
YMAX=140.7778
NPATTERN=8
#
[c.svg]
XSTEP=48.818663
XMIN=25.357141
XMAX=74.175804
YSTEP=55.129491
YMIN=86.146469
YMAX=141.27596
NPATTERN=7
#
[d.svg]
XSTEP=45.671574
XMIN=37.857143
XMAX=83.528717
YSTEP=84.426027
YMIN=56.351773
YMAX=140.7778
NPATTERN=9
#
[e.svg]
XSTEP=45.671574
XMIN=37.857143
XMAX=83.528717
YSTEP=84.426027
YMIN=56.351773
YMAX=140.7778
NPATTERN=8
#
[f.svg]
XSTEP=62.222975
XMIN=26.070276
XMAX=88.293251
YSTEP=112.194137
YMIN=56.351773
YMAX=168.54591
NPATTERN=7
#
[g.svg]
XSTEP=40.361546
XMIN=37.857143
XMAX=78.218689
YSTEP=79.043151
YMIN=86.933609
YMAX=165.97676
NPATTERN=10
#
[h.svg]
XSTEP=44.844379
XMIN=40.923481
XMAX=85.76786
YSTEP=83.657337
YMIN=56.351773
YMAX=140.00911
NPATTERN=8
#
[i.svg]
XSTEP=26.920635
XMIN=40.923481
XMAX=67.844116
YSTEP=49.075497
YMIN=90.933613
YMAX=140.00911
NPATTERN=3
#
[j.svg]
XSTEP=32.778714
XMIN=39.69973
XMAX=72.478444
YSTEP=86.873117
YMIN=90.949503
YMAX=177.82262
NPATTERN=4
#
[k.svg]
XSTEP=44.844379
XMIN=40.923481
XMAX=85.76786
YSTEP=83.657337
YMIN=56.351773
YMAX=140.00911
NPATTERN=9
#
[l.svg]
XSTEP=30.443329
XMIN=39.155411
XMAX=69.59874
YSTEP=85.361007
YMIN=54.351773
YMAX=139.71278
NPATTERN=5
#
[m.svg]
XSTEP=56.972673
XMIN=40.670943
XMAX=97.643616
YSTEP=50.021549
YMIN=89.943771
YMAX=139.96532
NPATTERN=6
#
[n.svg]
XSTEP=33.861527
XMIN=40.670631
XMAX=74.532158
YSTEP=51.034898
YMIN=89.923462
YMAX=140.95836
NPATTERN=4
#
[o.svg]
XSTEP=44.189552
XMIN=37.604607
XMAX=81.794159
YSTEP=52.851279
YMIN=86.949501
YMAX=139.80078
NPATTERN=7
#
[ö.svg]
XSTEP=44.189552
XMIN=37.604607
XMAX=81.794159
YSTEP=52.851279
YMIN=86.949501
YMAX=139.80078
NPATTERN=7
#
[p.svg]
XSTEP=59.892257
XMIN=40.670943
XMAX=100.5632
YSTEP=81.135549
YMIN=86.949501
YMAX=168.08505
NPATTERN=6
#
[q.svg]
XSTEP=43.330403
XMIN=37.857143
XMAX=81.187546
YSTEP=87.881971
YMIN=86.933609
YMAX=174.81558
NPATTERN=9
#
[r.svg]
XSTEP=41.892259
XMIN=40.670943
XMAX=82.563202
YSTEP=52.883019
YMIN=86.949501
YMAX=139.83252
NPATTERN=5
#
[s.svg]
XSTEP=51.170281
XMIN=32.464355
XMAX=83.634636
YSTEP=51.570249
YMIN=87.556641
YMAX=139.12689
NPATTERN=9
#
[t.svg]
XSTEP=35.957913
XMIN=39.857143
XMAX=75.815056
YSTEP=89.266571
YMIN=50.648319
YMAX=139.91489
NPATTERN=6
#
[u.svg]
XSTEP=38.788182
XMIN=37.857143
XMAX=76.645325
YSTEP=51.759197
YMIN=88.155693
YMAX=139.91489
NPATTERN=6
#
[ü.svg]
XSTEP=38.788182
XMIN=37.857143
XMAX=76.645325
YSTEP=51.759197
YMIN=88.155693
YMAX=139.91489
NPATTERN=6
#
[v.svg]
XSTEP=33.641430
XMIN=43.596195
XMAX=77.237625
YSTEP=51.759197
YMIN=88.155693
YMAX=139.91489
NPATTERN=3
#
[w.svg]
XSTEP=54.652701
XMIN=46.178969
XMAX=100.83167
YSTEP=52.712848
YMIN=87.202042
YMAX=139.91489
NPATTERN=5
#
[x.svg]
XSTEP=32.819220
XMIN=40.418405
XMAX=73.237625
YSTEP=52.832917
YMIN=87.220413
YMAX=140.05333
NPATTERN=5
#
[y.svg]
XSTEP=54.550602
XMIN=30.800945
XMAX=85.351547
YSTEP=80.906087
YMIN=87.220413
YMAX=168.1265
NPATTERN=8
#
[z.svg]
XSTEP=32.865477 XSTEP=32.865477
XMIN=40.846478 XMIN=40.846478
XMAX=73.711955 XMAX=73.711955
@@ -537,4 +296,5 @@ YSTEP=80.906087
YMIN=87.220413 YMIN=87.220413
YMAX=168.1265 YMAX=168.1265
NPATTERN=6 NPATTERN=6
FILENAME=z.svg
# #
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+1 -1
View File
@@ -1,4 +1,4 @@
<g translate(${posx},${posy})> <g transform="translate(${posx},${posy})">
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" style="font-size:40px;font-style:normal;font-weight:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+5
View File
@@ -0,0 +1,5 @@
Kennummer;Name
001;michael
002;eva
003;caroline
004;Alter
1 Kennummer Name
2 001 michael
3 002 eva
4 003 caroline
5 004 Alter
+5
View File
@@ -0,0 +1,5 @@
Kennummer;Name
001;aa
002;ab
003;ba
004;bb
1 Kennummer Name
2 001 aa
3 002 ab
4 003 ba
5 004 bb
+209 -8
View File
@@ -9,9 +9,204 @@ __license__ = 'BSD'
import optparse import optparse
import os import os
import ConfigParser import ConfigParser
from utils import CSVImport from utils import CSVImport, CompleteEnding, get_translation
from django.utils.encoding import smart_unicode, smart_str #from django.utils.encoding import smart_unicode, smart_str
from string import Template
class PicError(Exception):
"""class for Picture createion exceptions in this module."""
pass
def create_picture_frame( config ):
params = dict()
params['width'] = config.get('globals', 'width')
params['height'] = config.get('globals', 'height')
#echo '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">'
begintpl = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="${width}"
height="${height}"
>
'''
svgbegin = Template( begintpl ).substitute(params)
svgend = '</svg>'
return svgbegin, svgend
def write_font_line( content, font, params ):
''' erzeugt den SVG Teil des Bildes aus Einzelkomponenten
'''
w = Word(content, font, params)
return w.GetSVG()
def write_random_font_line( config, fontinfos, data ):
''' erzeugt den SVG Teil des Bildes aus einem Hintergrundbild und
mehreren in Einzelbereichen zufällig platzierten Einzelbildern '''
# TODO Bild aus Zufallspositionen von Einzelkomponenten
pass
class Word:
"""Berechnet die x/y Daten jedes Buchstabn zu einem Wort bzw. mehreren
Wörtern einer Zeile nach den Vorgaben """
def __init__(self, line, font, params ):
self.line = line
self.font = font
self.params = params
def __repr__(self):
return self.line
def calc_length(self):
deltax= 0.0
for c in self.line:
g = self.font.GlyphGet(c)
deltax = g.GetLength() + deltax
return deltax
def GetSVG(self):
params = self.params
content = dict()
content['posy'] = params['y']
# berechne immer den richtigen Startpunkt, je nach Bündigkeit
if params['align'] == 'left':
x = float(params['x'])
elif params['align'] == 'center':
word_length = self.calc_length()
x = float(params['x'] + (params['length'] - word_length)/2.0)
else:
word_length = self.calc_length()
x = float(params['x'] + word_length - params['length'])
svgstr = ''
for c in self.line:
g = self.font.GlyphGet(c)
x = g.GetLength() + x
content['posx'] = str(x)
svgstr = svgstr + g.GetSVG(content)
return svgstr
class Glyph:
"""enthaelt alle Daten zu einem Buchstaben """
def __init__(self, glyphname, attributes, template):
self.glyphname = glyphname
self.attributes = attributes
self.template = template
def __repr__(self):
return self.glyphname
def GetAttribute(self, att):
return self.attributes[att]
def GetLength(self):
return float(self.GetAttribute('xstep'))
def GetHeight(self):
return float(self.GetAttribute('ystep'))
def GetSVG(self, content):
t = Template(self.template)
return t.substitute(content)
class Font:
"""enthaelt alle Daten zu einem Font """
def __init__(self, fontname, font_path ):
self.name = fontname
self.path = font_path
self.glyphs = dict()
fontconfig = ConfigParser.RawConfigParser()
config_path = os.path.join(font_path, fontname+'.cfg')
fontconfig.read(config_path)
# lies alle Zeichen des Fonts ein
for letter in fontconfig.sections():
# hol die Fontattribute wie Ausdehnung usw.
content = dict(fontconfig.items(letter))
# lade das svg template dazu ein
glyph_path = os.path.join( font_path, letter+'.svg')
f = open(glyph_path, 'r')
svgstr = f.read()
f.close()
# und bau das Zeichen auf
g = Glyph(letter, content, svgstr)
self.glyphs[letter] = g
def __repr__(self):
return repr(self.glyphs)
def GlyphGet(self, glyphname):
return self.glyphs[glyphname]
def init_fonts( config ):
''' lädt alle benötigten Fonts für den Auftrag in den Speicher
'''
fontinfos = dict()
#[globals]
## was soll wohin geschrieben werden:
#lines=MeineZeile, bla
## das ist die TextZeile die auf das Bild kommt
#[MeineZeile]
#..inhalte und wohin es kommt
## Fontname und Fonttyp
#font=ausgangsschrift
#fonttype=replace_strings
#
#[bla]
# ...
lines = config.get('globals', 'lines').split(',')
for linename in lines:
fontname = config.get(linename, 'fontname')
font_path = os.path.expandvars(os.path.join('$PICCREATE_FONTS', fontname ))
f = Font(fontname, font_path)
fontinfos[fontname] = f
return fontinfos
def create_picture(config, fontinfos, data, pic_path):
''' schreibt den svg String des Bildes
'''
svgstr = ''
begin, end = create_picture_frame( config )
svgstr = svgstr + begin
# gehe alle Zeilen die im Bild enthalten sein müssen durch
lines = config.get('globals', 'lines').split(',')
for linename in lines:
#[ZeilenBezeichner]
#content=${name}
## Ab dem Punkt wird zu schreiben begonnen
#x=10
#y=20
#lenght=2000
# hol den Inhalt der Zeile die ausgeben werden muss
content_template = config.get(linename, 'content')
t = Template( content_template )
content = t.substitute(data)
# hol dir dazu den Passenden Font für diese Zeile
fontname = config.get(linename, 'fontname')
font = fontinfos[fontname]
# hol dir die Eckdaten für die Zeile
params = dict()
params['x'] = config.get(linename, 'x')
params['y'] = config.get(linename, 'y')
params['length']= config.get(linename, 'length')
params['align']= config.get(linename, 'align')
picstr = write_font_line( content, font, params )
if picstr: svgstr = svgstr + picstr
randstr = write_random_font_line( content, font, params)
if randstr: svgstr = svgstr + randstr
svgstr = svgstr + end
if options.dry:
print svgstr
else:
f = open(pic_path, 'w')
f.write( svgstr )
f.close()
def main( config ): def main( config ):
@@ -39,14 +234,20 @@ def main( config ):
config = ConfigParser.RawConfigParser() config = ConfigParser.RawConfigParser()
config.read(config_path) config.read(config_path)
targets = config.get('globals', 'targets')
Trans = get_translation(config_path, 'translation') Trans = get_translation(config_path, 'translation')
Rows = CSVImport(in_path, translate=Trans) Rows = CSVImport(in_path, translate=Trans)
for data in Rows:
filename = data.customerid fontinfos = init_fonts( config )
pic_path = os.path.join(out_path, filename )) for row in Rows:
create_picture(data, ) filename = row.customerid
print filename
content = row.__dict__
del content['firstrow']
del content['row']
pic_path = os.path.join(out_path, filename+'.svg')
create_picture(config, fontinfos, content, pic_path)
if __name__ == '__main__': if __name__ == '__main__':
@@ -84,4 +285,4 @@ Read Confg, create wakeup and scale this kind of jiffy box
else: else:
pass pass
# vim: set tw=75 ft=python ts=4 sw=4: # vim: set tw=75 ft=python ts=4 sw=4 tw=80: