JasperReport load font extension
I do not use JasperServer, instead I created a webapp using JasperReport 4.0.2 directly.

Templates are not in the default classloader, there are added, using a ContextClassLoader before calling JasperReport.

In recent version of Jasper Report font management changed as indicated in [this document][1]. Therefore I need to provide the Font JARs, which works when I put them in the **WEB-INF/lib** directory directly.

However, for modularity reasons I would like to add them to the classpath using the same ContextClassloader as done with the templates which. But in that case, texts are not rendered with the correct font.

I do think this has something to do with the way JasperReport loads the Font.
Using a debugger I could track it back to the **net.sf.jasperreports.engine.util.getFontInfo(...)** method that does not return the same result.

This is due to the fact that **ExtensionsEnvironment.getExtensionsRegistry().getExtensions(FontFamily.class)** does not returns the same family list in both cases. Extensions are only loaded when JARs are place in **WEB-INF/lib**.
 
Does someone knows how the **net.sf.jasperreports.extensions.getExtensionsRegistry()** could be adapted to retrieve threadRegistry instance instead ? (must be initialized somehow I guess).


  [1]: http://www.jaspersoft.com/sites/default/files/jw-presentations/JW11_JasperReports_Tips_And_Tricks_TeodorDanciu%2002.pdf
JasperReport load font extension
===

I do not use JasperServer, instead I created a webapp using JasperReport 4.0.2 directly.

Templates are not in the default classloader, there are added, using a ContextClassLoader before calling JasperReport.

In recent version of Jasper Report font management changed as indicated in [this document][1]. Therefore I need to provide the Font JARs, which works when I put them in the **WEB-INF/lib** directory directly.

However, for modularity reasons I would like to add them to the classpath using the same ContextClassloader as done with the templates which. But in that case, texts are not rendered with the correct font.

I do think this has something to do with the way JasperReport loads the Font.
Using a debugger I could track it back to the **net.sf.jasperreports.engine.util.getFontInfo(...)** method that does not return the same result.

This is due to the fact that **ExtensionsEnvironment.getExtensionsRegistry().getExtensions(FontFamily.class)** does not returns the same family list in both cases. Extensions are only loaded when JARs are place in **WEB-INF/lib**.
 
Does someone knows how the **net.sf.jasperreports.extensions.getExtensionsRegistry()** could be adapted to retrieve threadRegistry instance instead ? (must be initialized somehow I guess).


  [1]: http://www.jaspersoft.com/sites/default/files/jw-presentations/JW11_JasperReports_Tips_And_Tricks_TeodorDanciu%2002.pdf