Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 902865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:47:10+00:00 2026-05-15T15:47:10+00:00

I am trying to use a font, that is not installed on my local

  • 0

I am trying to use a font, that is not installed on my local OS, with a JasperReports. The jasper report uses in this way:

<textField>  
  <reportElement x="0" y="0" width="137" height="20"/>  
        <textElement>  
    <font fontName="Corbel" size="12"/>  
    </textElement>  
    <textFieldExpression class="java.lang.String"><![CDATA[$F{something}]]></textFieldExpression>  
</textField>

The font named Corbel was exported as a font extension (using iReport) and is contained in file (Corbel.jar), in folder, on my system.
I add this extension to the classpath of the application, using a code as follows:

ClassLoader cl = new URLClassLoader(new URL[] {new URL("file:///D:/path/to/Corbel_jar_folder/")});  
param = new HashMap();    
param.put(JRParameter.REPORT_CLASS_LOADER, cl);  
jasperReport = JasperCompileManager.compileReport("d:/path/to/Report_with_Corbel_font.jrxml");  
jasperPrint = JasperFillManager.fillReport(jasperReport, param, new JREmptyDataSource());

After the report is filled, I export it using a JRPdfExporter. However, in the result pdf file, the element does not have the Corbel font applied. I have not included the pdf exporting, because I think that the problem is somewhere with the filling.
I have searched and read numerous posts and questions related to using/including fonts (i.e.font extensions) in JasperReports; still I am not aware of where the mistake or the problem resides.
Any help would be greatly appreciated.

Thank you in advance! (sorry for the bad code indentation and I hope I have included enough details)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:47:11+00:00Added an answer on May 15, 2026 at 3:47 pm

    The problem was that the loading of font extensions jars is done from the thread context classloader and from the JRParameter.REPORT_CLASS_LOADER, nor the JRExporterParameter.CLASS_LOADER.

    Therefore, in my case, the current (initial) thread classloader had to be saved, the we had to do something like Thread.currentThread().setContextClassLoader(cl), where cl was the context of the JasperReports based application and then the thread context classloader was reverted to the original one.

    The question has been answered and details are available here.

    I hope this answer will help others facing similar (font) issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use this font: http://www.fontsquirrel.com/fontfacedemo/eb-garamond So I download the type kit and
I been trying to follow the example on this page: http://grysz.com/2010/06/01/use-custom-fonts-in-jasperreports-pdf-exporter/ Still, when I
I'm trying to use this font on my web. It's in Lithuanian language, but
I am trying to use the Search Box that is explained in this blog
I'm trying to use the font 'Cabin Sketch' I incluced the font like it
I'm trying to use a custom font with the text in my Widget. Since
I am trying to use external font in PDF document. I have no problem
I'm trying to use draggable/droppable in a manner that allows you to drag and
I'm starting a new ASP.NET project that I'm trying to use some jQuery with,
I am trying to use ReportLab with Unicode characters, but it is not working.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.