tiny refac

main
Matthew Butterick 4 years ago
parent 78debc7c4f
commit d2d188ad85

@ -111,19 +111,14 @@
(hash-set! attrs :font-size base-size-adjusted)
(hash-set! attrs prev-font-size-key base-size-adjusted))
(define (resolve-line-height! attrs)
;; convert line-height attributes into a simple line height
(hash-update! attrs :line-height
(λ (val)
(define ((make-updater-based-on-font-size attrs) val)
(define adjustment (parse-percentage-or-em val))
(define base-height (if adjustment (hash-ref attrs :font-size) val))
(and base-height (* base-height (or adjustment 1))))
default-line-height))
(define (resolve-line-height! attrs)
;; convert line-height attributes into a simple line height
(hash-update! attrs :line-height (make-updater-based-on-font-size attrs) default-line-height))
(define (resolve-font-tracking! attrs)
(hash-update! attrs :font-tracking
(λ (val)
(define adjustment (parse-percentage-or-em val))
(define base-tracking (if adjustment (hash-ref attrs :font-size) val))
(and base-tracking (* base-tracking (or adjustment 1))))
0))
(hash-update! attrs :font-tracking (make-updater-based-on-font-size attrs) 0))
Loading…
Cancel
Save