prawnpdf / prawn-table

Provides support for tables in Prawn
Other
205 stars 98 forks source link

Vertical alignment of text #120

Open codez opened 4 years ago

codez commented 4 years ago

In order to vertically align text in table cells nicely, the cursor is moved down a little before the text is rendered (See https://github.com/prawnpdf/prawn/issues/539#issuecomment-28859567).

However, in the relevant code, not the font size of the cell is used, but the font size of the document. If they differ, the vertical alignment as described in the above comment does not work correctly. To reproduce, see the generated table for table([['first', 'second'], ['first', 'second']], cell_style: { size: 40 }).

Most probably, including the size of the @text_options in Prawn::Table::Cell::Text#with_font would fix this problem.