If you look at this code of yours with fresh eyes, I think you'll discover a
problem:
...
Phrase phrase2 = new Phrase();
phrase1.add(chunk2);
par.add(phrase1);
par.add(phrase2);
...
Phrase2 is empty. Try adding chunk2 to phrase2 and see if the problem goes
away.
Best wishes,
---Mister Bean
>>> re >>>
Eric Summkeller wrote:
>
> First I create two Phrase objects with different Fonts. The first created
> Phrase has a bold Font and the second not. After that I add those both
> Phrase
> objects into a Paragraph. I create the Paragraph object with the first
> Font
> because I would like to create a Chapter out of this Paragraph and the
> number
> should have the same style like the first added Phrase object. The problem
> is
> that the second added Phrase object is now bold too although the Font of
> this
> Phrase isn't bold. Is this an error or do I something wrong in my
> implementation?
>
> My code:
>
> Font[] fonts = new Font[2];
> fonts[0] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD);
> fonts[1] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL);
>
> Paragraph par = new Paragraph("", fonts[0]);
>
> Chunk chunk1 = new Chunk("Test_Bold", fonts[0]);
> Phrase phrase1 = new Phrase();
> phrase1.add(chunk1);
>
> Chunk chunk2 = new Chunk("Test_Normal", fonts[1]);
> Phrase phrase2 = new Phrase();
> phrase1.add(chunk2);
>
> par.add(phrase1);
> par.add(phrase2);
>
> Chapter chapter = new Chapter(par, 1);
>
> document.add(chapter);
>
>
>
--
View this message in context:
http://www.nabble.com/Error-in-Chapter-object%21-tf4115250.html#a11702749
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/