I turned to the BIRT source code and found that it was not possible to configure BIRT to register inline fonts from the class path. BIRT registers fonts in the paths specified in the fontsConfig.xml file. He uses iText FontFactory. Surprisingly, it FontFactorycan register fonts from the class path itself. But the developers of BIRT probably don’t know about this function, so BIRT does not register a font that is not in the file system, i.e. When File#exists()returns false.
Fortunately, it FontFactory.register()is a static method, so there is a workaround: we can register fonts ourselves, bypassing BIRT. We can only do the following before initializing the BIRT:
FontFactory.register("/com/example/fonts/font1.ttf");
FontFactory.register("/com/example/fonts/font2.ttf");
I tried this and the fonts are correctly embedded in the PDF output.
dened source
share