2025-10-07 01:27:34 +08:00
|
|
|
|
2025-10-03 00:25:16 +08:00
|
|
|
(module uahgi-ng racket/base
|
2025-10-07 01:27:34 +08:00
|
|
|
(require racket/dict)
|
|
|
|
(define main-config (make-hash
|
|
|
|
'(["paper-width". 2480]
|
|
|
|
["paper-height". 3508]
|
|
|
|
["font-family" . "FreeSerif"]
|
|
|
|
["font-family-CJK" . "Noto Sans CJK TC"]
|
|
|
|
["font-size" . 14]
|
|
|
|
["font-weight" . "regular"]
|
|
|
|
["font-style" . "normal"]
|
|
|
|
|
|
|
|
)))
|
|
|
|
(define main-frame (make-hash
|
|
|
|
'(["id" . 1]
|
|
|
|
["font-family" . (dict-ref main-config "font-family")]
|
|
|
|
["class" . frame]
|
|
|
|
["width" . 2000]
|
|
|
|
["height" . 3000]
|
|
|
|
["x" . 200]
|
|
|
|
["y" . 250]
|
|
|
|
["content" . #f])))
|
|
|
|
|
|
|
|
(define (set-main-config attr val)
|
|
|
|
(dict-set! main-config attr val))
|
|
|
|
|
|
|
|
(define (main-text txt)
|
|
|
|
(dict-set! main-frame "content" txt))
|
|
|
|
|
|
|
|
(define-syntax text-series
|
|
|
|
(syntax-rules ()
|
|
|
|
[(_ x ...)
|
|
|
|
; delete the beginning newline
|
|
|
|
(if (eq? (caar `(x ...)) "\n")
|
|
|
|
`('text ,(cdar `(x ...)))
|
|
|
|
`('text ,(caar `(x ...)) ,(cdar `(x ...)))))]))
|
|
|
|
|
|
|
|
(provide text-series main-text main-frame main-config set-main-config set!
|
|
|
|
(all-from-out racket/base) (all-from-out racket/dict)
|
|
|
|
#%module-begin #%app #%datum #%expression #%top)
|
|
|
|
|
2025-10-03 00:25:16 +08:00
|
|
|
)
|