Hopding / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
6.97k stars 671 forks source link

Space issue with embedded Hindi Font #1409

Open marco-th opened 1 year ago

marco-th commented 1 year ago

What were you trying to do?

When I render Hindi text there are spaces between characters that should not be there. When I use the same font in e.g. Word the font works and displays the text correctly.

How did you attempt to do it?

Here is a minimal example to reproduce the issue: https://codesandbox.io/s/happy-lamarr-5qu6c6?file=/src/index.js:176-186

What actually happened?

This is how the text gets rendered in the PDF:

image

What did you expect to happen?

This is how the text should be rendered in the PDF:

image

How can we reproduce the issue?

Here is a minimal example to reproduce the issue: https://codesandbox.io/s/happy-lamarr-5qu6c6?file=/src/index.js:176-186

Version

latest

What environment are you running pdf-lib in?

Browser

Checklist

Additional Notes

No response

pratik2575 commented 1 year ago

Same issue in Gujarati Font.

manik-biradar007 commented 1 year ago

@marco-th and @pratik2575 I found solution for this, please email me at sandiponly4you at gmail.com

Prat10 commented 1 year ago

I had the same issue? is there any solution

PatelTilak commented 11 months ago

You can fix this by adding { subset: true } while emending font.

pdfDoc.embedFont(customFontBytes, { subset: true });

ephraimduncan commented 11 months ago

I have the same issue with Caveat

sridevi-dns commented 5 months ago

You can fix this by adding { subset: true } while emending font.

pdfDoc.embedFont(customFontBytes, { subset: true });

This worked wonderfully for kannada as well..thanks a lot.