-
Notifications
You must be signed in to change notification settings - Fork 222
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
full unicode display and copy/paste support #257
Comments
There's a feature request: foliojs/pdfkit#201 |
The "Hællœ" pasted as "Hælloe" issue seems to depend on the PDF viewer, so forget about this one here. |
This sounds like a pdfkit problem not a fontkit one |
The fontkit issue was closed, so we're back here...
The 0000 is mapped to <0000> for copy/paste. |
Okay but that's still a pdfkit issue, no? Fontkit has nothing to do with whether or not you can copy text, or how it's presented. It just shapes unicode sequence. If the error is "fontkit isn't rendering |
Actually my comment should have gone to the pdfkit issue, sorry. Fixed that. |
As an attempt to fix foliojs/pdfkit#1251, I came up with the test program below.
It produces PDF output which looks like the second section below.
Selecting all text in the PDF and copy/paste into a text file yields the result in the third section below.
Problems are:
const PDFDocument = require('pdfkit')
const fs = require('fs')
let doc = new PDFDocument
doc.pipe(fs.createWriteStream('pdfkit.pdf'))
doc.registerFont('normal', './NotoSans-Regular.ttf')
doc.registerFont('emojis', './NotoEmoji-Regular.ttf')
// this one does not work:
doc.registerFont('NotoColorEmoji', './NotoColorEmoji_WindowsCompatible.ttf')
doc.font('normal')
doc.text('Hællœ 1€')
doc.text('Greek, Cyrillic: αγΩЭ')
doc.text('CJK: 啕')
doc.text('4 BMP emojis:')
doc.font('emojis')
doc.text('⛔⛱⛲✅')
doc.font('normal')
doc.text('5 non-BMP characters:')
doc.text('𐌸𐐀𑁍𝄞𝔸')
doc.text('3 non-BMP emojis:')
doc.font('emojis')
doc.text('🌛🍅😀')
doc.end()
Hællœ 1€
Greek, Cyrillic: αγΩЭ
CJK: ▯
4 BMP emojis:
⛔▯⛲✅
5 non-BMP characters:
▯▯▯▯▯
3 non-BMP emojis:
🌛🍅😀
Hælloe 1€
Greek, Cyrillic: αγΩЭ
CJK:
4 BMP emojis:
⛔⛲✅
5 non-BMP characters:
3 non-BMP emojis:
🌛🍅😀
The text was updated successfully, but these errors were encountered: