diff --git a/dyesub-tool/assets/next.svg b/dyesub-tool/assets/next.svg
new file mode 100644
index 0000000..b805ced
--- /dev/null
+++ b/dyesub-tool/assets/next.svg
@@ -0,0 +1,3 @@
+
diff --git a/dyesub-tool/assets/nixos.svg b/dyesub-tool/assets/nixos.svg
new file mode 100644
index 0000000..8041d98
--- /dev/null
+++ b/dyesub-tool/assets/nixos.svg
@@ -0,0 +1,124 @@
+
+
+
+
diff --git a/dyesub-tool/assets/playpause.svg b/dyesub-tool/assets/playpause.svg
new file mode 100644
index 0000000..3a02310
--- /dev/null
+++ b/dyesub-tool/assets/playpause.svg
@@ -0,0 +1,3 @@
+
diff --git a/dyesub-tool/assets/previous.svg b/dyesub-tool/assets/previous.svg
new file mode 100644
index 0000000..b55a8f9
--- /dev/null
+++ b/dyesub-tool/assets/previous.svg
@@ -0,0 +1,3 @@
+
diff --git a/dyesub-tool/src/key/mod.rs b/dyesub-tool/src/key/mod.rs
index d90bf4a..28e3553 100644
--- a/dyesub-tool/src/key/mod.rs
+++ b/dyesub-tool/src/key/mod.rs
@@ -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) -> 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(),
})
}
}
\ No newline at end of file
diff --git a/dyesub-tool/src/main.rs b/dyesub-tool/src/main.rs
index f054c96..33139d2 100644
--- a/dyesub-tool/src/main.rs
+++ b/dyesub-tool/src/main.rs
@@ -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> = {
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
};
}
\ No newline at end of file
diff --git a/dyesub-tool/templates/document.xml b/dyesub-tool/templates/document.xml
index 07e94ae..49a9758 100644
--- a/dyesub-tool/templates/document.xml
+++ b/dyesub-tool/templates/document.xml
@@ -23,6 +23,10 @@
{% when crate::key::Key::Single with { text, u } %}
{% let font_size = "0.5cm" %}
{{ text }}
+ {% when crate::key::Key::Icon with { icon_path, u } %}
+ {% let icon_width_mm = 7.5 %}
+
+ {% when crate::key::Key::Break %}
{% endmatch %}
{% endfor %}