generated from ElnuDev/rust-project
Add icon keys and row breaks
This commit is contained in:
parent
da997bd5b6
commit
52ed2c87d3
7 changed files with 164 additions and 0 deletions
3
dyesub-tool/assets/next.svg
Normal file
3
dyesub-tool/assets/next.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
||||
<path fill-rule="evenodd" d="M4.72 3.97a.75.75 0 011.06 0l7.5 7.5a.75.75 0 010 1.06l-7.5 7.5a.75.75 0 01-1.06-1.06L11.69 12 4.72 5.03a.75.75 0 010-1.06zm6 0a.75.75 0 011.06 0l7.5 7.5a.75.75 0 010 1.06l-7.5 7.5a.75.75 0 11-1.06-1.06L17.69 12l-6.97-6.97a.75.75 0 010-1.06z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 401 B |
124
dyesub-tool/assets/nixos.svg
Normal file
124
dyesub-tool/assets/nixos.svg
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="44.00663"
|
||||
height="38.168068"
|
||||
viewBox="0 0 41.256216 35.782565"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
sodipodi:docname="nixos.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="13.087376"
|
||||
inkscape:cx="31.442514"
|
||||
inkscape:cy="15.66395"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="g5329"
|
||||
showgrid="true"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1080"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-global="true"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
units="px"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="print-logo"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
style="display:inline"
|
||||
transform="translate(-160.45368,535.40252)" />
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="text-2"
|
||||
transform="translate(-27.871478,-422.6377)" />
|
||||
<g
|
||||
style="display:inline"
|
||||
inkscape:label="text-vegur"
|
||||
id="g5329"
|
||||
inkscape:groupmode="layer"
|
||||
transform="translate(-160.45368,535.40252)">
|
||||
<g
|
||||
transform="matrix(0.34788402,0,0,0.34788402,88.02172,-315.64249)"
|
||||
id="g892"
|
||||
style="fill:#000000">
|
||||
<path
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.709135;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 244.38844,-579.00705 28.88469,50.03541 -13.27432,0.12452 -7.71151,-13.44265 -7.76655,13.37082 -6.59552,-0.003 -3.37805,-5.83608 11.06498,-19.02614 -7.85472,-13.66872 z"
|
||||
id="path4861"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccc" />
|
||||
<path
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.709135;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 254.81405,-599.61716 -28.88958,50.03257 -6.745,-11.43362 7.78592,-13.3997 -15.46274,-0.0406 -3.29545,-5.71322 3.36517,-5.84351 22.00961,0.0695 7.9101,-13.63673 z"
|
||||
id="use4863"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccc" />
|
||||
<path
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.709135;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 257.03036,-559.62188 57.77427,0.003 -6.52931,11.55814 -15.49744,-0.043 7.69619,13.41143 -3.30007,5.71054 -6.74322,0.008 -10.94463,-19.09562 -15.76482,-0.032 z"
|
||||
id="use4865"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccc" />
|
||||
<path
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.709135;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 290.65703,-581.54493 -28.88469,-50.03541 13.27432,-0.12452 7.71151,13.44265 7.76655,-13.37082 6.59552,0.003 3.37805,5.83609 -11.06498,19.02614 7.85472,13.66872 z"
|
||||
id="use4867"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccc" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccccccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4873"
|
||||
d="m 244.38844,-579.00705 28.88469,50.03541 -13.27432,0.12452 -7.71151,-13.44265 -7.76655,13.37082 -6.59552,-0.003 -3.37805,-5.83608 11.06498,-19.02614 -7.85472,-13.66872 z"
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.709135;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccccccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="use4875"
|
||||
d="m 277.93827,-601.05655 -57.77427,-0.003 6.52931,-11.55815 15.49743,0.043 -7.69618,-13.41144 3.30007,-5.71055 6.74322,-0.007 10.94462,19.09563 15.76482,0.032 z"
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.709135;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccccccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="use4877"
|
||||
d="m 280.19223,-560.94548 28.88958,-50.03256 6.745,11.43363 -7.78592,13.3997 15.46274,0.0406 3.29544,5.71322 -3.36516,5.84353 -22.00961,-0.0695 -7.9101,13.63676 z"
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.709135;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 8.2 KiB |
3
dyesub-tool/assets/playpause.svg
Normal file
3
dyesub-tool/assets/playpause.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
||||
<path d="M15 6.75a.75.75 0 00-.75.75V18a.75.75 0 00.75.75h.75a.75.75 0 00.75-.75V7.5a.75.75 0 00-.75-.75H15zM20.25 6.75a.75.75 0 00-.75.75V18c0 .414.336.75.75.75H21a.75.75 0 00.75-.75V7.5a.75.75 0 00-.75-.75h-.75zM5.055 7.06C3.805 6.347 2.25 7.25 2.25 8.69v8.122c0 1.44 1.555 2.343 2.805 1.628l7.108-4.061c1.26-.72 1.26-2.536 0-3.256L5.055 7.061z" />
|
||||
</svg>
|
After Width: | Height: | Size: 457 B |
3
dyesub-tool/assets/previous.svg
Normal file
3
dyesub-tool/assets/previous.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
||||
<path fill-rule="evenodd" d="M13.28 3.97a.75.75 0 010 1.06L6.31 12l6.97 6.97a.75.75 0 11-1.06 1.06l-7.5-7.5a.75.75 0 010-1.06l7.5-7.5a.75.75 0 011.06 0zm6 0a.75.75 0 010 1.06L12.31 12l6.97 6.97a.75.75 0 11-1.06 1.06l-7.5-7.5a.75.75 0 010-1.06l7.5-7.5a.75.75 0 011.06 0z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 400 B |
|
@ -15,6 +15,11 @@ pub enum Key<'a> {
|
|||
text: &'a str,
|
||||
u: f64,
|
||||
},
|
||||
Icon {
|
||||
icon_path: &'a str,
|
||||
u: f64,
|
||||
},
|
||||
Break,
|
||||
}
|
||||
|
||||
pub const fn oyayubi<'a>(latin: char, normal: char, shift: char, alt_shift: Option<char>) -> Key<'a> {
|
||||
|
@ -33,12 +38,21 @@ pub const fn single<'a>(text: &'a str, u: f64) -> Key<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub const fn icon<'a>(icon_path: &'a str, u: f64) -> Key<'a> {
|
||||
Key::Icon {
|
||||
icon_path,
|
||||
u,
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Key<'a> {
|
||||
pub fn width_mod(&self) -> f64 {
|
||||
use Key::*;
|
||||
match self {
|
||||
Oyayubi { .. } => 1.0,
|
||||
Single { u, .. } => *u,
|
||||
Icon { u, .. } => *u,
|
||||
Break => 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +63,8 @@ impl<'a> Display for Key<'a> {
|
|||
write!(f, "{}", match self {
|
||||
Oyayubi { latin, .. } => latin.to_string(),
|
||||
Single { text, .. } => text.to_string(),
|
||||
Icon { icon_path, .. } => icon_path.to_string(),
|
||||
Break => "".to_string(),
|
||||
})
|
||||
}
|
||||
}
|
|
@ -39,6 +39,11 @@ fn positions<'a>(
|
|||
let mut y = padding;
|
||||
let mut positions = Vec::with_capacity(keys.len());
|
||||
for key in keys {
|
||||
if let Key::Break = key {
|
||||
x = padding;
|
||||
y = y + grid;
|
||||
continue;
|
||||
}
|
||||
if x + grid > dimensions.width {
|
||||
x = padding;
|
||||
y = y + grid;
|
||||
|
@ -73,8 +78,14 @@ fn main() -> Result<(), Error> {
|
|||
lazy_static! {
|
||||
static ref KEYS: Vec<Key<'static>> = {
|
||||
let mut keys = OYAYUBI.to_vec();
|
||||
keys.push(Key::Break);
|
||||
keys.push(single("親指左", 3.0));
|
||||
keys.push(single("親指右", 3.0));
|
||||
keys.push(Key::Break);
|
||||
keys.push(icon("assets/nixos.svg", 1.0));
|
||||
keys.push(icon("assets/playpause.svg", 1.0));
|
||||
keys.push(icon("assets/previous.svg", 1.0));
|
||||
keys.push(icon("assets/next.svg", 1.0));
|
||||
keys
|
||||
};
|
||||
}
|
|
@ -23,6 +23,10 @@
|
|||
{% when crate::key::Key::Single with { text, u } %}
|
||||
{% let font_size = "0.5cm" %}
|
||||
<text x="{{ width * 0.5 }}" y="{{ box_size * 0.5 }}" dominant-baseline="middle" text-anchor="middle" style="font-family: 'M PLUS Rounded 1c'" font-size="{{ font_size }}" dy="{{ dy }}">{{ text }}</text>
|
||||
{% when crate::key::Key::Icon with { icon_path, u } %}
|
||||
{% let icon_width_mm = 7.5 %}
|
||||
<image x="{{ width.measure * 0.5 - icon_width_mm * 0.5 }}mm" y="{{ box_size.measure * 0.5 - icon_width_mm * 0.5 }}mm" href="{{ icon_path }}" width="{{ icon_width_mm }}mm" height="{{ icon_width_mm }}mm" />
|
||||
{% when crate::key::Key::Break %}
|
||||
{% endmatch %}
|
||||
</g>
|
||||
{% endfor %}
|
||||
|
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.5 KiB |
Loading…
Add table
Reference in a new issue