I have a PSD file that contains a text layer with Chinese text. When exporting the image using the Aspose.PSD for Java API to save as a jpg picture, the Chinese text displays incorrectly.
the origin psd file looks like : image.jpg (140.4 KB)
the api saved as jpg loos like : image.jpg (148.4 KB)
the version of aspose.psd for java is 25.5 and my code is below:
@churui could you please check if the font that was originally used in PSD file is installed in OS. If the font is not installed, Aspose.PSD tries to find most similar font for the replacement.
@churui I checked the original file. I was not able to find in the Internet the Font STXingkaiSC Light that was used in this file. Please note, STXingkai Regular is another font.
So at this moment, I can not reproduce issue.
Could please check if the Photoshop on the editing of original file asks for the Font Replacement as on the screenshot: STXingkaiSC Light (107.7 KB)
In this case, Aspose.PSD will not be available to find this font too. Also, I discovered that you use Aspose.PSD under the MacOs, could you please check if the solution with setFontsFolder works for you. The one of the possible cases - Aspose.PSD can not find this installed font on MacOS.
If it possible, could you please provide STXingkai Light font file. Aspose.PSD team will not use it for any commercial cases, but will test if it can be rendered correctly.
Also, I’ve found that in your file was used Text on the Arc. It’s only partially supported by Aspose.PSD.
the default fontsFolder in my OS is as above. I check the directory, I really couldn’t find this STXingkaiSC Light font file. But it is normal in PS when I open the psd file in PS. And the same font, the English letters and numbers are display normal when save as JPG, only the chinese is not normal.
Another, can you tell me how to get the avaliable fonts when using aspose.psd.java and how to set the
font that was installed in OS? can you give me some code examples? Thank you!
And can you do a test: prepare a psd file which has a chinese characters TextLayer and font is installed in your OS, then save the psd file as a JPG, then check the chinese characters in the JPG is whether normal or not.
Aspose.PSD can not get list of all available fonts at the moment, but you can select font for the replacement. The best practice is to create separate folder near to your project and copy to this folder fonts, that you want to use. This is the best practice, because not all system fonts can be freely used without additional license, so to avoid replacements by the font without appropriate license, better to use this approach and then use FontSettings | Aspose.PSD for Java API Reference
// fontToReplace will be the name of you current font and then priority list, so can be added STXingkai Regular
setFontReplacements(String fontToReplace, String[] fontNames)
Aspose.PSD uses the same logic for replacements as other Aspose Products, so, it possible the original replace is very different from “STXingkaiSC Light”