Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add font fallback list feature for PDF output #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neowcng
Copy link

@neowcng neowcng commented Apr 28, 2020

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

@dadza
Copy link
Collaborator

dadza commented Apr 29, 2020

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.

@neowcng
Copy link
Author

neowcng commented Apr 29, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants