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

Support for letter-spacing Attribute in <text> Element #289

Open
junboxiao opened this issue May 30, 2024 · 4 comments
Open

Support for letter-spacing Attribute in <text> Element #289

junboxiao opened this issue May 30, 2024 · 4 comments
Labels
enhancement help wanted Help with creating a proper test-case, looking up the spec, or creating a pull request.

Comments

@junboxiao
Copy link

Description:

I have encountered an issue where svg2pdf.js does not support the letter-spacing attribute in SVG elements. This attribute is crucial for proper text rendering in my project.

Steps to Reproduce:

Create an SVG with a element that includes the letter-spacing attribute.
Convert the SVG to PDF using svg2pdf.js.
Observe that the letter-spacing attribute is not applied in the PDF output.
Expected Behavior:
The letter-spacing attribute should be supported and correctly applied to text elements in the converted PDF.

Actual Behavior:
The letter-spacing attribute is ignored, and the text appears without the specified spacing in the PDF.

Example:

<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg">
  <text x="10" y="20" letter-spacing="10px" font-family="Arial" font-size="20">Example Text</text>
</svg>

When converted to PDF, the letter-spacing is not reflected.

Environment:

svg2pdf.js version: ^2.2.3
Browser: Chrome
Operating System: MacOS
Thank you for your attention to this matter. Implementing support for the letter-spacing attribute would greatly improve text rendering capabilities in svg2pdf.js.

@yGuy
Copy link
Member

yGuy commented May 31, 2024

Is there support for this on the level of js2pdf ? If not, I guess it would need to be added there, first, so we can use the feature, here.

@junboxiao
Copy link
Author

Thank you for your response.

The letter-spacing attribute is indeed supported by jsPDF. Therefore, it should be feasible to implement this feature in svg2pdf.js using the existing capabilities of jsPDF.

If you need any further information or assistance in implementing this feature, please let me know. I am looking forward to seeing this enhancement in svg2pdf.js.

Thank you for your attention to this matter.

@yGuy yGuy added the help wanted Help with creating a proper test-case, looking up the spec, or creating a pull request. label Jun 3, 2024
@yGuy
Copy link
Member

yGuy commented Jun 3, 2024

Great, thanks.

We'll be accepting PRs for this feature.

@junboxiao
Copy link
Author

Great, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted Help with creating a proper test-case, looking up the spec, or creating a pull request.
Projects
None yet
Development

No branches or pull requests

2 participants