jasperreports
jasperreports copied to clipboard
add font fallback list feature for PDF output
problem https://github.com/neowcng/jr-font-issues
jasperreport report 6.2.2 introduced the font-set feature which help to separate the font usage by script (e.g. Latin -> Arial, Chinese -> Noto Sans CJK TC) The PR is to extend the feature by testing character-by-character with the actual font supported
I don't understand what your change is meant to do, we're already testing character by character at https://github.com/TIBCOSoftware/jasperreports/blob/master/jasperreports/src/net/sf/jasperreports/engine/util/JRStyledTextUtil.java#L408
Please include a concrete case with details on how it works with the current code and your desired outcome.
Assuming user want to display this string in the PDF https://github.com/neowcng/jr-font-issues/blob/master/src/test/resources/demo.txt
The PDF would attempt to use the following priority font list Let's say we defined the priority list here https://github.com/neowcng/jr-font-issues/blob/master/src/main/resources/demo/fonts.xml which means Noto Serif -> Noto Serif CJK TC -> HanaMinA -> HanaMinB -> HanaMinPlus
Desired output https://github.com/neowcng/jr-font-issues/blob/master/docs/jr-6-12-2-patched.pdf
Current output https://github.com/neowcng/jr-font-issues/blob/master/docs/jr-6-12-2-orig.pdf
Expected font usage: '1_abc' -> Noto Serif '𨋢' -> HanaMinA (since only 'Noto Serif CJK TC' does not contain glyph for this character, it should fallback to this font) '所有' -> Noto Serif CJK TC (this font contains the glyph and no need to fallback to HanaMinA)
The following screenshots dump the actual font rendered in the PDF https://github.com/neowcng/jr-font-issues/blob/master/docs/jr-6-12-2-patched.png https://github.com/neowcng/jr-font-issues/blob/master/docs/jr-6-12-2-orig.png