xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Douglas" <edoug...@blockhouse.com>
Subject RE: FOP trunk error message when run from ant
Date Thu, 01 Jul 2010 20:18:15 GMT
That doesn't seem right at all.  You explain how to get the fonts into
the xconf reference path then show an embedded example.  If you're using
the classes and embedding the code you don't need that.

I pull in fonts like this:
1) Create a TTFFontLoader using the font file name with URI path and a
2) If it's one font per file just use getFont() to create a CustomFont,
if you need to query any font details from the file
3) Build a new FontTriplet and add it into a Java ArrayList
4) Create a new EmbedFontInfo object using the FOP generated metrics
file (URI), the KerningEnabled value (can be queried from CustomFont),
the font triplet array, the font file (URI), and the sub font name (may
be null)
5) Create another Java ArrayList and add in the EmbedFontInfo
6) Generate a Renderer and pass the font ArrayList to setFontList()
7) Put the Renderer into the UserAgent (setRendererOverride)
Then you shouldn't even need the xconf file.

I suggest never referring to fonts as files which should be installed on
the client OS.  We had a program years ago running on Windows 98
referencing a Courier font that didn't come out right because somehow
the same font file had a different looking font in it on different
clients.  I avoid that problem now pulling the font from the server.

-----Original Message-----
From: Jayant Ghagre [mailto:Jayant.Ghagre@ambest.com] 
Sent: Thursday, July 01, 2010 2:40 PM
To: fop-users@xmlgraphics.apache.org
Subject: RE: FOP trunk error message when run from ant


Here's how I am using custom fonts.

In my application folder I have created a folder "MyAppFonts" and copied
all custom fonts in that folder. You can either refer to operating
systems folder such as c:\windows\fonts.

Copy fop.xconf file to your application folder and then rename to

Open the YourAppNameConfig.xml in any editor and add you MyAppFonts
folder as shown below

        <!-- embedded fonts -->
                    <!-- register all the fonts found in a directory -->

                    <!-- register all the fonts found in a directory
                         and all of its sub directories (use with care)
                    <directory recursive="true">.\MyAppFonts</directory>

                    <!-- automatically detect operating system installed

Sample java code

            // configure fopFactory as desired
            FopFactory fopFactory = FopFactory.newInstance();

            fopFactory.setUserConfig(new File( YourAppNameConfig.xml ));

            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();

I am using custom font in this manner.

I hope this information helps.


To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

View raw message