Hi,

Am 22.05.2012 15:45, schrieb Hesham G.:
Hello ,

This is a more Java question rather than a PDFBox question : ) , but I can't 
find an answer to it.

I am trying to use a system font file in drawing text to a PDF file using 
PDFBox, through the method :
PDTrueTypeFont.loadTTF( PDDocuent pdfFile, File fontFile );

The problem here is that the loadTTF(...) method accepts a (File) object, while 
I can only get the System font as a (Font) object using this code :
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fonts = e.getAllFonts();
These are all AWT-Fonts which can't be embedded to a pdf directly. They have to
be converted somehow. I guess there isn't any code to do that, but please prove
me wrong if you find something appropriate. ;-)

Where I get one of the (fonts) objects to use it. Is there a way to convert the 
Font object to File object ?
I am using Mac OS X.
All those awt-fonts should be related to a "real" font somewhere in the filesystem. Maybe you are able to find them using the name from the AWT-Font? Probably those have a suitable format which can be used within a pdf.

Best regards ,
Hesham


BR
Andreas Lehmkühler

Reply via email to