wordSpacing with a negative number breaks the justification of a text
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- tooling
调研方向
首先使用 pdfkit 0.13.0,采用 justify 对齐和负的 wordSpacing 值,复现所提供的文本示例。跟踪该案例涉及的文本布局和两端对齐处理;完成的标准是负的单词间距会改变单词之间的距离,同时不会丢失两端对齐。
由索引模型根据 Issue 内容生成。
描述
Bug Report
Description of the problem
I would like to reduce the space between the words of a text.
I used the 'wordSpacing' property, but when adding a negative number to the 'wordSpacing', the justification of the text is lost. Below is the text that I am trying to change the distance between the words:
Code sample
let text = "Com a história de "o menino e o robô" compreendemos o perigo da robótica, não há dados científicos
sobre robôs dominarem o mundo, mas a riscos de exposição a novos riscos, como campos eletromagnéticos, acidentes,
desempregos devido a chegada da automação, além de ataques cibernéticos e desenvolvimento de armas autônomas.";
let textOptions = {
width: 436,
align: 'justify',
indent: 27.638,
lineBreak: true,
wordSpacing: -2.0,
lineGap: -6.0
};
pdfDoc
.font(POPPINS_REGULAR.ttf)
.fill("#000000")
.fontSize(22)
.text(text, 69, 64, textOptions)
Your environment
- pdfkit version: 0.13.0
- Node version: v14.21.2
- Browser version (if applicable):
- Operating System:
- 主要语言
- JavaScript
- 星标
- 10.7k
- 派生
- 1.2k
- 平均合并
- 21 小时 41 分钟
- 30 天内合并 PR
- 27
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
foliojs/pdfkit 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
PDFKit crashes when providing fonts as Buffer in table可能已有人在做 @ykw9263 于 133 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
foliojs/pdfkit#1743 · 13 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
foliojs/pdfkit#1512 · 1 条评论 · 2 个 reaction ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
parse-community/parse-server#10871 · 1 条评论 ·
维护者通常 1 天内回复
-
Jump in core size from v2.11.2可能已有人在做 @caolan-tether 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
holepunchto/hyperbee2#126 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
521xueweihan/HelloGitHub#4270 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
accessibility bug embed
难度 2/5 1-3 小时 新手友好度 85/100
quarto-dev/quarto-cli#15306 ·
维护者通常 1 天内回复