foliojs / fontkit

An advanced font engine for Node and the browser
1.5k stars 223 forks source link

[Performance] WOFF font format for CJK languages is 5x slower in Chrome and Unresponsive in Firefox #321

Open Saranya-Sivanandham opened 1 year ago

Saranya-Sivanandham commented 1 year ago

We are using PDFMake which in turn makes use of PDFKit to generate a text-only single-page PDF.

For languages Chinese, Hebrew & Japanese, we are making use of the below Google font in WOFF format downloaded from Google Webfonts helper.

Chinese - Noto Sans SC (1.5 MB) Download link Choose Historic support to get WOFF format.

Japanese / Hebrew - M PLUS 1p regular Download link Choose Historic support to get WOFF format.

For the above languages with the mentioned fonts, the pdf download takes around 8 seconds - 11 seconds for a single page. However, for other languages, it is way lesser ~ around 1 -2 seconds.

With TTF it works better.

Note: Unable to upload woff font in GitHub. So shared the link from where I downloaded it.

blikblum commented 11 months ago

Are you creating the PDF in server side and downloading? If so the problem can be the PDF size due to the font used.

To see if is a perf problem of the library is necessary to measure the time to create the pdf eliminating the network transfer variable