eborisow a écrit :
Alias John Brown wrote:
According to the documentation at http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics

"It is currently not possible to easily configure fonts from Java code."

I assume that this means that it is not impossible, but I have no idea
how. Hopefully an expert will turn up soon.



John,

Thanks for the reply.  I have also tried specifying the config file using
the method in the docs.  Here is what I tried:

            DefaultConfigurationBuilder cfgBuilder = new
DefaultConfigurationBuilder();
            Configuration cfg = cfgBuilder.buildFromFile(new File(baseDir,
"Local\\personal\\durkan\\projects\\fop\\new-font.conf.xml"));
            fopFactory.setUserConfig(cfg);

This gives me the same result.  The fonts are not available.  So, I am
probably doing something wrong.

Thanks,
Eric
So did you manage to specify fonts programmatically ?
I am very interested in this feature because I'd like to embed the fonts required
by my software in the jar file.

AFAIK, this is currently not possible directly, because even if I embed the
configuration file and read it with cfgBuilder.build(InputStream), this file
still refers to a font file name that does not exist in the disk files hierarchy. I'd had to copy the fonts files somewhere in a temp dir, then use setFontBaseURL() to specify this dir : I don't like that approach. File copy shouldn't be required.

BTW, I want to embed one single OS installed font. Currently I use
<fonts>  <auto-detect/>  </fonts> which works fine, but scans the whole
system fonts directory and that takes time (and probably memory).
Is the only other way to generate a font metric as described here
http://xmlgraphics.apache.org/fop/0.95/fonts.html#register ?

It would be nice if we could refer to a single font file by its name, and fop
would generate the font metric at execution time.
Well I could copy the font in a temp dir and still use <auto-detect>,
but I'd like to avoid this copy.

Thanks,

  Laurent Morel



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to