-
Notifications
You must be signed in to change notification settings - Fork 17
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
Same margin before and after a list between paragraphs? #7
Comments
I found an unexpected move_down in the code of prawn table, which is used to render lists. Could you try the branch adjust_list_gaps with your example to see if it fixes your issue? |
Thanks for your analysis. Are you actually using a special font or is this the standard Helvetica in your example? This really seems to be some font spacing issue depending on descenders, ascenders and line gaps. Unfortunately, I am not really an expert in this field. Probably some more digging in the Prawn/Prawn-Table source code would be necessary. There are various specs to start from. I used
lookatit calls after processor.parse lines will directly open the generated PDF on Linux or Mac when running the specs.
|
Ok, a more complete example: BASE_LINE_GRID = 13
markup_options = {
text: {
font: 'Helvetica',
size: 8.5,
leading: BASE_LINE_GRID - font.height_at(8.5)
# margin_bottom: 0 # Margin after each <p>, <ol>, <ul> or <table>
},
list: {
vertical_margin: 0, # margin at the top and the bottom of the list
bullet: {
margin: 0 # Margin before bullet
},
content: {
leading: BASE_LINE_GRID - font.height_at(8.5), # Vertical padding between list items
margin: 4 # Between bullet and content
}
}
} And I added another As you can see, I have quite sophisticated graphics skills. The lines almost line up, haha. Edit: Found this regarding the gap they add, prawnpdf/prawn#539 |
I guess I found the issue. The problem seems to be that the Probably we should open an issue in prawn-table? |
Created prawnpdf/prawn-table#120. Considering the last commit to the prawn-table code was 4 years ago, I will fix it here anyways. |
Pushed a new commit to https://github.com/puzzle/prawn-markup/tree/adjust_list_gaps |
@aried3r did you get a chance to test the changes? If everything is ok, I will cut a new version of the gem. |
Hey! So far I haven't, but I hope to take a closer look either tomorrow or beginning of next week. Thanks for your work so far! |
I had a chance to test your changes, it seems to work! I think the |
Great, I'm about to release a new version. |
Awesome, thank you for your quick response! |
Hey and thanks for this gem!
I'm currently playing around with this gem and was wondering if there is a way to have the same bottom and top margin/padding in a list surrounded by paragraphs?
Expected result (HTML rendered in a browser)
Actual result
I assume what I'm seeing here is the
margin_bottom
of the "Top Paragraph"<p>
+ an additional padding/margin on top of the list (althoughvertical_margin
is 0).If I change it
text: { margin_bottom: 0 }
of course the margins at the bottom of the first<p>
are gone, and so is the margin at the bottom of the<ul>
. However there is still a margin before the list and I'm not sure where it's coming from.Even when I set everything (well, I guess not everything otherwise it'd be gone) to 0, there's still a distance between the top paragraph and the bottom one.
The text was updated successfully, but these errors were encountered: