diff --git a/quad/qtest/fark.rkt b/quad/qtest/fark.rkt index 348d3151..a642f511 100644 --- a/quad/qtest/fark.rkt +++ b/quad/qtest/fark.rkt @@ -1,11 +1,94 @@ #lang qtest/markdown -> what could happen on two lines -> that doesn't happen in one +# Hyphenate -oh my +A simple _hyphenation engine_ that uses the Knuth–Liang hyphenation algorithm originally developed for TeX. +I **have added little** to their work. Accordingly, I take no credit, except a spoonful of *snako-bits.* + +And now, for something __altogether__ the same. Yes! No?!ß + +## 1. Installation + +At the command line: + +We said `raco pkg install hyphenate` dude + + +``` +it's a +codeblock! +``` + +``` +it's a +codeblock! ``` -tell me -I, donut -``` \ No newline at end of file + +``` +it's a +codeblock! +``` + +enated. To hyphenate words of +any length, use `#:min-length` `#f`. + +A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. + + + + diff --git a/quad/qtest/hyphenate.rkt b/quad/qtest/hyphenate.rkt index cb218a46..ca643653 100644 --- a/quad/qtest/hyphenate.rkt +++ b/quad/qtest/hyphenate.rkt @@ -15,30 +15,65 @@ At the command line: We said `raco pkg install hyphenate` dude -``` -Code block -Goes here -``` - -What?! - -1. Yes. We said `raco pkg install hyphenate` dude. We said `raco pkg install hyphenate` dude - -2. Indeed - -And furthermore: - -* So it would seem. - -* Today. - -> Hyphenate `xexpr` by calculating hyphenation points and inserting -`joiner` at those points. By default, `joiner` is the soft hyphen -\(Unicode 00AD = decimal 173\). Words shorter than -`#:min-length` `length` will not be hyphenated. To hyphenate words of +enated. To hyphenate words of any length, use `#:min-length` `#f`. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). Certain word processors allow users to [insert soft hyphens](http://practicaltypography.com/optional-hyphens.html) in their -text. \ No newline at end of file +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. A [list of web colors](https://en.wikipedia.org/wiki/Web_colors). +Certain word processors allow users to [insert soft +hyphens](http://practicaltypography.com/optional-hyphens.html) in their +text. + + + + diff --git a/quad/qtest/markdown.rkt b/quad/qtest/markdown.rkt index 262de293..3e844217 100644 --- a/quad/qtest/markdown.rkt +++ b/quad/qtest/markdown.rkt @@ -73,7 +73,7 @@ '(border-inset-top "10") '(border-width-left "2") '(border-color-left "#669") '(border-inset-left "0") '(border-inset-right "10") '(border-inset-bottom "-4") - '(inset-left "12") '(inset-right "12") '(inset-top "12") '(inset-bottom "6") + '(inset-left "12") '(inset-right "12") '(inset-top "12") '(inset-bottom "24") attrs) new-exprs)) (define (list-base attrs exprs [bullet-val #f]) @@ -156,7 +156,7 @@ [else (current-line-height doc)])) (pt (string-width doc str) line-height))])])) -(define draw-debug? #f) +(define draw-debug? #t) (define (draw-debug q doc [fill-color "#f99"] [stroke-color "#fcc"]) (when draw-debug? (save doc) @@ -313,11 +313,14 @@ #:out 'sw #:offset (pt 0 (+ (quad-ref first-line 'inset-top 0))) #:elems lines - #:size (delay (pt (pt-x (size first-line)) ; + ;; this sizing approach doesn't work. + ;; can't add inset-top and inset-bottom here because page composition has already happened. + ;; therefore, resizing the block quads now will throw off the calculated page breaks. + #:size (pt (pt-x (size first-line)) ; (+ (for/sum ([line (in-list lines)]) (pt-y (size line))) (quad-ref first-line 'inset-top 0) - (quad-ref first-line 'inset-bottom 0)))) + (quad-ref first-line 'inset-bottom 0))) #:draw-start (λ (q doc) ;; adjust drawing coordinates for border inset (match-define (list bil bit bir bib)