|
41 | 41 | spacing: .2em, |
42 | 42 | image.decode( |
43 | 43 | encode-xml(elem.children.first()), |
44 | | - width: 1in * int(elem.children.first().attrs.width) / dpi, |
45 | | - height: 1in * int(elem.children.first().attrs.width) /dpi |
| 44 | + width: 1in * float(elem.children.first().attrs.width) / dpi, |
| 45 | + height: 1in * float(elem.children.first().attrs.width) /dpi |
46 | 46 | ), |
47 | 47 | text(elem.children.last(), size: 1in * 10/dpi) |
48 | 48 | ) |
|
68 | 68 | let legends = figuresvgs |
69 | 69 | .filter(svg => "ramp" in svg.attrs.class) |
70 | 70 | .map(svg => (..svg, attrs: (..svg.attrs, |
71 | | - width: str(int(svg.attrs.width) + 2*legend-padding), |
72 | | - viewbox: "-"+str(legend-padding)+" 0 "+str(int(svg.attrs.width)+legend-padding)+" "+str(int(svg.attrs.height))) |
| 71 | + width: str(float(svg.attrs.width) + 2*legend-padding), |
| 72 | + viewbox: "-"+str(legend-padding)+" 0 "+str(float(svg.attrs.width)+legend-padding)+" "+str(float(svg.attrs.height))) |
73 | 73 | )) |
74 | 74 | let mainfigure = figuresvgs.find(svg => "ramp" not in svg.attrs.class) |
75 | | - let figurewidth = calc.max(..figuresvgs.map(svg => int(svg.attrs.width))) |
| 75 | + let figurewidth = calc.max(..figuresvgs.map(svg => float(svg.attrs.width))) |
76 | 76 |
|
77 | 77 | set page( |
78 | 78 | width: 1in*figurewidth/dpi + 2*margin, |
|
96 | 96 | v(1in * 8/dpi) |
97 | 97 | }, |
98 | 98 | ..figure.children.filter(e => e.tag == "div").map(swatch), |
99 | | - ..legends.map(svg => image.decode(encode-xml(svg), height: 1in * int(svg.attrs.height) / dpi)), |
100 | | - image.decode(encode-xml(mainfigure), height: 1in * int(mainfigure.attrs.height) / dpi), |
| 99 | + ..legends.map(svg => image.decode(encode-xml(svg), height: 1in * float(svg.attrs.height) / dpi)), |
| 100 | + image.decode(encode-xml(mainfigure), height: 1in * float(mainfigure.attrs.height) / dpi), |
101 | 101 | if (caption != none) { |
102 | 102 | set text(size: 1in * 13/dpi, fill: rgb(caption_color), weight: 500) |
103 | 103 | text(caption.children.first()) |
|
0 commit comments