Mercurial > dottes
annotate makeGraphics.sh @ 1064:6e9fe1519595 build-default-385
Update titles to Dottes standard.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Wed, 17 Mar 2021 08:40:46 +0000 |
parents | 70e1ff83fe34 |
children |
rev | line source |
---|---|
42
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
1 #!/bin/bash |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
2 # |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
3 # Make the tune graphics, EPS, PDF required by web and book into |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
4 # graphics/<book>. |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
5 # |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
6 |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
7 if [ $# != 1 ]; then |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
8 echo "Usage: makeGraphics.sh <book dir name>" |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
9 exit 1 |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
10 fi |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
11 |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
12 dir=`pwd` |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
13 |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
14 booke=$dir/$1 |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
15 graphicsdir=$dir/graphics/$1 |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
16 |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
17 mkdir -p $graphicsdir |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
18 |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
19 # Now, for each tune, make the tune graphic. |
753
b83b49f2a0a0
Correct Mac-ism. find -maxdepth n, not find -depth n.
Jim Hague <jim.hague@acm.org>
parents:
748
diff
changeset
|
20 find $booke -maxdepth 1 -name "*.abc" | |
42
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
21 while read filename |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
22 do |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
23 name=`basename $filename .abc` |
50
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
24 |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
25 # Make the tune graphic. |
122
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
118
diff
changeset
|
26 abcm2ps -E -F singletune -O $graphicsdir/$name.eps $filename |
42
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
27 # Make $name.eps so we can build with LaTeX. |
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
28 mv $graphicsdir/${name}001.eps $graphicsdir/${name}.eps |
118
8f3b50ede59c
Switch to XeTeX to render. Opens up random OpenType fonts and UTF-8.
Jim Hague <jim.hague@acm.org>
parents:
50
diff
changeset
|
29 # And make the corresponding PDF. |
303
67dc98ae4816
Crop PDFs after generation so that they don't have white borders - document can do that.
Jim Hague <jim.hague@acm.org>
parents:
122
diff
changeset
|
30 epstopdf --outfile=$graphicsdir/$name-tocrop.pdf $graphicsdir/${name}.eps |
67dc98ae4816
Crop PDFs after generation so that they don't have white borders - document can do that.
Jim Hague <jim.hague@acm.org>
parents:
122
diff
changeset
|
31 # And crop it, so the graphic is as big as possible on the page. |
67dc98ae4816
Crop PDFs after generation so that they don't have white borders - document can do that.
Jim Hague <jim.hague@acm.org>
parents:
122
diff
changeset
|
32 pdfcrop $graphicsdir/$name-tocrop.pdf $graphicsdir/$name.pdf |
67dc98ae4816
Crop PDFs after generation so that they don't have white borders - document can do that.
Jim Hague <jim.hague@acm.org>
parents:
122
diff
changeset
|
33 rm $graphicsdir/$name-tocrop.pdf |
50
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
34 |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
35 # and make the first line graphic. |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
36 $dir/abcfirstline.py $filename > firstline.abc |
313
aa803fd1c3a6
Use a abcm2pc format file to format the single lines.
Jim Hague <jim.hague@acm.org>
parents:
303
diff
changeset
|
37 abcm2ps -E -F firstline -O $graphicsdir/firstline-$name.eps firstline.abc |
50
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
38 mv $graphicsdir/firstline-${name}001.eps $graphicsdir/firstline-${name}.eps |
e666306c5ab1
Add list of tune first lines.
Jim Hague <jim.hague@laicatc.com>
parents:
42
diff
changeset
|
39 rm firstline.abc |
303
67dc98ae4816
Crop PDFs after generation so that they don't have white borders - document can do that.
Jim Hague <jim.hague@acm.org>
parents:
122
diff
changeset
|
40 epstopdf --outfile=$graphicsdir/firstline-$name-tocrop.pdf $graphicsdir/firstline-${name}.eps |
67dc98ae4816
Crop PDFs after generation so that they don't have white borders - document can do that.
Jim Hague <jim.hague@acm.org>
parents:
122
diff
changeset
|
41 # And crop it, so the graphic is as big as possible on the page. |
67dc98ae4816
Crop PDFs after generation so that they don't have white borders - document can do that.
Jim Hague <jim.hague@acm.org>
parents:
122
diff
changeset
|
42 pdfcrop $graphicsdir/firstline-$name-tocrop.pdf $graphicsdir/firstline-$name.pdf |
67dc98ae4816
Crop PDFs after generation so that they don't have white borders - document can do that.
Jim Hague <jim.hague@acm.org>
parents:
122
diff
changeset
|
43 rm $graphicsdir/firstline-$name-tocrop.pdf |
42
0e7d2830cb8b
Put making tune graphics required by web and book into separate dir and make separately.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
44 done |
748
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
45 |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
46 # And make any compact tune graphics. |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
47 if [ ! -d ${booke}/Compact ]; then |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
48 exit |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
49 fi |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
50 |
753
b83b49f2a0a0
Correct Mac-ism. find -maxdepth n, not find -depth n.
Jim Hague <jim.hague@acm.org>
parents:
748
diff
changeset
|
51 find ${booke}/Compact -maxdepth 1 -name "*.abc" | |
748
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
52 while read filename |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
53 do |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
54 name=`basename $filename .abc` |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
55 |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
56 # Make the tune graphic. |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
57 abcm2ps -E -F singletune -O $graphicsdir/compact-${name}.eps $filename |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
58 # Make $name.eps so we can build with LaTeX. |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
59 mv $graphicsdir/compact-${name}001.eps $graphicsdir/compact-${name}.eps |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
60 # And make the corresponding PDF. |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
61 epstopdf --outfile=$graphicsdir/compact-${name}-tocrop.pdf $graphicsdir/compact-${name}.eps |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
62 # And crop it, so the graphic is as big as possible on the page. |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
63 pdfcrop $graphicsdir/compact-${name}-tocrop.pdf $graphicsdir/compact-${name}.pdf |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
64 rm $graphicsdir/compact-${name}-tocrop.pdf |
ce5c7214f9aa
Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents:
313
diff
changeset
|
65 done |