Hi Paulo,
thanks for your prompt reply.
> > 1. Why CP1253 is not defined in
> > com.lowagie.text.pdf.BaseFont class in the
> standard
> > releases of iText so someone needs to add the
> > following line:
> >
> > /** A possible encoding. */
> > public static final String CP1253 = "Cp1253";
> >
> > to this file and ant-build iText in order to be
> able
> > to use Greek fonts? :-)
> >
>
> [Paulo wrote:] It's just a String. We can't have all
encings as constants.
OK, but you run the danger of being accused of
language discrimination. On what criteria do you
contain a certain language and not another? :-)
By the way, what is the problem for adding all
encodings? I would even suggest to put all encodings
to a property file (e.g. encodings.properties) instead
of having them as constants and reference it from
BaseFont. This way, users could add missing encodings
without need for re-compilation. If MS supports all
languages (even Zulu) why not iText?
> > BaseFont bfArial =
> > BaseFont.createFont("c:\\winnt\\fonts\\arial.ttf",
> > BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
> > Font font = new Font(bfArial, 18);
> > document.add(new Paragraph("ÃåéÜ óïõ êüóìå!"));
> >
>
> Almost work. You define the font but don't use it?
Thanks, it did work, accents too. Sorry, I did forget
to add:
document.add(new Paragraph("ÃåéÜ óïõ êüóìå!", font));
> > 3. Greek letters are not rendered if printed
> through Graphics or Graphics2D:
> >
> You need here:
>
> DefaultFontMapper.BaseFontParameters pp =
> mapper.getBaseFontParameters("Arial");
> if (pp!=null) {
> pp.encoding = BaseFont.IDENTITY_H;
> }
>
> > 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);
> > 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?
Thank you again for your replies and this great pdf
library.
Best regards,
John.
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.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