prawnpdf/prawn — pull request #505 by straydogstudio (2013-06-17 22:47:57+00:00)
Title: Better table cell rotation

Here is some initial work to improve table cell rotation. Right now Prawn doesn't stay within the cell (partly because the text is wrapped before the content is rotated, and partly because rotate_around moves text outside the cell for all but the simplest of cases.) This fix keeps the text wrapped correctly on rotations of 9, 90, 180, 270, etc. Intermediate angles are at better than they were for now. Here is what it looks like:

![prawn_table_rotate](https://f.cloud.github.com/assets/1423683/665435/6869ca90-d79e-11e2-8dfa-a2779f2dc600.gif)

Note that only table height is specified on that table.

I've created Table::Cell::Box and Table::Cell::Formatted::Box which inherit from Prawn::Text::Formatted::Box. There is also Table::Cell::Formatted::Wrap which inherits from Prawn::Core::Text::Formatted::Wrap. Only a few methods are overridden. If there is a better way to organize this, please let me know.

Intermediate angles still don't fit in the box, but they wrap reasonably well. The swap of height/width for wrapping happens on 45 degree angles. If this approach makes sense, sometime I'll tackle the wrap logic for other angles, and the text can still fit on an angle.

One last thing. This code ignores rotate_around. I overrode valid_options so including rotate_around throws an error. Perhaps it should just be ignored?

Needed:
* Vertical / horizontal alignment
* Wrapping in intermediate angles?
* Rotation may need to be adjusted for padding changes.

Added a rotate test at the end of table_spec.rb. cell_spec.rb adjusted for new classes. All tests are passing.

Other: I added .ruby-version and .ruby-gemset to .gitignore for the latest [rvm](https://github.com/wayneeseguin/rvm/issues/1694)

Issues referenced: [409](https://github.com/prawnpdf/prawn/issues/409#issuecomment-18233381) & [112](https://github.com/prawnpdf/prawn/issues/112)