-
Notifications
You must be signed in to change notification settings - Fork 2k
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
"No unicode cmap for font" happened when i using client version. #290
Comments
Your font needs to have a Unicode CMAP - can you verify that is has one? |
If this font do not have a Unicode CMAP, why can this run in server mode perfectly? |
I don't know your setup, so I cannot answer the question. Assuming the CMap is present in the vfs_fonts, there might be space issue inside your browsers. Have you checked (with Chrome debugger) if it gets loaded correctly? |
This is server version: It work correctly. Because this font work correctly so i assume this font have a Unicode CMAP, but it cannot work on client version. This is client version: Uncaught Error: No unicode cmap for font pdfmake.js:22153 Uncaught Error: No unicode cmap for fontPDFFont.registerTTF @ pdfmake.js:22153PDFFont @ pdfmake.js:22026module.exports.font @ pdfmake.js:19762FontWrapper.getFont @ pdfmake.js:14190FontWrapper.widthOfString @ pdfmake.js:14201(anonymous function) @ pdfmake.js:16133measure @ pdfmake.js:16118TextTools.buildInlines @ pdfmake.js:15941DocMeasure.measureLeaf @ pdfmake.js:14557(anonymous function) @ pdfmake.js:14437StyleContextStack.auto @ pdfmake.js:16306DocMeasure.measureNode @ pdfmake.js:14422DocMeasure.measureDocument @ pdfmake.js:14409LayoutBuilder.tryLayoutDocument @ pdfmake.js:2425LayoutBuilder.layoutDocument @ pdfmake.js:2413PdfPrinter.createPdfKitDocument @ pdfmake.js:285Document._createDoc @ pdfmake.js:81Document.getDataUrl @ pdfmake.js:160Document.open @ pdfmake.js:108onclick @ Test.html:32 |
Your font (one of the two) does not have a unicode cmap when it gets loaded by pdfkit - the underlying pdf engine of pdfmake. I cannot tell why this is the case - and I don't have time to look deeper into it myself at the moment. If you want to investigate yourself, try to use the Chrome debugger to see, what is going wrong. This might or might not be a pdfkit bug, rather than a pdfmake bug. |
+1 I believe I'm running into the same problem. I'm using the Google Noto CJK font (https://www.google.com/get/noto/#/) and I'm seeing the same error. |
I solved this problem. |
Can you share the updated vfs_fonts.js file you're using? Thanks |
https://mega.co.nz/#!zdVH3bSJ!6lN1vO5_Ty0i0rOljyJrZMConTklVjDiL_Egw6vps5I var fontDescriptors = { |
Amazing, thanks! |
I haven't been able to get it to work. Any chance you could put together a mini-sample project of Chinese working. It'd be a great help. |
+1 |
We were able to get Chinese working in our project: https://github.com/invoiceninja/invoiceninja It took us a while to find an open-source font which worked, we ended up using Ukai: http://www.freedesktop.org/wiki/Software/CJKUnifonts/Download/ |
Thanks for the information. But I got confused on the implementation on your project. is it the |
Yes, that's the correct font file. |
Thanks A lot. I got it working now. @hillelcoren |
@hillelcoren @Joeper214 i download ttc file, Uncaught Error: Font ukai(normal)0 not found in TTC file. how u woking? |
I believe this is the file you need to use https://github.com/invoiceninja/invoiceninja/blob/master/public/js/vfs_fonts/ukai.js |
@hillelcoren i download this file and use this config:
but not working. console log is 'Uncaught TypeError: Cannot read property 'UKai.ttf' of undefined' |
I think Please check it out: http://www.skyarch.net/blog/?p=5673 |
@hillelcoren |
@askie did you mean to create the issue with this project or our app? |
I just installed the NotoSansCJKtc-Light font successfully, but Chinese appears normal while English in this font is spaced one letter per line, vertically, and the document is dozens of pages. Why did you choose Ukai and are there any other Chinese fonts that will display both Chinese and English properly? |
We chose Ukai because it worked and was open source. This was a few years ago, it's certainly possible there are better fonts to use. |
A bug with NotoSansCJK fonts where fixed in foliojs/fontkit#207 but not released yet. In the mean time you can try https://www.npmjs.com/package/pdfkit-next |
Too bad the NotoSansCJK fix hasn’t been released yet. Great clear font for Chinese, but without English it won’t work. I used Transtype 4 to export local Chinese fonts .ttf and they all work in Invoice Ninja. Loving my PDF invoices now |
I use chinese fonts in my project.
When i using server version, it work perfectly.
But when i using client version, it always alert me "No unicode cmap for font".
This is font i used :
https://mega.co.nz/#!WddCwIjR!XVwz3BH8brUc0znBSNQ_vb_NG9iHXtW0ghlkEWz9lo8
This is vfs_fonts.js i builed :
https://mega.co.nz/#!DN9DmSYD!Nd10rPBBfTZ9OFpw7MEQm5A_wrqcQhpECH0z3RLHy-k
This is code i used :
G3548817
The text was updated successfully, but these errors were encountered: