meeger wrote:
> Hi,
> 
> Is it possible to change the font inside a string?

Yes.

> I have a string containing html formatting tags and want to change the font
> depending on these tags.

Use HTMLWorker. See chapter 14.
When I refer to a chapter number, but you don't have the book,
you can always look for the examples in that chapter here:
http://1t3xt.info/examples/itext-in-action.php
You'll find this example:
http://1t3xt.info/examples/browse/?page=example&id=233

Suppose that the 'tags' aren't HTML, then you could create
your own parser and use Chunks as explained by Alexis and
combine different chunks into a Phrase or a Paragraph.
This is explained in chapter 4 of the book.

> I know this is possible with PDFLib (replacing the tags with <fontname ...>)
> but how should I do in iText?

With iText you even have a mechanism called FontSelector.
But that's another story. FontSelector doesn't work with
tags, but looks at the UNICODE value of each character.
If a Chinese character encountered, it tries finding a
font (in a list of fonts you've provided) that has this
character. (This is explained in chapter 9.)

best regards,
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to