The problem is that DefaultFontMapper maps the fonts with the winansi
encoding by default. You'll have to change the encoding to an encoding with
the russian characters or better yet, use the encoding Identity-H to support
all the encodings in that particular font. Assuming that you want to change
the encoding to Arial:
mapper.insertDirectory("c:\\windows\\fonts");
DefaultFontMapper.BaseFontParameters pp =
mapper.getBaseFontParameters("Arial");
if (pp != null)
pp.encoding = BaseFont.IDENTITY_H;
Best Regards,
Paulo Soares
> -----Original Message-----
> From: Wolfram Rittmeyer [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, February 21, 2003 11:00
> To: Itext-Questions@Lists. Sourceforge. Net
> Subject: [iText-questions] still a problem with unicode-characters in
> Graphics2-texts
>
> Hi,
>
> yesterday I already posted a message about problems with using a
> Graphics2-objects method "g.drawString(xyz)".
>
> Now I found the method cb.getGraphics(width, height, fontMapper). And I
> used
> a mapper to map my BaseFont-object (created using BaseFont.EMBEDDED) to an
> awt-Font-object.
>
> But yet I do not get the expected results. Though in other parts all
> russian
> characters are displayed in a correct manner, the g.drawString()-method
> does
> yield inacceptable results. It displays western text but instead of
> printing
> russinan characters it just prints blanks.
>
> Why that? What else have I to add?
>
> Part of my code:
> baseFont = BaseFont.createFont(UNICODE_FONT, BaseFont.IDENTITY_H,
> BaseFont.EMBEDDED);
> cb.setFontAndSize(baseFont, 6);
> FontMapper mapper = new DefaultFontMapper();
> PdfTemplate mapTemplate = cb.createTemplate((int)(realWidth - (2 *
> (mapPadding)) - 2), mapHeight - (2 * (mapPadding)));
> Graphics2D g2 = mapTemplate.createGraphics((int)(realWidth - (2 *
> (mapPadding)) - 2), mapHeight - (2 * (mapPadding)), mapper);
> awtFont = mapper.pdfToAwt(baseFont, 6);
> g2.setFont(awtFont);
> painter.paint(g2, 0, 0, (int)(realWidth - (2 * (border +
> mapPadding)) - 2),
> mapHeight - (2 * (mapPadding)));
>
> The painter uses g2.drawString() but does not set a font itself...
>
> Another strange thing with g2.drawString:
> If I look at the font-list of the AcrobatReader it does *not* show
> "embedded" with the given Font, though this is displayed with every other
> Font created with BaseFont.EMBEDDED.
>
> Thanx for any help,
>
> Wolfram Rittmeyer (from Germany)
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
> The most comprehensive and flexible code editor you can use.
> Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
> www.slickedit.com/sourceforge
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions