文本图层导出时中文格式不对

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:

PsdImage newPsdImage = (PsdImage) Image.load(inPsdFilePath);
JpegOptions saveOptions = new JpegOptions();
saveOptions.setQuality(100);
newPsdImage.save(outJpgFilePath, saveOptions);

@Dmitriy.Sorokin hello,can you help me fix this problem?

@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.

If the font is not installed and you can not install it, please check method FontSettings | Aspose.PSD for Java API Reference

Create custom font folder, add to this folder font that originally used in PSD and set setFontsFolder to this folder.

Could you please provide original PSD file for the investigation.

I am sure the font that was originally used in PSD file is installed in OS.

how can I send you the original PSD file? Here dose not support send psd file.

正在上传:01文件.psd.zip…
this is the original psd file

@churui could you please add url for downloading, I’ve check the current URL, it’s empty.

10文件.psd.zip (3.5 MB)

the original psd file is above. this psd file save as png also has the same problem.

@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.

image.png (6.1 KB)

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.

@churui please check this API Reference FontSettings | Aspose.PSD for Java API Reference

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”

@churui

I added to this topic the improvement about Font List.

Issue ID(s): PSDNET-859