Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wordSpacing with a negative number breaks the justification of a text #1458

Open
jonasmarcelo opened this issue Aug 1, 2023 · 1 comment

Comments

@jonasmarcelo
Copy link

jonasmarcelo commented Aug 1, 2023

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:
@jonasmarcelo
Copy link
Author

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

No branches or pull requests

1 participant