git ssb

0+

cel / ssb-invitation-cards



Commit 7370815b9a6e1bae472e62c591ddd0fc0e222b57

Factor out card into theme file

cel committed on 1/25/2019, 10:03:46 PM
Parent: b2d0368816eaed34a39c0101fed0639cdf4146b3

Files changed

Makefilechanged
cards.pschanged
gencards.shchanged
common.psadded
themes/original.psadded
MakefileView
@@ -1,4 +1,6 @@
1 +THEME = themes/original.ps
2 +
13 all: view-cards.pid
24
35 view-cards.pid: cards.pdf
46 test -s $@ && kill -HUP $$(cat $@) 2>/dev/null && touch $@ || (mupdf -r 120 $< & echo $$! > $@)
@@ -8,10 +10,10 @@
810
911 config.ps:
1012 test -s config.ps || cp config.example.ps $@
1113
12-cards.pdf: cards.ps config.ps urls
13- ./gencards.sh > $@ < urls
14 +cards.pdf: gencards.sh cards.ps config.ps common.ps urls Makefile $(THEME)
15 + ./gencards.sh $@ $(THEME) < urls
1416
1517 clean:
1618 rm -f cards.pdf
1719
cards.psView
@@ -3,16 +3,12 @@
33 %%LanguageLevel: 2
44 %%EndComments
55 %%BeginProlog
66
7-/inch {72 mul} def
8-
97 /MarginLeft {.75 inch} def
108 /MarginBottom {.5 inch} def
119 /NumRows 5 def
1210 /NumCols 2 def
13-/CardWidth {3.5 inch} def
14-/CardHeight {2 inch} def
1511 /GuideSize {.4 inch} def
1612
1713 /line {
1814 newpath
@@ -20,33 +16,10 @@
2016 lineto
2117 stroke
2218 } def
2319
24-/centershow {
25- dup
26- stringwidth pop 2 div neg 0 rmoveto
27- show
28-} bind def
29-
30-/wrapshow {
31- /height exch def
32- /len exch def
33- {
34- dup length len lt {
35- show
36- exit
37- } {
38- dup % str str
39- 0 len getinterval % str strstart
40- dup show
41- stringwidth pop neg height neg rmoveto
42- dup length len sub len exch getinterval
43- } ifelse
44- } loop
45-} def
46-
4720 /urlsfile (%stdin) (r) file def
48-/url 180 string def
21 +/urlstr 180 string def
4922
5023 /DrawGuides {
5124 gsave
5225 .125 setlinewidth
@@ -92,103 +65,21 @@
9265
9366 grestore
9467 } def
9568
96-/DrawEPS {
97- /filename exch def
98- /z exch def
99- /bottom exch def
100- /left exch def
101- save
102- left bottom translate
103- z z scale
104- /showpage { } def
105- filename run
106-
107- % see PLRM.pdf page 732
108- 0 setgray
109- 0 setlinecap
110- 1 setlinewidth
111- 0 setlinejoin
112- 10 setmiterlimit
113- [ ] 0 setdash newpath
114- /languagelevel where {
115- pop languagelevel 1 ne {
116- false setstrokeadjust
117- false setoverprint
118- } if
119- } if
120-
121- %/Dict_Count countdictstack def
122- %/Op_Count count def
123- %begin
124-
125- %end
126- %count
127- restore
128-} def
129-
130-/DrawCardFront {
69 +/DrawCardFrontWrap {
13170 gsave
132- urlsfile url readline {
133- /url1 exch def
134-
135- /LiberationSans 16 selectfont
136- (Secure Scuttlebutt Network)
137- 126 117 moveto centershow
138-
139- /LiberationSans 13 selectfont
140- (Invitation Link:)
141- 126 96 moveto centershow
142-
143- currentrgbcolor
144- 0 0 1 setrgbcolor
145- /LiberationMono 14 selectfont
146- .25 inch 1 inch moveto
147- url1
148- 25 14 wrapshow
149- setrgbcolor
150-
151- /w 48 def
152- /z 1.5 def
153- 126 w z mul 2 div sub
154- 12
155- z
156- (small-hermes-hearts-0.eps) DrawEPS
157-
71 + urlsfile urlstr readline {
72 + /url exch def
73 + DrawCardFront
15874 /drewsome true def
15975 } if
16076 grestore
16177 } def
16278
163-/DrawCardBack {
79 +/DrawCardBackWrap {
16480 gsave
165-
166- /LiberationSans 12 selectfont
167- 16 117 moveto
168- pub_name show
169-
170- /LiberationMono 8 selectfont
171- pub_id
172- 16 102 moveto
173- 27 10 wrapshow
174-
175- /LiberationSans 12 selectfont
176- 16 68 moveto
177- op_name show
178-
179- /LiberationMono 8 selectfont
180- op_id
181- 16 53 moveto
182- 27 10 wrapshow
183-
184- 180 62 1 3 div
185- (rainbow-hermies-strong-border.eps) DrawEPS
186-
187- /LiberationSans 10 selectfont
188- 12 16 moveto
189- (decentralized - peer-to-peer - off-grid - open source) show
190-
81 + DrawCardBack
19182 grestore
19283 } def
19384
19485 currentpagedevice /PageSize get dup
@@ -206,11 +97,11 @@
20697 %NumCols {
20798 % DrawCard
20899 % CardWidth 0 translate
209100 %} repeat
210- DrawCardFront
101 + DrawCardFrontWrap
211102 CardWidth 0 translate
212- DrawCardBack
103 + DrawCardBackWrap
213104 CardWidth 0 translate
214105 NumCols CardWidth mul neg CardHeight neg translate
215106 } repeat
216107 0 NumRows CardHeight mul neg translate
gencards.shView
@@ -1,3 +1,3 @@
11 #!/bin/sh
22 cd "$(dirname "$0")"
3-exec gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=- -f config.ps -f cards.ps
3 +exec gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="${1?output.pdf}" -f config.ps -f common.ps -f "${2?theme.pdf}" -f cards.ps
common.psView
@@ -1,0 +1,66 @@
1 +%!PS-Adobe-3.0
2 +%%Title: some shared code
3 +%%LanguageLevel: 2
4 +%%EndComments
5 +%%BeginProlog
6 +
7 +/inch {72 mul} def
8 +/CardWidth {3.5 inch} def
9 +/CardHeight {2 inch} def
10 +
11 +/centershow {
12 + dup
13 + stringwidth pop 2 div neg 0 rmoveto
14 + show
15 +} bind def
16 +
17 +/wrapshow {
18 + /height exch def
19 + /len exch def
20 + {
21 + dup length len lt {
22 + show
23 + exit
24 + } {
25 + dup % str str
26 + 0 len getinterval % str strstart
27 + dup show
28 + stringwidth pop neg height neg rmoveto
29 + dup length len sub len exch getinterval
30 + } ifelse
31 + } loop
32 +} def
33 +
34 +/DrawEPS {
35 + /filename exch def
36 + /z exch def
37 + /bottom exch def
38 + /left exch def
39 + save
40 + left bottom translate
41 + z z scale
42 + /showpage { } def
43 + filename run
44 +
45 + % see PLRM.pdf page 732
46 + 0 setgray
47 + 0 setlinecap
48 + 1 setlinewidth
49 + 0 setlinejoin
50 + 10 setmiterlimit
51 + [ ] 0 setdash newpath
52 + /languagelevel where {
53 + pop languagelevel 1 ne {
54 + false setstrokeadjust
55 + false setoverprint
56 + } if
57 + } if
58 +
59 + %/Dict_Count countdictstack def
60 + %/Op_Count count def
61 + %begin
62 +
63 + %end
64 + %count
65 + restore
66 +} def
themes/original.psView
@@ -1,0 +1,58 @@
1 +%!PS-Adobe-3.0
2 +%%Title: SSB Invitation Cards - cel's original card theme
3 +%%LanguageLevel: 2
4 +%%EndComments
5 +%%BeginProlog
6 +
7 +/DrawCardFront {
8 + /LiberationSans 16 selectfont
9 + (Secure Scuttlebutt Network)
10 + 126 117 moveto centershow
11 +
12 + /LiberationSans 13 selectfont
13 + (Invitation Link:)
14 + 126 96 moveto centershow
15 +
16 + currentrgbcolor
17 + 0 0 1 setrgbcolor
18 + /LiberationMono 14 selectfont
19 + .25 inch 1 inch moveto
20 + url
21 + 25 14 wrapshow
22 + setrgbcolor
23 +
24 + /w 48 def
25 + /z 1.5 def
26 + 126 w z mul 2 div sub
27 + 12
28 + z
29 + (small-hermes-hearts-0.eps) DrawEPS
30 +} def
31 +
32 +/DrawCardBack {
33 + /LiberationSans 12 selectfont
34 + 16 117 moveto
35 + pub_name show
36 +
37 + /LiberationMono 8 selectfont
38 + pub_id
39 + 16 102 moveto
40 + 27 10 wrapshow
41 +
42 + /LiberationSans 12 selectfont
43 + 16 68 moveto
44 + op_name show
45 +
46 + /LiberationMono 8 selectfont
47 + op_id
48 + 16 53 moveto
49 + 27 10 wrapshow
50 +
51 + 180 62 1 3 div
52 + (rainbow-hermies-strong-border.eps) DrawEPS
53 +
54 + /LiberationSans 10 selectfont
55 + 12 16 moveto
56 + (decentralized - peer-to-peer - off-grid - open source) show
57 +
58 +} def

Built with git-ssb-web