Skip to content
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

Rendering Multi lingual Text #1197

Open
sriharsha9598 opened this issue Aug 7, 2024 · 1 comment
Open

Rendering Multi lingual Text #1197

sriharsha9598 opened this issue Aug 7, 2024 · 1 comment
Labels

Comments

@sriharsha9598
Copy link

sriharsha9598 commented Aug 7, 2024

In various applications such as web browsers, IDEs, and others, when we copy text from any language and paste it, the text is rendered correctly without needing to change the font family. This functionality works seamlessly regardless of the language of the text. But, it is not working as such in PDFs. Could someone explain how this mechanism works and how we can achieve similar behavior in OpenPDF? Specifically, I need to render text that contains words and letters from various languages(unknown to me as well) accurately into a PDF.

I have attempted to use FontSelector by adding the font family of each language and processing the text. Unfortunately, many fonts process characters from other languages incorrectly, rendering them as "????" or breaking the glyphs and producing incorrect output. For example, if my font processor includes English, Hindi, and Telugu languages fonts, and the given string contains Telugu text, the Hindi font might process it first, resulting in incorrect rendering or placeholder characters.

I am seeking detailed knowledge about how fonts, internationalization, and UTF, encodings work in this context. So, I would appreciate any guidance or resources that can help address these issues.

Thank you in advance for your assistance.

@StevenStreasick
Copy link
Contributor

StevenStreasick commented Aug 7, 2024

A very similar post can be found here: #1196

In this post, the end solution was to either use a fontSelector or a universal font. If the fontSelector is not working for your case, as you described in your post, I would recommend Lonzak's solution of using a universal font.

Another solution would be to replace those fonts that are producing unintended results

However, if you were to go into more detail about what font/encoding/character is causing this issue, I would be more than happy to look further into this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants