[quad] dynamically query for a character width
#33
Closed
opened 4 years ago by sorawee
·
8 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?
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).Knowing the character width would not make this layout possible.
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!
I guess something similar to
\dotfill
is the way to go, then? The question is how to implement it.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: