When a glyph does not exist in the primary font, it should look in a list of other candidate fonts to find it (like in prawn, see https://github.com/prawnpdf/prawn/issues/103)
Need a provision in pdfkit to set a substitution font like (arial unicode) so that glyphs get substituted when it is not present in primary font .This is an important requirement to avoid text disappearing in final pdf for lack of glyph.
+1
I'm working on it. The new font system that I'm developing will use my new font-manager module to get font fallback information from the OS automatically.
how about fallback support in browser ? seems font-manager will just works on Node, am I right ?
Yes, font-manager is for Node. For the browser, we'll have to include a set of fallback font data. The problem is that the data will make PDFKit HUGE. Not sure what the best thing to do is.
Can we have a mechanism that, user can customize pdfkit to use fallback fonts (and user can select font files), but by default, don't use it ?
+1
Some notes.
Hey, is there any update on this feature? I need it.
Doesn't PDF allow to have text without any embedded fonts and then it's up to the rendering program or OS to select a default font?
It would be great if that was an option. Then instead of saying document.font('Helvetica') you could leave the default and for Chinese, Korean, Japanese, Greek, Russian, etc. you'd still get readable PDFs.
Has anyone managed to figure out a good strategy to allow fallback fonts?
Been having some trouble rendering such sentences which consists of a combination of various languages (Vietnamese, and Chinese):
.fontSize(12)
.font('Semibold')
.text('Hanoi Hotel, Trần Huy Liệu, Giang Vo,巴亭郡河内越南', 166, 468, {
width: 370,
})
If not, how exactly can we make this work with the font-manager package?
Ok, just an update, I decide to use [arial unicode] for the pdf generation instead of the project's main font (which uses PingFang SC). It wasn't ideal, but arial unicode was a good compromise as it supports a variety of languages which is perfect for internationalisation. (https://catalog.monotype.com/family/monotype/arial-unicode)
Most helpful comment
Doesn't PDF allow to have text without any embedded fonts and then it's up to the rendering program or OS to select a default font?
It would be great if that was an option. Then instead of saying
document.font('Helvetica')you could leave the default and for Chinese, Korean, Japanese, Greek, Russian, etc. you'd still get readable PDFs.