Getting FOP working
Posted by mholmes on 04 Nov 2008 in Activity log
Actually, that's a misleading title; FOP is already working. The issue is how to configure the font settings, and how, then, we might deploy the system with working font settings. Here are the basics:
- FOP comes with the capability to handle all the BASE 14 fonts (the fonts which are guaranteed to be in every PDF reader). It seems to know about those font metrics without any configuration. That means I can start developing my code using those fonts (which means Helvetica, Times and Courier), without addressing any of the problems below, but that's very limiting.
- To use other fonts, you first need to generate font-metric files for them. These are XML files encoding the metrics of the fonts, which FOP uses to calculate layout etc. The instructions on the FOP site for generating these files doesn't work; the TTFReader class is not found.
- Other documentation on the FOP site suggests that the latest version (0.95, which we think = fop-0.20.5.jar, which is in our Cocoon 2.11's) can work out the metrics for itself if you tell it where to find the fonts, using the fop.xconf file. However, we don't know where to put such a fop.xconf file on Cocoon, and how to tell FOP where to find it.
- Paths to fonts and font-metrics files need to be full paths for FOP to use them, as far as we can tell. That makes deployment difficult. Up to now, teiJournal is completely config-free, in that you can dump it into any Tomcat and it will just work. If these paths have to be hard-coded, then some kind of configuration script will have to be run when the app is first started, or by the administrator when deploying it. That's a disappointing step backwards.
We're still working on this. We'd very much like to distribute teiJournal with all the DejaVu fonts and metrics files for them, using them by default in the PDF generation; that's allowed under their licenses, and they're more attractive than the BASE 14 fonts.