Hi,

my application needs several external TrueType fonts, supplied by the
appropriate ttf-files. It is no problem to create a BaseFont from these
files, but the application only uses the PdfGraphics2D class to print to the
pdf.

Now the problem is as follows:

When i try to create a java.awt.Font object with my font name (e.g. "Gill
Sans"), the getFontName() method falls back to return "dialog". The initial
font name is only available through calling getName() (even if the font is
installed on the system).
Now PdfGraphics2D uses an internal cache for BaseFonts that unfortunately
maps the fonts according to the awt font name (returned by getFontName(),
which in this case is always "dialog").
So every time i call setFont() on PdfGraphics2D with a non-built-in font,
PdfGraphics2D seeks the cache for an entry mapped by the key "dialog" and
then returns the same font even for different "initial font names" (e.g.
"Gill Sans" and "Gill Sans Bold").

Even using my own implementation of FontMapper could not solve the problem,
as the FontMapper is only consulted once - when the BaseFont is not yet in
the cache.

Any suggestions how to register the fonts or prevent java.awt.Font from that
"fallback"?

Thanks in advance, Thorsten




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to