generated from ElnuDev/rust-project
Add text
This commit is contained in:
parent
78aae3de62
commit
31b9a88edb
2 changed files with 9 additions and 3 deletions
|
@ -23,11 +23,11 @@ impl SVGMeasure {
|
||||||
Self { measure, unit }
|
Self { measure, unit }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_user_units(self) -> f64 {
|
pub fn to_user_units(self) -> f64 {
|
||||||
self.measure * self.unit.to_user_units()
|
self.measure * self.unit.to_user_units()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_unit(self, unit: SVGUnit) -> Self {
|
pub fn to_unit(self, unit: SVGUnit) -> Self {
|
||||||
SVGMeasure {
|
SVGMeasure {
|
||||||
measure: self.to_user_units() / unit.to_user_units(),
|
measure: self.to_user_units() / unit.to_user_units(),
|
||||||
unit,
|
unit,
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
<svg version="1.1"
|
<svg version="1.1"
|
||||||
width="{{ dimensions.width }}" height="{{ dimensions.height }}"
|
width="{{ dimensions.width }}" height="{{ dimensions.height }}"
|
||||||
xmlns="http://www.w3.org/2000/svg">
|
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 %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 804 B |
Loading…
Add table
Reference in a new issue