While not really noticable at smaller font sizes, it appears that PdfPCell is placing it's phrase in such a way that roughly the baseline of the bottom is at the bottom of the cell, causing the lower part of of characters that drop below the line (e.g. pyj,qg) to cross over the bottom border of the cell. See, for example, the letter "g" in the word "Testing" as the font size increases in this example:

 PdfPTable ptable = new PdfPTable(1);
 ptable.getDefaultCell().setBorderColor(Color.RED);
 ptable.getDefaultCell().setBorder(Rectangle.BOX);
 ptable.getDefaultCell().setBorderWidth(.1f);

ptable.addCell(new Phrase("Testing", FontFactory.getFont(FontFactory.COURIER, 7f)));
ptable.addCell(new Phrase("Testing", FontFactory.getFont(FontFactory.COURIER, 10f)));
ptable.addCell(new Phrase("Testing", FontFactory.getFont(FontFactory.COURIER, 20f)));
ptable.addCell(new Phrase("Testing", FontFactory.getFont(FontFactory.COURIER, 30f)));
ptable.addCell(new Phrase("Testing", FontFactory.getFont(FontFactory.COURIER, 40f)));


document.add(ptable);

In examples/Chap0518.java it appears that a small font size and datatable.getDefaultCell().setPadding(3) are used. Certainly a padding can be used to prevent the lower part of the letters dropping through the bottom of the cell, but one must (re)adjust the padding based on the font size, and as the font size increases, the amount of 'extra' padding between the top of the phrase and the top border of the cell increases.


If this is not by design, could you point me to the section of code I can look at to fix this?


Keep up the good work, and thanks for the quick responses!

Fred





-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to