Performance 5x Slower PDFKit Document creation and unresponsive for CJK custom WOFF fonts.

未关闭
#1,469 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
performance

调研方向

首先,在 Node 18 下使用 PDFKit 0.12.10 和链接的 CJK WOFF 字体复现单页 PDF 案例,并将创建时间和浏览器响应性与使用相同字体的 TTF 格式进行比较。完成的标准是识别并解决 WOFF 特有的变慢问题,同时不导致正常字体生成出现回归,然后在 Chrome 和 Firefox 中验证行为。

由索引模型根据 Issue 内容生成。

描述

Bug Report

Slow PDFKit Document creation and unresponsive, when WOFF type fonts are used.
No performance impact for the same font in TTF

Description of the problem

We are generating 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.And it becomes unresponsive in Firefox. However, for other languages, it is way less ~ around 1 -2 seconds.

With TTF it works better without any issues

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

Your environment

  • pdfkit version: 0.12.10
  • Node version: 18
  • Browser version (if applicable): Chrome Delay is seen but in Firefox it becomes unresponsive.
  • Operating System: Windows
主要语言
JavaScript
星标
10.7k
派生
1.2k
平均合并
21 小时 41 分钟
30 天内合并 PR
27

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

foliojs/pdfkit 的其他 Issue

查看 foliojs/pdfkit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。