I'm not suggesting that it wouldn't work, just that it sounds like some ugly hack to combine the two methods, that the xconf file should be required if you're calling FOP from a command prompt and if you're using the classes with embedded code you could skip the xconf file and use the proper code to import the font with the FontLoader.
In my case there's an additional benefit to using the FontLoader, because I'm using the classes in embedded dynamic code. I wrote a program which puts all the data to be printed into an XML file. It writes the data with made up tags to specify coordinates on a page to print each piece of text with absolute locations. I tell it how many characters I want to print across the page and it dynamically adjusts the font size to fit. I'm using a fixed point font, so I get the font size from the TTFLoader. It reads the font into a CustomFont which implements FontDescriptor which extends FontMetrics which has a method getWidth. -----Original Message----- From: Jayant Ghagre [mailto:jayant.gha...@ambest.com] Sent: Friday, July 02, 2010 8:22 AM To: fop-users@xmlgraphics.apache.org Subject: RE: FOP trunk error message when run from ant Eric, In our case, we get data from database as XML, apply the reports specific xsl-fo template (.xsl file) and generate a PDF report. That's our requirement and the solution I mentioned works very well for us. All we need is create FOP Factory instance, specify the configuration file location, specify transformer (XSLT), provide source XML file and we have what we need a PDF report. Also we keep our application related fonts in a separate folder than windows folder. Regards, Jayant |------------> | From: | |------------> >----------------------------------------------------------------------- ------------------------------------------------------------------------ ---| |"Eric Douglas" <edoug...@blockhouse.com> | >----------------------------------------------------------------------- ------------------------------------------------------------------------ ---| |------------> | To: | |------------> >----------------------------------------------------------------------- ------------------------------------------------------------------------ ---| |<fop-users@xmlgraphics.apache.org> | >----------------------------------------------------------------------- ------------------------------------------------------------------------ ---| |------------> | Date: | |------------> >----------------------------------------------------------------------- ------------------------------------------------------------------------ ---| |07/01/2010 04:12 PM | >----------------------------------------------------------------------- ------------------------------------------------------------------------ ---| |------------> | Subject: | |------------> >----------------------------------------------------------------------- ------------------------------------------------------------------------ ---| |RE: FOP trunk error message when run from ant | >----------------------------------------------------------------------- ------------------------------------------------------------------------ ---| 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 DefaultFontResolver 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.gha...@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 Mario, 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 YourAppNameConfig.xml Open the YourAppNameConfig.xml in any editor and add you MyAppFonts folder as shown below <fonts> <!-- embedded fonts --> <!-- register all the fonts found in a directory --> <directory>.\MyAppFonts</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 fonts <auto-detect/> --> </fonts> 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. Regards, Jayant --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org