Closed sorawee closed 4 years ago
Knowing the character width would not make this layout possible.
Would you rather have real PDF form fields?
Would you rather have real PDF form fields?
For my use-case, no. The document that I'm producing really needs these ugly dots. But for the sake of completeness of quadwriter, yes!
Knowing the character width would not make this layout possible.
I guess something similar to \dotfill
is the way to go, then? The question is how to implement it.
#lang quadwriter
'(q ((line-height "14pt"))
(q ((font-size "14pt")(space-after "-18pt")) "Name ................................")
(para-break)
(q ((inset-left "60pt")) "Jane Doe")
(para-break)
(q ((font-size "14pt")(space-after "-18pt")) "Age ...................................")
(para-break)
(q ((inset-left "60pt")) "100")
)
This would suffice for my use-case. Thanks!
By the way, I realize that I recently posted here a lot. If I generated too much noise, please let me know, and I will tone it down.
Another thing is, I do have a working document in LaTeX already, but it's not really sane. That's why I want to try quad and see if it could make my life easier. That being said, I realize that quad is in its infancy and might not right now be the right tool for what I eventually want to do. So please don't hesitate to tell me that if it's the case.
Not at all — I appreciate that you’re trying out the software and discovering its limits. I have pinched plenty of ideas from LaTeX already, though as you point out, many LaTeX documents are “not really sane”. I feel comfortable saying that preserving sanity is a design goal of Quad.
I forgot about font-baseline-shift
, another option:
#lang quadwriter
'(q ((line-height "14pt"))
(q ((space-after "-14pt")) "Name " (q ((font-size "0.7em") (font-baseline-shift "-4pt")) "............................................."))
(para-break)
(q ((inset-left "60pt")) "Jane Doe")
(para-break)
(q ((space-after "-14pt")) "Age " (q ((font-size "0.7em") (font-baseline-shift "-4pt")) "................................................."))
(para-break)
(q ((inset-left "60pt")) "100"))
For non-monospace font, each character could have different width. For instance
.
would be much less narrow thanm
. Is there a way to query for how wide each character is in quad?Here's a use case. I am creating a form. In the unfilled state, the document could look like this:
In the filled state, it would look like this:
The challenge is, how do I make sure that the length of the first line will be the same as the length of the second line? Particularly, it looks like I need a way to compute how wide the label in each line is, how wide the filled text in each line is, and subtract that from the desired length to determine how many dots I should put in.
Another solution would be something like
\dotfill
in LaTeX which automatically fills the rest of the line with dots. I then can useleft-inset
andright-inset
to limit how much it can fill.(http://joshua.smcvt.edu/latex2e/_005chrulefill-_0026-_005cdotfill.html documents
\dotfill
and how to use it to create a form like this).