prawnpdf / prawn

Fast, Nimble PDF Writer for Ruby
https://prawnpdf.org
Other
4.68k stars 688 forks source link

Calculating text size issue #1199

Closed meap closed 3 years ago

meap commented 3 years ago

I have prepared a small demo here, which demonstrates the problem with calculating the size of the text and its rendering in the text box.

Can you advise me what's wrong, or if it's a bug in prawn, fix it?

gettalong commented 3 years ago

Does this also occur if you are not using a template?

meap commented 3 years ago

@gettalong yes

gettalong commented 3 years ago

Thanks. Testing this out a bit it seems to only occur if the width set in render_caption gets too big. If you reduce it, it will work fine. Due to this I'm guessing this is a bug in Prawn itself but haven't investigated further.

gettalong commented 3 years ago

@meap Are you by any chance running Ruby 2.7+? If yes, then the problem appears to be due to a caching issue that is described in #1140 and fixed with #1169 that has already landed in master.

After updating to the master version your small demo works fine.

meap commented 3 years ago

@gettalong you're right.