GAMBELLI Raffaele wrote:
> 1) How is the right way to covnert awt font in itext font?

There is no such thing as an iText font.
iText uses the font files that are present on your system:
either you provide the path, or iText goes looking for them
in directories such as "c:/windows/fonts"
DefaultFontMapper.awtToPdf() does an attempt to map AWT Font
objects to BaseFont objects. BaseFont objects does an attempt
at finding the corresponding font, but for special uses, you
should extend the default font mapper into a specific font
mapper, for instance: AsianFontMapper provides a mapping to
CJK fonts. If you need Arabic, you'll have to write your
ArabicFontMapper, or maybe a UniversalFontMapper.

> 2) I have an input string that can be in any charset,
 > can be from english to arabic to chinese and so on,
> I'm only asking which is the way in itext pdf to print that string.

See my initial response: you certainly need RTL because
Arabic is written from right to left; you probably also
need FontSelector if you want to switch from one font to
the other using the same String.

> The flow in my software starts from an xml, in which
> there can be from simple paragraph to a complex table,
> I must be able to use every element, either Paragraph
> either PdfPTable to show the right content

Just like the Peace example in Chapter 9 fantastically does.

> 
>>From javadoc of FontMapper:
> A FontMapper implementation handles mappings between AWT Fonts
> and PDF fonts. An interface is used instead of a fixed class
> because there isn't an exact correlation between the font types,
> so each application is free to define a mapping which is appropriate for it.

Hey, that's what I've just explained: one guy contributed
code to map Asian fonts, the result is the AsianFontMapper!

> In that javadoc too there isn't mention of PdfGraphics2D.

No, but you'll find no examples where DefaultFontMapper is
used in a context that doesn't use PdfGraphics2D. Your use
is the first time we hear about some other usage.

Anyway: my initial answer is still valid: use RTL and FontSelector!
-- 
This answer is provided by 1T3XT BVBA

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
[email protected]
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