Using anchor points in quadwriter
#83
Open
opened 3 years ago by jopetty
·
3 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
To learn how
quad
andquadwriter
work, I tried building a version of the Practical Typography "after" résumé as aquadwriter
document. In order to achieve the "left-aligned location, right-aligned date on the same line" layout, I tried using theanchor-from-parent
andanchor-to
attributes on a Q-expression, to no avail:It seems that both the "place" and "date" quads are still using the
'baseline-in
-to-'baseline-out
anchors:Am I going about this in the correct way? How can one specify the anchor points of a quad while in
#lang quadwriter
, instead of using the lower-levelquad
commands like(quad->pict (position (attach-to parent 'e child 'w)))
?This is one of the trickier formatting problems I’ve come across in working on Quadwriter. Quadwriter doesn’t have a concept of “right-aligned tab stop”, which is how you would handle this in a word processor.
The way I went about it was to sequence the duration and title as sequential paragraphs, and then apply a negative
space-after
attribute to the duration, thereby hoisting the title to be vertically aligned with the duration. (You would also want to apply a generousinset-right
to the title so that it doesn’t wrap all the way to the right edge, so its text doesn’t collide with the duration, which should have a predictable width).In other words, you convert it from a problem of inserting horizontal space (= hard) to one of subtracting vertical space (= easy)
More precisely:
space-after
should be the negative ofline-height
. Here is the relevant fragment of my markup, which should give you enough to go on:The low-level Quad layout functions are not exposed in Quadwriter markup, except for
anchor-from-parent
andanchor-to
. Quadwriter is a demo app that’s meant to demonstrate a higher-level interface (and convince myself that it is possible).