[#10816] - PDF Exporting Seems to Not Prioritize Primary Font in Font Set

Bug report
Project: Severity:
No Change Required
Component: Reproducibility:
Assigned to:

I have 3 font family setup:
1. Liberation Sans - complete with styles
2. Liberation Sans - no styles - normal font only
3. Ming(for ISO10646) - Chinese font

I have 2 font sets:
Font1 - Liberation Sans (primary), Ming
Font2 - Liberation Sans - no styles (primary), Ming

Test String: Advertising 廣告從業員

Column 1: Font 1 (odd) or Font 2 (even)
Column 2: Liberation Sans (odd) or Liberation Sans - no styles (even)
Column 3: Ming - this is normal only

Row 1-2: Normal
Row 3-4: Bold
Row 5-6: Italic
Row 7-8: Bold Italic
Row 9-10: Underline
Row 10-11: Strikethrough

I was expecting that for the normal one, the Advertising part in Column 1 should be rendered in Liberation font, but it was not.

From the test it seems that the PDFExporter will do the following in order:
1. find a font family that can render everything in the text container including styles (see row 1, everything is in Ming), else
2. find if part of the text can be rendered in a font family that has the style specified and use it partially in rendering (see row 3, Advertising is in Liberation), else
3. find a font family that can render the text in an approximation of the styles used (see row 4, Advertising is rendered in a Bold style approximation of Ming font).

Shouldn't it be:
1. Use primary font, check each character if it can be rendered in the glyphs available in primary font. Use approximation of style if needed (though this is not a problem usually for English fonts).
2. For remaining characters, check each font specified in font set in order and use if matched. Use approximation of style if needed.

Basically, just need to have the priority of Font Set ordering (with primary settings) > style availability in PDF Font declaration.

If the current behavior is as expected, can we have option to have the above way of rendering for PDF Exporting?

PDF icon simpletest.pdf84.89 KB
cutebluangel's picture
Joined: Sep 23 2012 - 8:45pm
Last seen: 4 days 5 hours ago



This is the template file used

Binary Data simpletest.jrxml13.62 KB

As I cannot upload the jar file because of its size, this is the font family declaration inside the jar file.

File fontsfamily1524657160496.xml1.14 KB

any updates on this?


The "primary" font family in a font set is actually only used as a fallback for texts that have characters not included in any of fonts in the set. So the flag is arguably misnamed, calling it "fallback" font family would have been clearer.

The behaviour that you describe is how font sets were intended to work. The font that covers the longest substring of text (starting at a position) is used, with exact style matches preferred.

Note that for font set families you can also define a list of included or excluded scripts. In your case, if you want the Ming font to be used for Chinese characters only, you could use Han or Hani as included script for the font family.


Thanks for the explanation lucian! For the last paragraph, can I ask for a sample on how to do this either in Jasper Studio / Eclipse with Jasper Plugin?
Or a sample of a font set jar with such settings (assuming this is configured in the font jar file)?


In Jaspersoft Studio, you can define included and excluded scripts for a font set family by expanding the font set under Preferences/Jaspersoft Studio/Fonts, selecting the family, doing Edit and then Add Include/Exclude Scripts. Studio shows a list of scripts that you can choose from. And if you want the Ming font to be used only for Chinese characters, you can add Han to Include Scripts for the Ming family in your font set.

  • Resolution:Open» No Change Required

The suggested solution by Lucianc is effective. I simply set the Chinese fonts in the mixed English and Chinese Font Sets to exclude Common and Inherited.

  • Status:New» Closed