Issue with custom font - Myriad-Pro-Bold
See original GitHub issueI try to add custom font but it seem doesn’t work with all font
I can get Roboto.ttf work but it doesn’t work with this font - https://fontsgeek.com/fonts/Myriad-Pro-Bold
Got below error
sPDF PubSub Error Cannot use 'in' operator to search for '0' in undefined TypeError: Cannot use 'in' operator to search for '0' in undefined
at GlyfTable.glyphFor (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:35270:12)
at Subset.glyphsFor (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:35599:35)
at Subset.encode (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:35638:19)
at identityHFunction (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:30831:39)
at Object.<anonymous> (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:30897:7)
at PubSub.publish (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:404:18)
at putFont (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:2273:12)
at putFonts (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:2304:11)
at putResources (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:2659:5)
at API.__private__.buildDocument (/Users/truongnguyen/Truong/pdf-generator/node_modules/jspdf/dist/jspdf.node.js:3232:5)
Here is the code I added all the front
addFonts() {
const fonts = fs.readdirSync('./fonts');
for (const font of fonts) {
const base64Front = fs.readFileSync('./fonts/' + font).toString('base64');
this.doc.addFileToVFS(font, base64Front);
const arr = font.split('.')[0].split('-');
this.doc.addFont(font, arr[0], arr[1].toLocaleLowerCase());
}
}
Do we have the list or the requirements for the custom font support?
I already try fontconverter provided in other issue and compare base64 are same
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Issue with custom font - Myriad-Pro-Bold #2921 - GitHub
I try to add custom font but it seem doesn't work with all font I can get Roboto.ttf work ... Issue with custom...
Read more >Bold and italic issue using Myriad pro font in the report - Telerik
Hello , I am using Myriad pro font in the report. There is no difference in the regular, bold and italic text of...
Read more >css - Myriad pro font is not shown properly - Stack Overflow
I have tested on my local machine. the browser is chrome. <html> <head> <style type="text/css"> @font-face{ font-family: "Myriad-Pro"; ...
Read more >Cannot compile Myriad Pro with FontPro - TeX
I found out that the problem was the capitalization in the names of the font files. Good: MyriadPro-Bold.otf. Bad: MyriadPro-BOLDIT.OTF.
Read more >Cannot add custom fonts to templates - HubSpot Community
Any help would be appreciated, thank you! @font-face { font-family: 'Myriad Pro Bold Condensed'; src: url('https://20780731.fs1.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@HackbrettXXX I think it is some problem with the variable of that fonts, I try with the same font name, but get the font from other source and it works for me now
If that something can be resolveable then it will good to fix, otherwise we need to learn which type of font supported and document it
This is the same font but work for me - https://github.com/celsodantas/wak/blob/master/app/assets/stylesheets/fonts/MyriadPro-Regular.ttf
@listopadiya Thanks for the investigation. OTF fonts are not supported, but there is an open feature request: #2276. I added a comment about the CFF tables. I think we can close this now.