Free Support Forum - aspose.com

How to set the font

Hello,

When I save PSD to png file, the console output print these lines.
Font cache was not available for : STSongti-SC-Black
Font cache was not available for : STSongti-SC-Black
Font cache was not available for : STSongti-SC-Black
Font cache was not available for : STSongti-SC-Black
Font cache was not available for : STSongti-SC-Black
Font cache was not available for : ArialMT
PSD text was supposedly updated from 屜ㅐ쾏�㟿Ā� to 就像这样!
Font cache was not available for : MicrosoftYaHei
Font cache was not available for : MicrosoftYaHei

and the out png file is not correct, the text is displayed very strange.
the flowing is my code, it is very simple.

   String dataDir = Utils.getDataDir(SavingToDisk.class) + "Conversion/";
   String sourceFile = dataDir + "6.psd";
   String destName = dataDir + "result.png";

    // load PSD image and replace the non found fonts.
    Image image = Image.load(sourceFile);
    
    PsdImage psdImage = (PsdImage)image;
    psdImage.save(destName, new PngOptions());

result.png (18.7 KB)

@ideologist0

Can you please make sure if the fonts used in your source PSD are actually available on machine where you are performing conversion. The issue you are observing is owing to missing fonts.

你在对文本图层做更新的时候 可以修改字体么?
或者说 你可以更改文本图层的字体吗?

Yes, the PSD file is edited on my computer and the program is running on my computer.

不可以的,目前没有找到办法

你有遇到过 文本图层修改后消失 需要双击图层 或者排个横板才能出现这种吗

遇到过的,经常出现这个问题

心态崩了,太难受了。
这个产品的文本图层,font属性是只读的,而且updateText没有对应的重载方法,巨难受。
我在想是不是因为他们的产品有aspose.font 所以封装为只读= = 如果我们修改字体 就需要我们连携这样子

感觉应该不是,应该还是接口没有实现呢,我看ITextStyle里面的方法也不太够用

超级难受啊,如果这个实现不了,可能要想其他的方案了。

同样 太难受了
= = 如果技术支持无法给出方案 已经在准备其他方案了

@ideologist0

I have seen similar question from your in another thread as well and have responded for your convenience there.