Please give a brief summary of your issue:
When trying to use a custom TTF in order to allow accent marks and other special characters, it appears to be mojibaking only on Linux (see the assets).
Please describe your issue and provide steps to reproduce it:
0. Include the custom font
Hello, I’m AiRon, an automated tech support bot While you wait for one of our customer support representatives, I can help you with your question.
It seems you’re experiencing unicode mojibaking issues on Linux when using a custom TrueType Font (TTF) with PDFTron.NET. This problem often arises due to encoding mismatches or font embedding issues. Here’s how you can address this issue:
Some things you can try:
Ensure the TTF font file is correctly read and embedded in your application. Check if the font supports the necessary Unicode characters.
Verify that the correct character encoding is used throughout the process (UTF-8 is often preferred for Unicode support).
Test the rendering on different Linux distributions to see if the issue is specific to one environment.
Consider using PDFNet’s built-in font handling capabilities, which might better manage encoding and rendering.
Check if the font path is correctly resolved in your Linux environment, as path issues can sometimes lead to incorrect font usage.
You reported that this only occurs on Linux and the same source run on Windows generates an output file with correct text? This suggests a font substitution issue and I will need to see your source and output files.
You are using CreateTextRun for Unicode values. Can you please try using CreateUnicodeTextRun instead? Here is some additional information on CreateUnicodeTextRun.
If CreateUnicodeTextRun does not resolve your issue please attach the following here for me to investigate:
Input file(s)
Generated output file(s)
Code and settings used to generate (2) from (1)
Screenshots showing the output, and clearly indicating what you expected to get instead, and also clearly indicating the
*Please include any necessary font files.
Switched to CreateUnicodeTextRun and it now works! I did also have to change the custom font I was using with another.
Edit: sorry I guess I have no idea how I replied to the wrong message twice
That is good to hear, is using a different font a good solution for you? If not, is it possible the font file is not valid or does not have a correct Unicode mapping?