You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issue using colon character ":" with fontkit and Noto Sans CJK font #472
Coming over from fontkit (foliojs/fontkit#23), since we determined that the issue most likely lies in pdfkit.
Using the colon character causes many of the characters to not be displayed in the resulting PDF. As soon as the colon is removed, the characters are displayed without an issue.
Below is a snippet that reproduces the issue. I used a local module to reference the fontkit branch of pdfkit.
var PDFDocument = require('../pdfkit');
var fs = require('fs');
var pdfFile = 'test.pdf';
var fontFile = 'NotoSansCJKsc-Regular.otf';
var doc = new PDFDocument({ bufferPages: true });
var pdfStream = fs.createWriteStream(pdfFile);
doc.pipe(pdfStream);
doc.fontSize(12)
.font(fontFile)
.text("This is a test: The quick brown fox jumps over the lazy dog.");
doc.end();
pdfkit doesn't support Open Type Fonts fonts. You need to use TrueType (.ttf), TrueType Collection (.ttc), or Datafork TrueType (.dfont). Try using NotoSansCJK-Regular.ttc
I was trying to use pdfkit with the fontkit branch, which does support OTF. Also, the TTC versions of Noto do not work in pdfkit (master). Even though they have .ttc extension, it's actually OTC.
Activity
jwerre commentedon Jun 10, 2016
pdfkit doesn't support Open Type Fonts fonts. You need to use TrueType (.ttf), TrueType Collection (.ttc), or Datafork TrueType (.dfont). Try using NotoSansCJK-Regular.ttc
mmejia27 commentedon Jul 26, 2016
I was trying to use pdfkit with the fontkit branch, which does support OTF. Also, the TTC versions of Noto do not work in pdfkit (master). Even though they have .ttc extension, it's actually OTC.
mmejia27 commentedon Nov 17, 2016
Wanted to see if anyone had an update on this? Still seems to happen with PDFKit 0.8.0.
blikblum commentedon Oct 5, 2019
This should fix it: foliojs/fontkit#207
liborm85 commentedon Jul 11, 2021
Fixed in fontkit 1.8.1.