practicingruby / prawn-layout

NOTE: prawn-layout has been merged into the main prawn repository as of 2010.02.25 (http://github.com/sandal/prawn), however the stable branch of prawn-layout 0.8.x is still hosted here.
http://github.com/sandal/prawn
Other
69 stars 21 forks source link

Page break created for each table for some fonts when vertical_padding is small #19

Open practicingruby opened 14 years ago

practicingruby commented 14 years ago

Reported by Simon Hürlimann:

There's some regression in drawing tables. When using a small vertical_padding (like 0 or 1), a page break is inserted after each cell. Cell borders are on the previous page than the content, though.

It looks like the commit to prawn-core 63dd5c8 (Don't let descender protrude below bounds bottom. This is a change from pre-text-overhaul functionality.) seems to have introduced this behaviour.

You may reproduce ith git versions prawn-layout c13d2ce - Really fixing this now prawn-core 63dd5c8 - Don't let descender protrude below bounds bottom. This is a change from pre-text-overhaul functionality.

this wraps page for every cell for default font: pdf.table([['Test', 'Val'], ['Test', 'Val']], :vertical_padding => 1)

It got somehow better during the development towards 0.7.1. The problem doesn't show anymore with the default font, but can still be triggered by some other fonts and smaller vertical_padding. I've experienced it with some proprietary TTF font called "Cholla Sans" with vertical_padding = 1. It also shows with the free TTF font "DejaVu Sans" and the built in font "Times-Roman" and vertical_padding = 0.

With prawn-layout 0.7.1 prawn-core 0.7.1

it works for the default font, but still wraps for every cell for "Cholla" font with padding => 1 and "DejaVuSans", "Times-Roman" with padding => 0: pdf.font('Times-Roman') pdf.table([['Test', 'Val'], ['Test', 'Val']], :vertical_padding => 0)

Minimal reproducing example:

  require 'prawn/core'
  require 'prawn/layout'

  pdf = Prawn::Document.new
  pdf.font('Times-Roman')
  pdf.table([['Test', 'Val'], ['Test', 'Val']], :vertical_padding => 0)
  pdf.render_file('test.pdf')
practicingruby commented 14 years ago

This isn't all that surprising to me, but I think that unless we have a patch for it, a fix will need to wait until after the prawn-layout re-write. Brad will take care to avoid this bug in the fresh codebase.

However, if we do get a patch that fixes this, we'll roll it into a maintenance release. Thanks for the report.