You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by s-...@artefrance.fr on 2004/08/30 12:31:28 UTC
Can't use relative path to fonts metrics file in userconfig.xml (even while
using fontBaseDir, baseDir and baseURL parameter)
Hello,
I can't use relative path to my fonts file (xml + ttf). Even if I use the
fontBaseDir property in the Configuration fop's object.
I need to do that because my app will be deployed on different platform
using a single JAR file which contains all the needed fonts stuff (there
is not shared server which can "host" the fonts at a single place).
Here is the way i want to access my fonts :
File userConfigFile = new
File(PDFRenderer.class.getResource("/ressources/fop-config/userconfig.xml").getFile());
org.apache.fop.configuration.Configuration.put("fontBaseDir","ressources/fop-fonts/");
Then in my userconfig.xml file :
<font metrics-file="helvetica-narrow.xml" kerning="yes"
embed-file="Type1Fonts/HVB_____.PFB">
<font-triplet name="Helvetica" style="normal" weight="bold"/>
</font>
Everything is working ok when my application isn't embedded in a JAR
file...
But once I launch it within a JAR (and a manifest file, which is the
classical way for deploying java application here), it seems FOP have a
problem to localise my custom fonts file in a relative way ! Here is the
console output :
[ERROR] Failed to read a font metrics file: Invalid font metrics file:
helvetica-narrow.xml (no protocol: helvetica-narrow.xml)
How can I use the class loader to load my custom fonts (this way I already
can load images, config files and other resources directly embedded in my
"final" jar file) ?
Sorry if this problem was already solved, I didn't find it in the
archives.
Waiting for answers, I will look the source code to see how FOP loads
custom fonts... :o)
Help please ! ^^
Symon