-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unordered list bullet + literal = wrong vertical bullet alignment #1204
Comments
I think what's happening is that Prawn is determining the line height based on the first character in the line. If the fonts have different metrics, it ends up using the wrong line height. I would imagine the same thing would happen if the first character of a paragraph is a monospaced character. |
if |
That would seem dirty, though it would still be possible to remove the character before inking it. But there may be other solutions to explore as well. |
The same problem appears when you insert inline formulae (using stem:[]) in list items. |
…nd toc entries if text is entirely monospace
This turns out to affect a lot of elements, including toc entries. Prawn computes the height based on the text you give it. If you only give it monospaced text, then the line height will be different. This can be fixed by the suggestion @habamax came up with, which turns out to be natively supported in Prawn anyway. The one thing we can't fix is when you have a paragraph and one of the lines in the paragraph is entirely monospaced text. But that's quite an edge case. I think if we focus on the problem at hand, we can cover > 90% of the cases I'd estimate. It still would be nice if Prawn supported some sort of reference line height that you could pass in. That way, it would use a precomputed value instead of deriving it from the text. |
…nd toc entries if text is entirely monospace
I have figured out a solution for this problem. |
tested in beta2 and current master
With everything default outputs pdf:
Note if list item starts with inline literal the bullet is misaligned.
PS, boxes and arrows are added afterwards to illustrate the issue.
The text was updated successfully, but these errors were encountered: