Problems with embedding a TTF font
Hi there,
I bind several fonts acc. the given description. https://github.com/MrRio/jsPDF#use-of-utf-8--ttf This works e.g. with the ARIAL and ARIALBD font. Certain special characters are also displayed correctly.
However, I need a frame and a fisheye.
For this I want to use the Wingdings font.
Unfortunately, the integration of this font does not work.
The following error occurs:
jsPDF PubSub Error No unicode cmap for font Error: "No unicode cmap for font"
The font appears in the font map. What is possibly wrong here.
How can I use a FishEye and other characters in the PDF as shown here? https://www.key-shortcut.com/schriftsysteme/35-symbole/symbole-typographie
Is a different font necessary?
This thread is known to me but does not help. https://github.com/MrRio/jsPDF/issues/2708
Best Regards
Either your Wingdings font is faulty or this is a bug of jsPDF. In order to check this, could you attach your converted font file?
TTF File wingdings-cufonfonts.zip
Download Source for TTF File: https://www.cufonfonts.com/font/wingdings
Or is there possibly another font or possibility (except images) to create graphics, such as a frame and a fisheye?
You can of course use the path drawing commands: moveTo. lineTo, curveTo, rect, ellipse, etc. Or you can use SVG images and convert them with svg2pdf.
I haven't had the time yet to look into the font file, sorry.
It's ok, I would still rather wait a little longer for the result with the font.
Hello, is there anything new on this topic? I absolutely need this function. Best Regards.
Ok, I just had a look at the font code and read a bit about OpenType fonts. Turns out, jsPDF does not support this kind of font. Your Wingdings font has a platformID of 3 (Windows) and an encodingID of 0 (Symbol). See also here. In order to map JavaScript characters to the glyphs in the font, jsPDF requires a "Unicode to glyph" mapping, i.e. an encodingID of 1.
So, sadly, you need to either use a different font, convert your font so it has a Unicode cmap, or draw the symbols manually.
If you want to and have the time for that you may, of course, also implement support for Symbol (0) cmap encodings. We are always happy about pull requests ;)
hii jspdf code here let pdfbasefont1; await this.pdfImages("Italiana-Regular.ttf",(base64Data)=>{ pdfbasefont1 =base64Data; }); doc.addFileToVFS("MarkaziText-Regular", pdfbasefont1); doc.addFont('MarkaziText-Regular', 'markazi-text', 'normal'); doc.setFont('markazi-text'); this is work on the local machine but i host the aws server custom font not working,please any one resolve this problem
This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.