I'm trying to put a paragraph with multiple font weights inside a PdfPCell.
It doesn't seem to work. Oddly enough, different font sizes work just fine.
I've distilled the code down to the bare minimum. It's in two sections: a
regular paragraph (works fine) and a pdf pcell containing that paragraph
(doesn't work).
It's also very strange: if you remove the lines labeled "//remove to make
things work", it starts working.

Here is the code:
    document.open();

    Paragraph paragraph = new Paragraph();
    Font bigAndBold = new Font(Font.HELVETICA, 12, Font.BOLD);
    Font bigAndNormal = new Font(Font.HELVETICA, 12, Font.NORMAL);
    Font smallAndNormal = new Font(Font.HELVETICA, 7, Font.NORMAL);
    paragraph.add(new Phrase("First part (bold)   ", bigAndBold));
    paragraph.add(new Phrase("Second part (not bold)   ", bigAndNormal));
    paragraph.add(new Phrase("Third part (small, not bold)   ",
smallAndNormal));
    document.add(paragraph);

    PdfPTable pdfPTable = new PdfPTable(1);
    pdfPTable.setWidthPercentage(100f);
    paragraph = new Paragraph(new Phrase("First part (bold)   ",
bigAndBold));  //remove to make things work
    paragraph.add(new Phrase("Second part (not bold!)   ", bigAndNormal));
//remove to make things work
    paragraph.add(new Phrase("Third part (small, not bold!)   ",
smallAndNormal)); //remove to make things work
    PdfPCell cell = new PdfPCell(paragraph);
    cell.setBorderColor(Color.white);
    pdfPTable.addCell(cell);
    document.add(pdfPTable);

    document.close();

If you run the above, the text that has "!" in it is rendered incorrectly
(bold instead of normal).

What's going on? Am I just nuts, or is there a subtle bug here?


Thanks
Moh




-------------------------------------------------------
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