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
Character corruption occurs when enabling subsets for some Japanese and Chinese fonts #162
Comments
I have found that this problem probably occurs with CFF outlines in OTF fonts. We will try if we can fix the problem by modifying the fontkit file below and using the latest fontkit with a forked pdfme/pdf-lib. @azure06
About OTF and CFF OTF (OpenType Font) is a digital font file format developed jointly by Microsoft and Adobe, which combines the advantages of both TrueType fonts (TTF) and PostScript fonts. OTF is capable of storing a large number of characters and glyphs (the shapes of characters) within a single file, and it also provides advanced layout and typography features. This enables consistent display and printing across various languages and styles. CFF (Compact Font Format) is a type of outline format used within OTF fonts, specifically for PostScript-based fonts. CFF is designed to efficiently compress the outline data, which results in smaller font file sizes. This, in turn, improves performance on the web and digital devices. Generally, there are two types of outline formats used in OTF fonts. OTF (CFF) refers to PostScript-based fonts that utilize CFF technology, offering high-quality output. On the other hand, OTF (TrueType) uses TrueType outlines and provides broader compatibility. The main difference between the two lies in the outline format used. However, since both are OTF fonts, there isn't a significant difference in terms of functionality or convenience. Depending on specific use cases or situations, one may be more suitable than the other—either OTF (CFF) or OTF (TrueType). |
Fixed! |
Published @pdfme/pdf-lib
|
Now, I'm trying to use @pdfme/pdf-lib in @pdfme/generator, but I got this error
So, I have to update src/types/fontkit.ts. But I confirmed working correctly at node and browser in pdfme-playground. |
Use @pdfme/pdf-lib instead of pdf-lib
Released in 1.1.10!! |
Are there any plans to contribute this fix upstream so we can avoid using a fork of pdf-lib? |
Describe the bug
When using the NotoSans Japanese OTF font and enabling subsetting, character corruption occurs. (In this example, I'm entering "田中太郎", but it's not rendering correctly)
To Reproduce
Expected behavior
The same text as the input values in inputs should be rendered in the PDF
Your Environment
Your Error Log
Additional context
This issue is more likely a problem with fontkit, which is used by pdf-lib, rather than a problem with pdfme itself.
Reference: Hopding/pdf-lib#207 (comment)
Development of pdf-lib and @pdf-lib/fontkit is currently stalled, but pdfme developers will work on resolving this issue by creating a fork of pdf-lib.
The text was updated successfully, but these errors were encountered: