Skip to content

Make CJKFont optional#184

Merged
pbrant merged 1 commit into
flyingsaucerproject:masterfrom
sc-mickael:patch-1
Sep 4, 2023
Merged

Make CJKFont optional#184
pbrant merged 1 commit into
flyingsaucerproject:masterfrom
sc-mickael:patch-1

Conversation

@sc-mickael

Copy link
Copy Markdown
Contributor

ITextFontResolver init is very slow on my computer and server (8000ms). After some research, it seems that createInitialFontMap() method take too much time. The cause is the cjkfonts which I did not use.
Is it possible to make this loading optional ?
Thanks a lot

ITextFontResolver init is very slow on my computer and server (8000ms).
After some research, it seems that createInitialFontMap() method take too much time.
The cause is the cjkfonts which I did not use.
Is it possible to make this loading optional ?
Thanks a lot
@asolntsev

Copy link
Copy Markdown
Member

@sc-mickael Upvote for this change. Loading Asian fonts takes ~5 seconds - which is too slow when we run unit-tests or re-generate PDF while developing templates.

The initial intention was to load these fonts ONLY if file iTextAsian.jar is available on the class path. So it was NOT loaded by default for most users.

But nowadays file cjkfonts.properties is contained in file openpdf-1.3.11.jar, and this cannot be removed from classpath.

@pbrant pbrant merged commit 872b38f into flyingsaucerproject:master Sep 4, 2023
@pbrant

pbrant commented Sep 5, 2023

Copy link
Copy Markdown
Member

Released 9.2.0

@sc-mickael

Copy link
Copy Markdown
Contributor Author

Thanks a lot ! I tried it and it seems to work!

asolntsev added a commit that referenced this pull request Sep 25, 2023
1. extracted CJK-specific part from ITextFontResolver to a subclass CJKFontResolver
2. Users can pass it to ITextRenderer, e.g. `new ITextRenderer(new CJKFontResolver())`
@asolntsev

Copy link
Copy Markdown
Member

For the record: later I converted parameter withCjkFonts to subclass CJKFontResolver in #204

asolntsev added a commit that referenced this pull request Sep 25, 2023
1. extracted CJK-specific part from ITextFontResolver to a subclass CJKFontResolver
2. Users can pass it to ITextRenderer, e.g. `new ITextRenderer(new CJKFontResolver())`
@asolntsev asolntsev added this to the 9.2.2 milestone Sep 26, 2023
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.

3 participants