-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fallback font support #201
Comments
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 |
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):
If not, how exactly can we make this work with the |
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) |
I found a workaround! Follow these instructions With these steps you can merge multiple fonts so there is no need for a fallback font. |
This has been an issue for the past 9 years, and it makes developing language-inclusive software with PDFKit really difficult. For a lot of situations, the solutions and workarounds in this thread really don't help, they only help if you know exactly what fonts your users will need/want and what text they're going to be writing. I'm going to be too busy over the next few months to look into it, but could someone more familiar with pdfkit suggest what a a correct way of doing this would be? Just so we have an idea of how complex it would be, and so that potential contributors know where to start looking. A basic implementation could even ignore system font fallback, and only look for fallback glyphs amongst user-supplied and specified fonts. |
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 prawnpdf/prawn#103)
The text was updated successfully, but these errors were encountered: