uahgi2/uahgi-ng/expander.rkt
Tan Kian-ting c0d3e83989
Some checks are pending
CI / Build on Racket 'stable' (BC) (push) Waiting to run
CI / Build on Racket 'stable' (CS) (push) Waiting to run
CI / Build on Racket 'current' (BC) (push) Waiting to run
CI / Build on Racket 'current' (CS) (push) Waiting to run
modify uahgi-ng
2025-10-07 01:27:34 +08:00

42 lines
1.5 KiB
Racket

(module uahgi-ng racket/base
(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)
)