#buildFontListFromConfigurationstatic method does (almost) all the job. It takes following input parameters:
Configurationobject with a
<renderer>as root element.
- A URL (as a String) to resolve relative font URLs with. Null is supported.
FontResolver, which can be a
- A boolean set to true if an exception should be thrown if an error is found.
FontCacheinstance or null if caching is disabled.
#buildFontListFromConfigurationcan be called from everywhere with a fresh
FontCacheinstance. The latter is useful as it gathers failed fonts. A fresh cache instance is needed, because cached data may survive the JVM. The cache saves itself in a
~/.fop/fop-fonts.cachefile, holding font descriptions. Font descriptions seem to be only invalidated when FOP attempts to load a font for "real" (at rendering time). So when hitting the cache in a test program, it sometimes returned font descriptions that shouldn't have been there. The
FOUserAgentwhich is created from a
FopFactoryitself is created from a
Configurationwhich contains the
<renderer>elements, so there should be some instance reuse here. I've found a private method somewhere which logs font duplicates but I can't find it back to see if there was any hook around (didn't seem so). Anyways it will be cleaner to sort out font triplets with the same value. Printing the font triplets on the console, I noted they take the right font name, whatever the font file is. Adios, proprietary font naming convention!