Font metrics is a problem, specially because most programs only look at the
Java metrics and don't care about getting the info from
Graphics.getFontMetrics(). I suspect that the solution is to adapt the PDF
font metrics to Java and not the other way around.
I'll keep you posted about this.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Alexandr Molochnikov [SMTP:[EMAIL PROTECTED]
> Sent: Wednesday, September 03, 2003 3:49
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] Java fonts to PDF fonts conversion
> 
> We have a Java application that draws text. The text is drawn in a
> pre-calculated position, using either Java or platform-native fonts. As
> an option, the same program can be used to create PDF document; for
> expediency and code compatibility we use PdfContentByte and PdfTemplate
> classes; this provides us with the Graphics2D object that we simply
> substitute into the existing drawing code, and the original Java code
> generates the PDF document.
> 
> It all works fine, except for one problem: the program must calculate
> the width of the text string in order to position it on the page. This
> in turn depends on the selected font - an herein lies the problem. Fonts
> used by iText differ from the originally selected Java fonts, and string
> width calculated on the basis of Java fonts comes out wrong when the PDF
> document is generated, which in turn screws up the text positioning.
> 
> I could solve the problem if I knew what fonts are used by iText as
> substitute to the original Java fonts. For example, I would like to know
> what font iText uses when the Graphics2D is set to font "SansSerif 12",
> or "Monospace 10" etc. I would then calculate the string width using
> BaseFont getWidthPoint() method.
> 
> So, is there a solution to my problem?
> 
> I will appreciate any help.
> 
> Alex Molochnikov
> Gestalt Corporation
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to