Closed shubhamcoreform closed 1 year ago
@shubhamcoreform I was having similar issue
Uncaught (in promise) ReferenceError: regeneratorRuntime is not defined
at StateMachine2.match (fontkit.es.js:27473:60)
at setupSyllables (fontkit.es.js:27846:71)
at ShapingPlan2.process2 [as process] (fontkit.es.js:26228:11)
at OTLayoutEngine2.substitute (fontkit.es.js:29733:17)
at LayoutEngine2.substitute (fontkit.es.js:29879:19)
at LayoutEngine2.layout (fontkit.es.js:29865:10)
at TTFFont2.layout (fontkit.es.js:33264:31)
at CustomFontEmbedder2.encodeText (CustomFontEmbedder.ts:64:34)
at PDFFont2.encodeText (PDFFont.ts:72:26)
at PDFPage2.drawText (PDFPage.ts:993:35)
Installing regenerator-runtime
package
npm install regenerator-runtime
and importing it on the top of particular file where we import and use custom font helped me fix the issue.
import 'regenerator-runtime/runtime';
What were you trying to do?
When trying to use a custom font for the language Gujarati and using drawText on a text field, I'm getting an error on:
ReferenceError: regeneratorRuntime is not defined at StateMachine.match (BE\node_modules\@pdf-lib\fontkit\dist\fontkit.umd.js:35623:61) at setupSyllables (BE\node_modules\@pdf-lib\fontkit\dist\fontkit.umd.js:35996:72) at OTLayoutEngine.substitute (BE\node_modules\@pdf-lib\fontkit\dist\fontkit.umd.js:37883:18) at LayoutEngine.substitute (BE\node_modules\@pdf-lib\fontkit\dist\fontkit.umd.js:38029:20) at TTFFont.layout (BE\node_modules\@pdf-lib\fontkit\dist\fontkit.umd.js:41414:32) at CustomFontSubsetEmbedder.CustomFontEmbedder.widthOfTextAtSize (BE\node_modules\pdf-lib\cjs\core\embedders\CustomFontEmbedder.js:62:32) at PDFFont.widthOfTextAtSize (BE\node_modules\pdf-lib\cjs\api\PDFFont.js:53:30)
How did you attempt to do it?
tested with text: 'ગુજરાતી ટેક્સ્ટ' Tested with fonts: Noto Sans Gujarati
What actually happened?
What did you expect to happen?
Expecting no error.
How can we reproduce the issue?
Version
^1.17.1
What environment are you running pdf-lib in?
Node
Checklist
Additional Notes
No response