jasperreports icon indicating copy to clipboard operation
jasperreports copied to clipboard

add font fallback list feature for PDF output

Open neowcng opened this issue 5 years ago • 2 comments

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

neowcng avatar Apr 28 '20 14:04 neowcng

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.

dadza avatar Apr 29 '20 06:04 dadza

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

neowcng avatar Apr 29 '20 07:04 neowcng