gap
This commit is contained in:
parent
34bc20d682
commit
15e5e0ac96
8
draw.rkt
8
draw.rkt
|
@ -337,15 +337,15 @@
|
|||
(if (raart? col) col (text (~a col))))))
|
||||
|
||||
(define (para mw s #:halign [halign 'left])
|
||||
(para* mw (map text (string-split s " ")) #:halign halign))
|
||||
(define (para* mw rs #:halign [halign 'left])
|
||||
(para* mw (map text (string-split s " ")) #:halign halign #:gap (text " ")))
|
||||
(define (para* mw rs #:halign [halign 'left] #:gap [gap (blank)])
|
||||
(for/fold ([all-rows (list (blank))]
|
||||
#:result
|
||||
(vappend* #:halign halign (reverse all-rows)))
|
||||
([r (in-list rs)])
|
||||
(match-define (cons last-row rows) all-rows)
|
||||
(if (< (+ (raart-w last-row) (raart-w r)) mw)
|
||||
(cons (happend last-row (text " ") r) rows)
|
||||
(cons (happend last-row gap r) rows)
|
||||
(cons r all-rows))))
|
||||
|
||||
(define (draw-here r)
|
||||
|
@ -436,7 +436,7 @@
|
|||
(#:halign halign/c)
|
||||
raart?)]
|
||||
[para* (->* (exact-nonnegative-integer? (listof raart?))
|
||||
(#:halign halign/c)
|
||||
(#:halign halign/c #:gap raart?)
|
||||
raart?)]
|
||||
[if-drawn (-> (-> exact-nonnegative-integer? exact-nonnegative-integer?
|
||||
exact-nonnegative-integer? exact-nonnegative-integer?
|
||||
|
|
|
@ -210,7 +210,7 @@ raart?]{Like @racket[happend], but accepts arguments as a list.
|
|||
|
||||
@ex[(draw-here (para 45 "And it came to pass that I, Nephi, said unto my father: I will go and do the things which the Lord hath commanded, for I know that the Lord giveth no commandments unto the children of men, save he shall prepare a way for them that they may accomplish the thing which he commandeth them."))]}
|
||||
|
||||
@defproc[(para* [max-width exact-nonnegative-integer?] [rs (listof raart?)] [#:halign halign halign/c 'left]) raart?]{Like @racket[happend*], but limits the total width and uses @racket[vappend] when things get too long. @racket[para] uses this after splitting the input string into words.}
|
||||
@defproc[(para* [max-width exact-nonnegative-integer?] [rs (listof raart?)] [#:halign halign halign/c 'left] [#:gap gap raart? (blank)]) raart?]{Like @racket[happend*], but limits the total width and uses @racket[vappend] when things get too long. @racket[para] uses this after splitting the input string into words and supplies @racket[(text " ")] as the @racket[gap].}
|
||||
|
||||
@defproc[(place-at [back raart?] [dr exact-nonnegative-integer?] [dh
|
||||
exact-nonnegative-integer?] [front raart?]) raart?]{Renders
|
||||
|
|
Loading…
Reference in New Issue