Quad: inconsistent line height when line-align attribute is set to justify (probably bug) #85

Closed
opened 3 years ago by vanniewelt · 2 comments
vanniewelt commented 3 years ago (Migrated from github.com)

I'm playing with quadwriter and I have noticed some weird behavior considering #:line-align "justify"

With default settings, lines are rendered correctly:

#lang quadwriter/html

◊h1{What is quad?}

For instance, LaTeX is a document processor. So are web browsers. Quad borrows from both traditions — it’s an attempt to modernize the good ideas in LaTeX, and generalize the good ideas in web browsers, while bypassing some of the limitations of LaTeX (e.g., no Unicode) and of web browsers (e.g., performance and error recovery are valued above all).

Document processors sit opposite WYSIWYG tools like Microsoft Word and Adobe InDesign. There, the user controls the layout by manipulating a representation of the page on the screen. This is fine as far as it goes. But changes to the layout — for instance, a new page size — often require a new round of manual adjustments.
image

However, when I set #:line-align to "justify", line height suddently increases. Note that this only applies to justified lines. Last line is rendered correctly. It cannot be overridden with #:line-height attribute.

#lang quadwriter/html

#:line-align "justify"

◊h1{What is quad?}

For instance, LaTeX is a document processor. So are web browsers. Quad borrows from both traditions — it’s an attempt to modernize the good ideas in LaTeX, and generalize the good ideas in web browsers, while bypassing some of the limitations of LaTeX (e.g., no Unicode) and of web browsers (e.g., performance and error recovery are valued above all).

Document processors sit opposite WYSIWYG tools like Microsoft Word and Adobe InDesign. There, the user controls the layout by manipulating a representation of the page on the screen. This is fine as far as it goes. But changes to the layout — for instance, a new page size — often require a new round of manual adjustments.
image

Resulting Q-expression:

'(q
  ((output-path "my/output/path")
   (line-align "justify"))
  (q
   (para-break)
   (p
    (q
     (page-break)
     (q
      ((font-family "heading")
       (font-features "tnum 1")
       (first-line-indent "0")
       (display "block")
       (font-size "20")
       (line-height "24.0")
       (border-width-top "0.5")
       (border-inset-top "9")
       (inset-bottom "-3")
       (inset-top "6")
       (keep-with-next "true"))
      "What is quad?")))
   (para-break)
   (p
    "For instance, LaTeX is a document processor. So are web browsers. Quad borrows from both traditions — it’s an attempt to modernize the good ideas in LaTeX, and generalize the good ideas in web browsers, while bypassing some of the limitations of LaTeX (e.g., no Unicode) and of web browsers (e.g., performance and error recovery are valued above all).")
   (para-break)
   (p
    "Document processors sit opposite WYSIWYG tools like Microsoft Word and Adobe InDesign. There, the user controls the layout by manipulating a representation of the page on the screen. This is fine as far as it goes. But changes to the layout — for instance, a new page size — often require a new round of manual adjustments.")
   (para-break)))

This is how it looks with #:draw-debug "true":

image

However, when I remove the heading, line height is correct. It looks like if following paragraphs somehow inherited heading's line height. Also, when I put paragraph before that heading, line height is correct for the entire document. All in all, it doesn't look much like expected behavior.

I'm playing with quadwriter and I have noticed some weird behavior considering `#:line-align "justify"` With default settings, lines are rendered correctly: ``` #lang quadwriter/html ◊h1{What is quad?} For instance, LaTeX is a document processor. So are web browsers. Quad borrows from both traditions — it’s an attempt to modernize the good ideas in LaTeX, and generalize the good ideas in web browsers, while bypassing some of the limitations of LaTeX (e.g., no Unicode) and of web browsers (e.g., performance and error recovery are valued above all). Document processors sit opposite WYSIWYG tools like Microsoft Word and Adobe InDesign. There, the user controls the layout by manipulating a representation of the page on the screen. This is fine as far as it goes. But changes to the layout — for instance, a new page size — often require a new round of manual adjustments. ``` <img width="786" alt="image" src="https://user-images.githubusercontent.com/7478957/105055222-22695780-5a73-11eb-871b-2c64f25d8f37.png"> However, when I set `#:line-align` to `"justify"`, line height suddently increases. Note that this only applies to justified lines. Last line is rendered correctly. It cannot be overridden with `#:line-height` attribute. ``` #lang quadwriter/html #:line-align "justify" ◊h1{What is quad?} For instance, LaTeX is a document processor. So are web browsers. Quad borrows from both traditions — it’s an attempt to modernize the good ideas in LaTeX, and generalize the good ideas in web browsers, while bypassing some of the limitations of LaTeX (e.g., no Unicode) and of web browsers (e.g., performance and error recovery are valued above all). Document processors sit opposite WYSIWYG tools like Microsoft Word and Adobe InDesign. There, the user controls the layout by manipulating a representation of the page on the screen. This is fine as far as it goes. But changes to the layout — for instance, a new page size — often require a new round of manual adjustments. ``` <img width="784" alt="image" src="https://user-images.githubusercontent.com/7478957/105055531-74aa7880-5a73-11eb-94b6-99ed1a9c0791.png"> Resulting Q-expression: ``` '(q ((output-path "my/output/path") (line-align "justify")) (q (para-break) (p (q (page-break) (q ((font-family "heading") (font-features "tnum 1") (first-line-indent "0") (display "block") (font-size "20") (line-height "24.0") (border-width-top "0.5") (border-inset-top "9") (inset-bottom "-3") (inset-top "6") (keep-with-next "true")) "What is quad?"))) (para-break) (p "For instance, LaTeX is a document processor. So are web browsers. Quad borrows from both traditions — it’s an attempt to modernize the good ideas in LaTeX, and generalize the good ideas in web browsers, while bypassing some of the limitations of LaTeX (e.g., no Unicode) and of web browsers (e.g., performance and error recovery are valued above all).") (para-break) (p "Document processors sit opposite WYSIWYG tools like Microsoft Word and Adobe InDesign. There, the user controls the layout by manipulating a representation of the page on the screen. This is fine as far as it goes. But changes to the layout — for instance, a new page size — often require a new round of manual adjustments.") (para-break))) ``` This is how it looks with `#:draw-debug "true"`: <img width="788" alt="image" src="https://user-images.githubusercontent.com/7478957/105055630-8e4bc000-5a73-11eb-8f4e-d9c1cac60da6.png"> However, when I remove the heading, line height is correct. It looks like if following paragraphs somehow inherited heading's line height. Also, when I put paragraph before that heading, line height is correct for the entire document. All in all, it doesn't look much like expected behavior.
mbutterick commented 3 years ago (Migrated from github.com)

Thanks! It was a bug. Fixed by 1b38c70f98 and 8880329d86

Thanks! It was a bug. Fixed by https://github.com/mbutterick/quad/commit/1b38c70f98bfc37f647a5e6498a5ef2599720f42 and https://github.com/mbutterick/quad/commit/8880329d86750eb516371253fd91e2937ab52d34
vanniewelt commented 3 years ago (Migrated from github.com)

Excellent, thanks! I’m closing this issue.

Excellent, thanks! I’m closing this issue.
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen-users#85
Loading…
There is no content yet.