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

Reply via email to