dorairaj wrote:
>
> 1T3XT BVBA wrote:
>> In plain iText (without Graphics2D), this is done by the FontSelector.
>
> but i did lot of stuff to create pdf pages using graphics2D object.
>
> is it not possible to identify the encoding using Graphics2d .drawString() ?
The mapper doesn't look at the characters. The mapper only looks at the
font that is requested.
If Java passes a java.awt.Font object that can be mapped to a
com.itextpdf.text.pdf.BaseFont that has the needed glyph, then it will
work. If Java passes a java.awt.Font object that can't be mapped, it
won't work.
By choosing to work with Graphics2D, you've put the responsibility in
the hands of Java, not of iText. It's up to you to make sure that Java
asks for the correct font.
If you look at the examples, you'll see for instance:
public TextExample3() {
akira = new AttributedString(
"Akira Kurosawa (\u9ed2\u6fa4 \u660e or \u9ed2\u6ca2 \u660e, " +
"Kurosawa Akira, 23 March 1910 - 6 September 1998) was a " +
"Japanese film director, producer, screenwriter and editor. " +
"In a career that spanned 50 years, Kurosawa directed 30 films. " +
"He is widely regarded as one of the most important and " +
"influential filmmakers in film history.");
akira.addAttribute(TextAttribute.FONT,
new Font("SansSerif", Font.PLAIN, 12));
akira.addAttribute(TextAttribute.FONT,
new Font("SansSerif", Font.BOLD, 12), 0, 14);
akira.addAttribute(TextAttribute.FONT,
new Font("MS PGothic", Font.PLAIN, 12), 16, 20);
akira.addAttribute(TextAttribute.FONT,
new Font("MS PGothic", Font.PLAIN, 12), 24, 28);
}
As you can see, the choice of fonts is made on the Java side.
The mapper doesn't care (and doesn't know!) if the font has to show
the glyph for "A" or the glyph "\u9ed2". The mapper only knows that
Java is asking for "SansSerif" and "MS PGothic". If the mapper is
well written, it will return a BaseFont object for Helvetica and one
that refers to the MS Gothic True Type Collection.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/