// Currently we use FOP - inspired by org.apache.fop.render.PrintRendererConfigurator
// iText also has a font discoverer (which we could use
// instead, but don't, since in docx4j we're settled on
// PDF output via XSL FO)
FontFileFinder fontFileFinder = new FontFileFinder();
// Automagically finds a list of font files on local system
// based on os.name
List fontFileList = fontFileFinder.find();
if (regex==null) {
for (Iterator iter = fontFileList.iterator(); iter.hasNext();) {
URL fontUrl = getURL(iter.next());
// parse font to ascertain font info
addPhysicalFont( fontUrl);
}
} else {
Pattern pattern = Pattern.compile(regex);
for (Iterator iter = fontFileList.iterator(); iter.hasNext();) {
URL fontUrl = getURL(iter.next());
// parse font to ascertain font info
if (pattern.matcher(fontUrl.toString()).matches()){
addPhysicalFont( fontUrl);
} else {
// log.debug("Ignoring " + fontUrl.toString() );
}
}
}
// Add fonts from our Temporary Embedded Fonts dir
fontFileList = fontFileFinder.find( ObfuscatedFontPart.getTemporaryEmbeddedFontsDir() );
for (Iterator iter = fontFileList.iterator(); iter.hasNext();) {
URL fontUrl = getURL(iter.next());
addPhysicalFont( fontUrl);
}