pdfium-lib icon indicating copy to clipboard operation
pdfium-lib copied to clipboard

Loading Fonts from Network for Correct Text Rendering in PDFium

Open Dingzhaocheng opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. We're encountering difficulties rendering Chinese text using wasm due to potential missing fonts. It's crucial to address this issue to ensure accurate text rendering.

Describe the solution you'd like We need a method to load fonts fetched from the network into PDFium. This would enable PDFium to render text correctly, resolving the font-related rendering issues.

Additional context The ability to dynamically load fonts from network sources would significantly enhance PDF rendering capabilities, especially for languages with complex character sets like Chinese.

Dingzhaocheng avatar Apr 18 '24 10:04 Dingzhaocheng

Hi. This is a know problem for these fonts.

Do you know what need do? I can create a patch, but i need understand what really we need.

paulocoutinhox avatar Apr 20 '24 22:04 paulocoutinhox

Thank you very much for your reply. I haven't had a chance to look at the code implementation of PDFium yet. However, my design idea is to support configuring font source URLs. When parsing the document, retrieve the fonts involved in the document and make requests to obtain the corresponding fonts from the font source. If not found, the system will automatically fallback to a basic font to ensure the document displays correctly.

Dingzhaocheng avatar Apr 25 '24 03:04 Dingzhaocheng

Hi @Dingzhaocheng, it works for you: https://github.com/paulocoutinhox/pdfium-lib/issues/114

?

paulocoutinhox avatar Jun 30 '24 07:06 paulocoutinhox

Awesome, looks like what I expected, I'll try it

Dingzhaocheng avatar Jul 01 '24 07:07 Dingzhaocheng

Hi,

Project was updated to latest version.

If your problem was solved, can you close the issue pls?

Thanks.

paulocoutinhox avatar Aug 15 '24 18:08 paulocoutinhox