parallax / jsPDF

Client-side JavaScript PDF generation for everyone.

Home Page:https://parall.ax/products/jspdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TrueType font with format 12 CMAP is not shown.

HosokawaR opened this issue · comments

Thank you for a nice library.

jsPDF can not show TrueType font with format 12 CMAP.

I want jsPDF to support format 12 CMAP of TrueType font because I want to show char beyond Unicode 0xffff.
Now, jsPDF supports only format 4 and 12 CMAP, so chars beyond Unicode 0xffff are not shown.

For example, "𠮷" is 0x20BB7, so it's Unicode beyond 0xffff.
Some Japanese people's names contain the above chats, and I want to display them correctly.

I will create PR.
Created. #3738

Reproduction

See → HosokawaR#2

doc.text("吉𠮷", 20, 30);
doc.addFont(
        "./test/reference/fonts/NotoSansJP/NotoSansJP-Regular.ttf",
        "NotoSansJP-Regular",
        "normal"
)
doc.setFont("NotoSansJP-Regular"); // set font
doc.setFontSize(40);
doc.text("吉𠮷", 20, 30);
doc.save("format-12.pdf")

"吉" is shown but "𠮷" is not shown.

image

This issue may be related #3152