On Fri, Jan 20, 2006 at 05:38:14PM +0000, Peter B. West wrote: > I'm looking at issues involved in embedding font files in PDF. Java2D > is doing an increasingly impressive job of providing font facilities, > most recently kerning and ligatures, to developers with a minimum of > fuss. However, in situations like font embedding, the developer needs > access to the physical font. Is it possible to discover the physical > file within J2D?
I need this as well, for the same reason. Anyone who is creating PDFs will need this. There isn't any way to do this using the public Java APIs, so currently I resort to a scan of hard-coded system-dependent directories, with an option for the user to add/remove paths to the search list. It is pretty ugly. I'm sure the path to the physical font file is stored somewhere, so you might be able to find it using some reflection on private fields in sun.* classes, if you can depend on a particular JVM (I can't). FYI, for parsing TTF/OTF font tables you should be able to find some code in iText, Batik, and http://java.freehep.org/vectorgraphics/ On Fri, Jan 20, 2006 at 09:22:16AM -0800, Phil Race wrote: > There is an RFE to address this. > 4752644 : RFE: Getting a java.awt.Font's FilePath > > you can look it up on bugs.sun.com and read the state which can be > summarised as TBD .. we do have some concerns about noting the > embedding flags of a font. Honestly I cannot see how giving the path to a non-embeddable font could be an issue. Obviously it is up to the developer to obey the embeddable flag, if one exists. If the issue is that it is not possible to determine embeddability without parsing the font file, which might inadvertently cause developers to embed restricted fonts, another method like Font.isEmbeddingForbidden() could be added. In any case, very few fonts in use today have the embedding flag set (many do not even have the OTF table which contains the flag), so this issue seems like a red herring. Chris =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
