summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--confs/en.scm53
-rw-r--r--confs/es.scm25
-rw-r--r--confs/ru.scm52
-rw-r--r--confs/uk.scm58
-rw-r--r--stickers.scm67
5 files changed, 126 insertions, 129 deletions
diff --git a/confs/en.scm b/confs/en.scm
index bcabb28..fabda6d 100644
--- a/confs/en.scm
+++ b/confs/en.scm
@@ -1,31 +1,3 @@
-;https://unicode-table.com/en/2B7E/
-
-(define letters (string->list "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
-(define numbers (string->list "1234567890"))
-(define brackets (string->list "()[]{}<>"))
-(define symbols (string->list "+-*\\|@#~$%&^`´\"'"))
-(define punct (string->list ",.:;_"))
-
-;(define tab "⭾")
-;(define tab "↹")
-;(define tab "→|")
-(define tab "⇥")
-;(define backspace "⌫")
-(define backspace "⟵")
-;(define arrows (string->list "▼▶▼▶"))
-(define arrows (string->list "←↑→↓"))
-
-(define key-symbols (concatenate (list (list backspace tab)
- arrows
- (string->list "⇧⇧⇪⏎"))))
-(define modifiers '("Ctrl" "Ctrl" "Alt" "AltGr" "Esc" "Del"))
-
-(define fn '("Fn"))
-(define media (string->list ""))
-
-;(define extra-symbols (string->list "☠⌨☭☮☢☣☥⚓"))
-(define extra-symbols (string->list "☠⎘⎘"))
-
(define font "B612")
(define sticker-radius 3.82); mm
(define page-size a7-size)
@@ -33,12 +5,19 @@
(define glyphs
(concatenate
(list
- (map (lambda (l) (glyph l font "6" "white" "none")) letters)
- (map (lambda (l) (glyph l font "6" "lightgreen" "none")) symbols)
- (map (lambda (l) (glyph l font "6" "white" "none")) key-symbols)
- (map (lambda (l) (glyph l font "6" "white" "none")) numbers)
- (map (lambda (l) (glyph l font "3" "white" "italic")) modifiers)
- (map (lambda (l) (glyph l font "6" "red" "none")) brackets)
- (map (lambda (l) (glyph l font "6" "steelblue" "none")) media)
- (map (lambda (l) (glyph l font "6" "white" "none")) extra-symbols)
- (map (lambda (l) (glyph l font "6" "white" "none")) punct))))
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) en-chars)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) numbers)
+ (map (lambda (l) (make-glyph l font "6" "red" "none")) brackets)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) punct)
+ (map (lambda (l) (make-glyph l font "6" "lightgreen" "none")) symbols)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) math)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) tab)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) backspace)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) arrows)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) upcase)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) enter)
+ (map (lambda (l) (make-glyph l font "3" "white" "italic")) modifiers)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) pagers)
+ (map (lambda (l) (make-glyph l font "6" "steelblue" "none")) media))))
+
+(make-config page-size sticker-radius glyphs)
diff --git a/confs/es.scm b/confs/es.scm
index 5879908..a3e7fd9 100644
--- a/confs/es.scm
+++ b/confs/es.scm
@@ -1,2 +1,23 @@
-(define letters (string->list "ABCDEFGHIJKLMNÑOPQRSTUVWXYZ"))
-(define numbers (string->list "1234567890"))
+(define font "B612")
+(define sticker-radius 3.82); mm
+(define page-size a7-size)
+
+(define glyphs
+ (concatenate
+ (list
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) es-chars)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) numbers)
+ (map (lambda (l) (make-glyph l font "6" "red" "none")) brackets)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) punct)
+ (map (lambda (l) (make-glyph l font "6" "lightgreen" "none")) symbols)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) math)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) tab)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) backspace)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) arrows)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) upcase)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) enter)
+ (map (lambda (l) (make-glyph l font "3" "white" "italic")) modifiers)
+ (map (lambda (l) (make-glyph l font "3" "white" "italic")) pagers)
+ (map (lambda (l) (make-glyph l font "6" "steelblue" "none")) media))))
+
+(make-config page-size sticker-radius glyphs)
diff --git a/confs/ru.scm b/confs/ru.scm
index 09a3744..eedc75b 100644
--- a/confs/ru.scm
+++ b/confs/ru.scm
@@ -1,30 +1,3 @@
-(define letters (string->list "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ" ))
-
-(define numbers (string->list "1234567890"))
-(define brackets (string->list "()[]{}<>"))
-(define symbols (string->list "+-*\\|@#~$%&^`´\"'"))
-(define punct (string->list ",."))
-
-;(define tab "⭾")
-;(define tab "↹")
-;(define tab "→|")
-(define tab "⇥")
-;(define backspace "⌫")
-(define backspace "⟵")
-;(define arrows (string->list "▼▶▼▶"))
-(define arrows (string->list "←↑→↓"))
-
-(define key-symbols (concatenate (list (list backspace tab)
- arrows
- (string->list "⇧⇧⇪⏎"))))
-(define modifiers '("Ctrl" "Ctrl" "Alt" "AltGr" "Esc" "Del"))
-
-(define fn '("Fn"))
-(define media (string->list ""))
-
-;(define extra-symbols (string->list "☠⌨☭☮☢☣☥⚓"))
-(define extra-symbols (string->list "☠⎘⎘"))
-
(define font "B612")
(define sticker-radius 3.82); mm
(define page-size a7-size)
@@ -32,12 +5,19 @@
(define glyphs
(concatenate
(list
- (map (lambda (l) (glyph l font "6" "white" "none")) letters)
- (map (lambda (l) (glyph l font "6" "lightgreen" "none")) symbols)
- (map (lambda (l) (glyph l font "6" "white" "none")) key-symbols)
- (map (lambda (l) (glyph l font "6" "white" "none")) numbers)
- (map (lambda (l) (glyph l font "3" "white" "italic")) modifiers)
- (map (lambda (l) (glyph l font "6" "red" "none")) brackets)
- ;(map (lambda (l) (glyph l font "6" "steelblue" "none")) media)
- (map (lambda (l) (glyph l font "6" "white" "none")) extra-symbols)
- (map (lambda (l) (glyph l font "6" "white" "none")) punct))))
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) ru-chars)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) numbers)
+ (map (lambda (l) (make-glyph l font "6" "red" "none")) brackets)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) punct)
+ (map (lambda (l) (make-glyph l font "6" "lightgreen" "none")) symbols)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) math)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) tab)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) backspace)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) arrows)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) upcase)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) enter)
+ (map (lambda (l) (make-glyph l font "3" "white" "italic")) modifiers)
+ (map (lambda (l) (make-glyph l font "3" "white" "italic")) pagers)
+ (map (lambda (l) (make-glyph l font "6" "steelblue" "none")) media))))
+
+(make-config page-size sticker-radius glyphs)
diff --git a/confs/uk.scm b/confs/uk.scm
index 5e9d0ca..7417b96 100644
--- a/confs/uk.scm
+++ b/confs/uk.scm
@@ -1,49 +1,23 @@
-;https://unicode-table.com/en/2B7E/
-
-(define letters (string->list "АБВГҐДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯ"))
-(define numbers (string->list "1234567890"))
-(define brackets (string->list "()[]{}<>"))
-(define symbols (string->list "+-*\\|@#~$%&^`´\"'"))
-(define punct (string->list ",.:;_"))
-
-;(define tab "⭾")
-;(define tab "↹")
-;(define tab "→|")
-(define tab "⇥")
-;(define backspace "⌫")
-(define backspace "⟵")
-;(define arrows (string->list "▼▶▼▶"))
-(define arrows (string->list "←↑→↓"))
-
-(define key-symbols (concatenate (list (list backspace tab)
- arrows
- (string->list "⇧⇧⇪⏎"))))
-(define modifiers '("Ctrl" "Ctrl" "Alt" "AltGr" "Esc" "Del"))
-
-(define fn '("Fn"))
-(define media (string->list ""))
-
-;(define extra-symbols (string->list "☠⌨☭☮☢☣☥⚓"))
-(define extra-symbols (string->list "☠⎘⎘🌻⌨"))
-
(define font "B612")
(define sticker-radius 3.82); mm
(define page-size a7-size)
-; https://upload.wikimedia.org/wikipedia/commons/2/2f/Flag_of_Ukraine_with_the_Trident_of_Ukraine.svg
-; Has to be centered
-(define trident "M0-.5715C-.0282-.5394-.0453-.4975-.0453-.4515-.0437-.3507-.0314-.2499-.0303-.149-.0281-.0551-.0562.0333-.0905.1196-.102.1433-.1142.1667-.1267.19l-.0363-.0073C-.1957.176-.217.1442-.2104.1115-.2047.0828-.1794.0628-.1514.0628L-.1382.0642-.1678-.1827C-.1772-.2925-.234-.389-.3174-.4515-.3318-.4623-.3471-.4723-.3628-.4809V.3955H-.1605c.0152.0821.0604.1537.1238.2027.0152.0105.0278.0242.037.0401C.0094.6223.022.6086.0372.5981.1007.549.1459.4774.1609.3955H.3632V-.4809C.3474-.4723.3323-.4623.3179-.4515.2344-.3889.1779-.2925.1682-.1827L.1386.0642.1519.0628C.18.063.2053.0828.2109.1115.2175.1442.1961.176.1635.1826l-.0363.0073C.1147.1667.1024.1433.091.1196.0566.0334.0285-.055.0307-.149.0318-.2501.0442-.3509.0459-.4515.0459-.4977.0287-.5393.0004-.5715H0Zm-.3025.2169C-.2635-.3086-.2371-.2514-.2293-.1884l.0242.2036C-.2361.0306-.2596.0589-.2684.0932H-.3027v-.4477l.0002 0Zm.605 0v.4477H.2683C.2594.0588.2358.0305.2048.0151L.229-.1885C.2369-.2514.2632-.3086.3023-.3546L.3025-.3546ZM0 .0547C.0162.1078.0386.1585.0664.2052.0399.2133.0169.2289 0 .2498-.0169.2289-.0399.2133-.0664.2052-.0386.1583-.0162.1078 0 .0547Zm-.3025.099H-.2683c.0108.0418.0435.0748.0847.0862l.029.0066c-.0077.0282-.0121.0579-.0121.0887H-.3026v-.1815l.0001 0Zm.5709 0H.3026v.1815H.1665C.1665.3046.1623.2748.1544.2467L.1836.2399C.225.2285.2575.1954.2683.1537l.0001 0ZM-.0953.2605C-.0585.2657-.0303.2971-.0303.3352H-.1059C-.1059.3092-.1021.2843-.0953.2605Zm.1904 0C.102.2843.1059.3092.1059.3352H.0303c0-.0382.0283-.0696.065-.0747ZM-.099.3958H-.0303V.5231C-.0635.4881-.0878.4444-.099.3958Zm.1293 0H.099C.0879.4444.0637.4882.0303.5231V.3958Z")
-
(define glyphs
(concatenate
(list
- (map (lambda (l) (glyph l font "6" "yellow" "none")) letters)
- (map (lambda (l) (glyph l font "6" "white" "none")) symbols)
- (map (lambda (l) (glyph l font "6" "white" "none")) key-symbols)
- (map (lambda (l) (glyph l font "6" "cyan" "none")) numbers)
- (map (lambda (l) (glyph l font "3" "white" "italic")) modifiers)
- (map (lambda (l) (glyph l font "6" "cyan" "none")) brackets)
- ;(map (lambda (l) (glyph l font "6" "steelblue" "none")) media)
- (map (lambda (l) (glyph l font "6" "white" "none")) extra-symbols)
- (map (lambda (l) (glyph l font "6" "white" "none")) punct)
- (list (path trident "6" "yellow")))))
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) uk-chars)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) numbers)
+ (map (lambda (l) (make-glyph l font "6" "red" "none")) brackets)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) punct)
+ (map (lambda (l) (make-glyph l font "6" "lightgreen" "none")) symbols)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) math)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) tab)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) backspace)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) arrows)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) upcase)
+ (map (lambda (l) (make-glyph l font "6" "white" "none")) enter)
+ (map (lambda (l) (make-glyph l font "3" "white" "italic")) modifiers)
+ (map (lambda (l) (make-glyph l font "3" "white" "italic")) pagers)
+ (map (lambda (l) (make-glyph l font "6" "steelblue" "none")) media))))
+
+(make-config page-size sticker-radius glyphs)
diff --git a/stickers.scm b/stickers.scm
index 31c63af..f818ec2 100644
--- a/stickers.scm
+++ b/stickers.scm
@@ -1,5 +1,6 @@
; Generate keys
(import (scheme char)
+ (scheme eval)
(chibi)
(chibi string)
(chibi sxml)
@@ -7,8 +8,38 @@
(srfi 9)
(srfi 41))
+(define a4-size '(297 . 210))
+(define a5-size '(210 . 148))
+(define a6-size '(148 . 105))
+(define a7-size '(105 . 74))
+;https://unicode-table.com/en/2B7E/
+(define es-chars (string->list "ABCDEFGHIJKLMNÑOPQRSTUVWXYZ"))
+(define en-chars (string->list "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
+(define uk-chars (string->list "АБВГҐДЕЄЖЗИІЇЙКЛМНОПРСТУФХЦЧШЩЬЮЯ"))
+(define ru-chars (string->list "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ" ))
+(define numbers (string->list "1234567890"))
+(define brackets (string->list "()[]{}<>"))
+(define punct (string->list ",.:;_"))
+(define symbols (string->list "\\|@#~$%&^`´\"'"))
+(define math (string->list "+-*/="))
+(define tab (list "⇥"))
+(define backspace (list "⟵"))
+(define arrows (string->list "←↑→↓"))
+(define upcase (string->list "⇧⇧⇪"))
+(define enter (list "⏎"))
+(define modifiers (list "Ctrl" "Ctrl" "Alt" "AltGr" "Esc" "Del" "Fn"))
+(define pagers (list "PgUp" "PgDn"))
+(define media (string->list ""))
+
+(define-record-type <config>
+ (make-config page-size sticker-radius stickers)
+ config?
+ (page-size config-page-size set-config-page-size!)
+ (sticker-radius config-sticker-radius set-config-sticker-radius!)
+ (stickers config-stickers set-config-stickers!))
+
(define-record-type <glyph>
- (glyph char font size color style)
+ (make-glyph char font size color style)
glyph?
(char glyph-char glyph-set-char!)
(font glyph-font glyph-set-font!)
@@ -17,28 +48,40 @@
(style glyph-style glyph-set-style!))
(define-record-type <path>
- (path contents size color)
+ (make-path contents size color)
path?
(contents path-contents path-contents!)
(size path-size path-set-size!)
(color path-color path-set-color!))
-
(define args (cdr (command-line)))
(define INFILE (first args))
(define OUTFILE (second args))
-(define a4-size '(297 . 210))
-(define a5-size '(210 . 148))
-(define a6-size '(148 . 105))
-(define a7-size '(105 . 74))
-
-;; INFILE HAS TO DEFINE THESE TWO VALUES
-;; (define sticker-radius 3.82); mm
-;; (define page-size a7-size) ;; 96 Stickers at this size
-(load INFILE)
+(define (load* file)
+ "Eval the file in current environment"
+ (let ((code (call-with-input-file file
+ (lambda (p)
+ (let loop ((x (read p)))
+ (if (eof-object? x)
+ '()
+ (cons x (loop (read p)))))))))
+ (let loop ((l code))
+ (let* ((cur (car l))
+ (next (cdr l))
+ (x (eval cur)))
+ (if (null? next)
+ x
+ (loop next))))))
+
+;; Needs to return a config file
+(define config (load* INFILE))
+
+(define sticker-radius (config-sticker-radius config))
+(define page-size (config-page-size config))
+(define glyphs (config-stickers config))
(define x car)
(define y cdr)