layer.UpdateText error psdImage.Save error

.net6 aspose.psd: 23.11

string inputFile = @"1.psd";
using (var psdImage = (PsdImage)Image.Load(inputFile ))
{
    psdImage.Save( "1.png" , new PngOptions() //error
    {
        ColorType = PngColorType.TruecolorWithAlpha,
        CompressionLevel = 9,
    });
}
throw exception:ImageSaveException: Image export failed.

1.zip (2.9 MB) I upload the psd

also when you call

 var layer = psdImage.Layers[3] as TextLayer;
 layer.UpdateText("xxxx");  // throw  NPE  System.NullReferenceException:“Object reference not set to an instance of an object.”

in my test , 2023.8 can UpdateText and save as PNG , but png will lost font ,start 2023.9 will get above error

@lsl could you please check if this bug appears after the following fix:

FontSettings.RemoveFontCacheFile();

FontSettings.RemoveFontCacheFile();

tring inputFile = @"1.psd";
using (var psdImage = (PsdImage)Image.Load(inputFile ))
{
    psdImage.Save( "1.png" , new PngOptions() //error
    {
        ColorType = PngColorType.TruecolorWithAlpha,
        CompressionLevel = 9,
    });
}

add FontSettings.RemoveFontCacheFile(); still get exception

Could please clarify which version of .NET is used. I can not reproduce this exception. According to our investigation this exception appears only if cache is broken, so FontSettings.RemoveFontCacheFile() should fix the issue.

// throw  NPE  System.NullReferenceException:“Object reference not set to an instance of an object.”

2023.8 no FontSettings.RemoveFontCacheFile() method
my test code env is .net6 win11x64 23h2 aspose.psd: 23.11 chinese culture

@lsl there is manual way to fix it.

Please try to remove these files:
“C:\ProgramData\AsposeImagingFontsInfoJson.cache”
“C:\ProgramData\AsposeImagingFontsInfo.cache”
“C:\Users<yourusername>\AppData\Local\AsposeImagingFontsInfoJson.cache”
“C:\Users<yourusername>\AppData\Local\AsposeImagingFontsInfo.cache”

Versions up to 23.11 can corrupt font cache file.

I clean all the cache file , exception as below

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Aspose.PSD.FontParsing.OpenType.Serialization.OpenTypeFontInfo..ctor )
   at .(String[] )
   at .(Boolean )
   at .(String )
   at .(String )
   at .(String )
   at .(String , Boolean )
   at ⸮.(ITextStyle )
   at ⸮.(ITextPortion )
   at ⸮.(ITextPortion[] )
   at ⸮.(ITextPortion[] , SizeF )
   at ⸮.()
   at ⸮.(Boolean )
   at .UpdateLayerData()
   at ⸮.(String , Point , Single , Color)
   at .(Object )
   at .(Object )
   at .(MethodBase , Boolean )
   at ( ,  )
   at ()
   at .(Boolean )
   at .(Object )
   at .(Object )
   at .()
   at .(Object , UInt32 )
   at .(Boolean )
   at .(Object[] , Type[] , Type[] , Object[])
   at .(Stream , String , Object[] , Type[], Type[] , Object[] )
   at .(Stream , String , Object[] )
   at .(Stream , String , Object[] )
   at ⸮.UpdateText(String , Point , Single , Color)
   at Aspose.PSD.FileFormats.Psd.Layers.TextLayer.UpdateText(String text)

The font is installed normally on my computer, and Photoshop can edit it normally

image.png (5.4 KB)

at my test, it broken at
this.Style = OpenTypeFontInfo.\u0002(u0006_u0005_u0003_u2.\u0002()); in class Aspose.PSD.FontParsing.OpenType.Serialization
This is our own font that can recognize edited content normally in Photoshop,Do you need me to send you the font?

@lsl yes, please. Could you plese send to me font for the investigation

@lsl
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PSDNET-1855

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

font.zip (2.7 MB)

this is the font ,3q

@lsl I’ve added the font to the task. This task is planned for the next releases. If there will be any additional news, I’ll write you here.

The issues you have found earlier (filed as PSDNET-1855) have been fixed in this update. This message was posted using Bugs notification tool by yaroslav.lisovskyi