See the example free_chart.java in my site. You have now also the option of creating a PdfGraphics2D that will produce the fonts as shapes; the font mapper is not needed.
Best Regards, Paulo Soares > -----Original Message----- > From: Erwin Achermann [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, September 03, 2002 15:16 > To: iText (E-Mail) > Subject: [iText-questions] Encoding used by DefaultFontMapper > > Hi iText'ers, > > I came across the following problem: printing Unicode with > (Graphics2D)g.drawString() works fine on screen for all unicodes, but not > using PdfGraphics2D class. I figured that this is due to the fact that the > DefaultFontMapper used in PdfGraphics2D uses the font encoding CP1252. No > means are provided to set the font encoding explicitly. I tried to write > my own DefaultFontManager (which had the encoding for the basefonts set to > IDENTITY_H or IDENTITY_V [what's the difference or reason for the two > identities, anyhow]) but this leads (run the attached example) to the > following exception, (encoding in DefaultFontMapper is set to > BaseFont.IDENTITY_H) > > ExceptionConverter: com.lowagie.text.DocumentException: Identity-H > at com.lowagie.text.pdf.Type1Font.<init>(Type1Font.java:252) > at com.lowagie.text.pdf.BaseFont.createFont(BaseFont.java:360) > at com.lowagie.text.pdf.BaseFont.createFont(BaseFont.java:313) > at > com.lowagie.text.pdf.DefaultFontMapper.awtToPdf(DefaultFontMapper.java:125 > ) > at > com.lowagie.text.pdf.PdfGraphics2D.getCachedBaseFont(PdfGraphics2D.java:51 > 4) > at > com.lowagie.text.pdf.PdfGraphics2D.setFont(PdfGraphics2D.java:508) > at com.lowagie.text.pdf.PdfGraphics2D.<init>(PdfGraphics2D.java:140) > at > com.lowagie.text.pdf.PdfContentByte.createGraphics(PdfContentByte.java:216 > 8) > at > com.lowagie.text.pdf.PdfContentByte.createGraphics(PdfContentByte.java:215 > 7) > at DerivedScreen.<init>(DerivedScreen.java:50) > at DerivedScreen.main(DerivedScreen.java:72) > > > This stack trace raises several questions: > Why is it trying to create a Type1Font? I'm only using arial.ttf, don't I? > > What would be the proposed way to give the user a chance for changing the > encoding? > The best (most convenient for the user) would be, if > PdfGraphics2D.drawString() would switch encoding (and associated BaseFont) > if a Unicode character outside the current encoding is encountered. Are > there any means for that? > > Thanks for any help and cheers > Erwin > > > > > << File: DerivedScreen.java >> ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
