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

Table cell auto width calculated wrong with inline styles #73

Open
willjohnson opened this issue Oct 25, 2016 · 1 comment
Open

Table cell auto width calculated wrong with inline styles #73

willjohnson opened this issue Oct 25, 2016 · 1 comment

Comments

@willjohnson
Copy link

I seem to be having the issue that is laid out in this issue:

prawnpdf/prawn#360

The auto width of the table cells seems to calculate by including the characters used in the html tags. In this case <font size='20'> and </font>.

table_data = Array.new

list_items.each do |li|

    table_data << ["<font size='20'>*</font>", li.text]

end

table(table_data, :cell_style => {:border_width => 1, :padding => 2, :inline_format => true})
@basvk
Copy link

basvk commented Nov 24, 2016

I've been bitten by this bug today as well (or at least, the issue title fits). Widths of columns in a table that has :inline_format => true are calculated incorrectly, even without any html tags in the strings. I'm using a different font than the default for this table though.
By removing the :inline_format => true from the table options I get a correct result.

Looks like Prawn::Table::Cell::Text#styled_width_of is not passing enough style information to Prawn::Document#width_of (for example font information), as a result the arranger uses default document font settings to calculate width.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants