Mercurial > laserkard
comparison js-lib/buy3.js @ 102:8ed3394e6b73 laserkard
wrote comment-killer
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 27 Jul 2010 22:23:13 -0400 |
parents | 595866daadbe |
children | 52297178e0eb |
comparison
equal
deleted
inserted
replaced
101:2bec541ef58f | 102:8ed3394e6b73 |
---|---|
13 var helvetica = paper.getFont('HelveticaNeue', 700); | 13 var helvetica = paper.getFont('HelveticaNeue', 700); |
14 var helveticaI = paper.getFont('HelveticaNeue', 800); | 14 var helveticaI = paper.getFont('HelveticaNeue', 800); |
15 var h = paper.height; | 15 var h = paper.height; |
16 var w = paper.width; | 16 var w = paper.width; |
17 | 17 |
18 var standard = (function (text, x, y, pt, font){ | |
19 if (!font) {font = helvetica;} | |
20 var scale_x = 0.00030*h*pt/20; | |
21 var scale_y = 0.00025*w*pt/20; | |
22 return paper.print(h*x, w*y,text, font).scale( | |
23 scale_x,scale_y,h*x,w*y);}); | |
24 | |
25 var bold = { | |
26 "name" :(function (text){ | |
27 return standard(text, 0.2,0.1,20).attr({"fill" : "red"});}), | |
28 "email" : (function (text){ | |
29 return standard(text, 0.2,0.4,20,helveticaI).attr( | |
30 {"fill" : "red"});})}; | |
31 | |
32 | |
18 return { | 33 return { |
19 "bold" : { | 34 "bold" : bold |
20 "name" :(function (text){ | |
21 var x = w*0.1; var y = h*0.2; | |
22 return paper.print(x,y,text,helvetica).attr( | |
23 {"fill" : "red"}).scale(0.0002*h,0.00025*w,x,y);}), | |
24 "email" : (function (text){ | |
25 var x = w*0.1; var y = h*0.4; | |
26 return paper.print(x,y,text,helveticaI).attr( | |
27 {"fill" : "red"}).scale(0.0002*h,0.00025*w,x,y);})} | |
28 }; | 35 }; |
29 | 36 |
30 }); | 37 }); |
31 | 38 |
32 | 39 |