flyingsaucerproject / flyingsaucer

XML/XHTML and CSS 2.1 renderer in pure Java
Other
1.98k stars 556 forks source link

Make CJKFont optional #184

Closed sc-mickael closed 1 year ago

sc-mickael commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

Released 9.2.0

sc-mickael commented 1 year ago

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

asolntsev commented 11 months ago

For the record: later I converted parameter withCjkFonts to subclass CJKFontResolver in https://github.com/flyingsaucerproject/flyingsaucer/pull/204