cytoscape / cytoscape.js-pdf-export

PDF export extension for Cytoscape.js
MIT License
0 stars 0 forks source link

support for Chinese characters #1

Open liuhui-666666 opened 4 weeks ago

liuhui-666666 commented 4 weeks ago

"How can the garbled code issue in the PDF export of Chinese labels within nodes be resolved?"

mikekucera commented 4 weeks ago

Can you provide an example or reusable test case? JSBin is a good option for this.

The pdf-export extension relies on PDFKit to render text, and PDFKit only provides a handful of fonts. I just want to set expectations that this might not be resolvable, but I can look into it.

liuhui-666666 commented 3 weeks ago

"This is rendered using Cytoscape.js, where I have drawn graphs with node labels in both Chinese and English. The first graph can be normally exported as a cy .png file, but when converted to PDF, as shown in the second image, the Chinese characters are garbled."

1

2

mikekucera commented 3 weeks ago

Thanks for providing the issue report. Currently cytoscape-pdf-export only provides a small number of fonts that come with PDFKit (see the README file for details). I assume these fonts don't support Chinese characters. I believe someone will need to implement a feature where users can provide their own fonts. Since the fonts are embedded as part of the build process that could be a bit involved. I can implement such a feature but I won't be able to start for some time. PRs are of course welcome.