prawn-table icon indicating copy to clipboard operation
prawn-table copied to clipboard

Inconsistent cell width calculation based on style

Open cdekker opened this issue 9 years ago • 3 comments

As far as the manual is concerned, there are 2 different ways to style the text in the cells: inline and through an options hash.

For a table, I want only the first row (headers) to be bolded.

When I fill the cell with <b>Onelongcontentword</b> it fits fine, and the table expands width where needed.

If I set the style options like page 19 from the manual (http://prawnpdf.org/prawn-table-manual.pdf):

table(data, :header => true) do
    row(0).font_style = :bold
end

The last letter is pushed to a new line. It seems the width is calculated on the non-bold width of the text. This is all with the default font Helvetica.

Since I prefer not to meddle in the content strings (which come from a database) to append <b> tags around them, I prefer the second approach. Sadly this does not work due to this bug.

cdekker avatar Dec 14 '15 20:12 cdekker

+1

maikokuppe avatar Dec 22 '15 15:12 maikokuppe

I believe #60 fixes this issue, but a new version has not yet been released that includes this fix.

Would you be able to test the issue against the Github master branch?

jessedoyle avatar Dec 30 '15 20:12 jessedoyle

I can confirm that #60 fixes the issue for me. I reported a similar issue in Asciidoctor PDF (https://github.com/asciidoctor/asciidoctor-pdf/issues/599). I've been able to verify that the bug does not occur when using prawn-table from master.

@packetmonkey Would you be willing to release 0.2.3? It would really help if you didn't drop support for Ruby 1.9.3 at the same time so that we can get the bug fix without having to change the software stack at the same time.

mojavelinux avatar Oct 01 '16 06:10 mojavelinux