DefaultFontMapper mapper = new DefaultFontMapper();
mapper.insertDirectory("c:\\windows\\fonts");
DefaultFontMapper.BaseFontParameters par =
mapper.getBaseFontParameters("Arial");
if (par != null) {
par.encoding = BaseFont.IDENTITY_H;
}
> -----Original Message-----
> From: John Kostaras [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 04, 2005 3:13 PM
> To: Paulo Soares
> Subject: RE: [iText-questions] Greek fonts once more...
>
> Hi Paulo,
>
> I did run it and it still outputs no Greek characters
> I 'm afraid. :-(
>
> DefaultFontMapper mapper = new DefaultFontMapper();
> DefaultFontMapper.BaseFontParameters par =
> mapper.getBaseFontParameters("Arial");
> if (par != null) {
> par.encoding = BaseFont.IDENTITY_H;
> }
> BaseFont bfArial =
> BaseFont.createFont("c:\\windows\\fonts\\arial.ttf",
> BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
> Font font = new Font(bfArial, 18);
>
> //document.add(new Paragraph("ÃåéÜ óïõ êüóìå!",
> font));
>
> PdfContentByte cb = writer.getDirectContent();
> PdfTemplate tp = cb.createTemplate(w, h);
> Graphics g = tp.createGraphics(w, h, mapper);
> tp.setWidth(w);
> tp.setHeight(h);
>
> java.awt.Font thisFont = new java.awt.Font("Arial",
> java.awt.Font.PLAIN, 18);
> g.setFont(thisFont);
> //g.setFont(font); wrong
> String pear = "Á÷ëÜäé!";
> FontMetrics metrics = g.getFontMetrics();
> int width = metrics.stringWidth(pear);
> g.drawString(pear, (w - width) / 2, 20);
> g.dispose();
> cb.addTemplate(tp, 0, 0);
>
> > >
> > > OK, but where do I use this font? I cannot use it
> > in
> > >
> > > g.setFont(font)
> > >
> > > because this method accepts java.awt.Font only,
> > not
> > > com.lowagie.text.font. Could you provide me with a
> > > full example in this case?
> > >
> >
> > Your example should work.
> >
> Thanks in advance.
>
> Best regards,
>
> John.
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions