Skip to content
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

Closed
habamax opened this issue Aug 9, 2019 · 7 comments
Closed

Unordered list bullet + literal = wrong vertical bullet alignment #1204

habamax opened this issue Aug 9, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@habamax
Copy link
Contributor

habamax commented Aug 9, 2019

tested in beta2 and current master

= test

== test 1
* hello
** world
** `world`
** world `world`
** w``orld``
* hello
* `hello`
* hello

With everything default outputs pdf:

image

Note if list item starts with inline literal the bullet is misaligned.

PS, boxes and arrows are added afterwards to illustrate the issue.

@habamax
Copy link
Contributor Author

habamax commented Aug 9, 2019

As a workaround one can add {zwsp} :

image

@mojavelinux
Copy link
Member

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.

@habamax
Copy link
Contributor Author

habamax commented Aug 9, 2019

if literal would have content property which is included before the text... It would be possible to add {zwsp} there to fix this. Although it looks dirty :)

@mojavelinux
Copy link
Member

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.

@RarrugasTetra
Copy link

The same problem appears when you insert inline formulae (using stem:[]) in list items.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 6, 2019
…nd toc entries if text is entirely monospace
@mojavelinux
Copy link
Member

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.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 7, 2019
…nd toc entries if text is entirely monospace
@mojavelinux
Copy link
Member

mojavelinux commented Apr 27, 2020

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.

I have figured out a solution for this problem.

@mojavelinux mojavelinux self-assigned this Apr 27, 2020
@mojavelinux mojavelinux added this to the v1.5.0.beta.5 milestone Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants