main
Elnu 1 year ago
parent 78aae3de62
commit 31b9a88edb

@ -23,11 +23,11 @@ impl SVGMeasure {
Self { measure, unit }
}
fn to_user_units(self) -> f64 {
pub fn to_user_units(self) -> f64 {
self.measure * self.unit.to_user_units()
}
fn to_unit(self, unit: SVGUnit) -> Self {
pub fn to_unit(self, unit: SVGUnit) -> Self {
SVGMeasure {
measure: self.to_user_units() / unit.to_user_units(),
unit,

@ -1,7 +1,13 @@
<svg version="1.1"
width="{{ dimensions.width }}" height="{{ dimensions.height }}"
xmlns="http://www.w3.org/2000/svg">
<defs>
<style type="text/css"><![CDATA[@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@700&display=swap');]]></style>
</defs>
{% for (x, y) in positions %}
<rect x="{{ x }}" y="{{ y }}" rx="2mm" width="{{ box_size }}" height="{{ box_size }}" fill="none" stroke="#cccccc" stroke-width="1pt" />
<g x="{{ x }}" y="{{ y }}" transform="translate({{ x.to_user_units() }},{{ y.to_user_units() }})" width="{{ box_size }}" height="{{ box_size }}">
<rect width="{{ box_size }}" height="{{ box_size }}" fill="none" stroke="#cccccc" stroke-width="1pt" rx="2mm" />
<text x="{{ box_size / 2.0 }}" y="{{ box_size / 2.0 }}" dominant-baseline="middle" text-anchor="middle" style="font-family: 'M PLUS Rounded 1c'" font-size="0.5cm"></text>
</g>
{% endfor %}
</svg>

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 804 B

Loading…
Cancel
Save