Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding fonts to FOP

Status
Not open for further replies.

helid

Programmer
Mar 15, 2010
14
SE
Hello!
I´m trying to create a barcode in my xsl:fo-file. I´ve downloaded a font file, free3of9.ttf which I´ve saved in the windows/font-folder. I have generated a font metrics xml-file in the fop/config-folder. In the config-folder I´ve changed the userconfig.xml to contain the following:

<font metrics-file="C:\Temp\fop-0.94\conf\Free3of9.xml" kerning="yes" embed-file="C:\WINDOWS\Fonts\free3of9.ttf">
<font-triplet name="Free 3 Of 9" style="normal" weight="normal"/>
</font>

I try to use this font in my xsl-file by writing the following lines:
<fo:table-cell>
<fo:block font-family="Free 3 Of 9">S090127</fo:block>
</fo:table-cell>

I start a command-line window and I try to run the following:
fop -c conf/userconfig.xml xml Myxml.xml -xsl Myxsl.xsl -pdf Output.pdf

I get a message that the font 'Free 3 of 9",normal,400' not found. Substituting with 'any,normal,400'.

What am I doing wrong?

Best regards/
Helena
 
Hello, thanks for your reply.
I tried to describe the paths with file: protocol instead but it didn´t make any difference. Fop says exactly the same as before, font not found.

 
Try put the font files in the same directory as the input and fo documents. (Just to make sure c:\windows accessibility is not a problem.)
 
[0] >It didn´t help either.
I can confirm that. Without file: protocol, on windows os, it should work as well (as of 0.94 and 0.95). And I won't even say one is of better practice.

[1] I think, first and foremost, should make sure the gneration of the metrics file is flawless. What command line eventually are you using to generate it. (Make sure all the jar(s) are included in the classpath -cp.)

[1.1] I have made a quick test case, and it works correctly for free3of9 ttf. For some intriguing ttf/ttc, the generation of the metrics file does result in some bugs and has to be rectified manually, as of the present 0.94/0.95. So I can say in a good degree of confidence, free3of9 ttf should work.
 
Hello again. I´ve generated a new metrics file and now everything works fine. Thank´s for your help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top