Aspose.psd saving issue

[KaiTi] I installed it on my computer, but the font was lost after replacing aspose

@vincent2024 I can not reproduce this issue in Aspose.PSD 24.4 with installed KaiTi font. Could you please clarify the following parameters of you Aspose.PSD config:

  1. Operating System (including architecture like 32 bit, x64 or ARM)
  2. Version of Aspose.PSD (23.10, 23.4, etc)
  3. Framework version of Aspose.PSD. There are .NET 2.0, .NET 3.5, .NET 4.0. NetStandard, .NET 5, .NET 6, and . NET 7. Different Aspose.PSD builds uses different Drawing Libraries.

Could you please additionaly specify expected result. My result of the provided code with installed KaiTi font is attached below:
output.zip (11.5 KB)

The operating system I am using is Windows 10 22H2 X64 version
Aspose PSD version 22.9.0.0 Replacing PSB file font in PSD with NET 4.0 is invalid. If this font is already installed on the computer and PSB is opened separately, it is normal. Replacing it will be invalid

@vincent2024 please try Aspose.PSD 24.4. The issue with font replacing in Smart Object was fixed only in 24.2.

I’m sorry, I don’t have a 24.2 license. Can I apply for this version of the trial as an individual? If so, what certifications are needed to apply for it

@vincent2024 I recommend firstly check if the result of 24.2 is suitable for your tasks. You can obtain temporary license on Temporary License - Purchase - aspose.com
Also, Aspose offers discount for the renewing of license. I can mention sales team in this post.
Version 22.9 is one of the first versions where the SmartObject support was added.

For the 22.9 You can try additionally to set the new size of smart object as in code below but it doesn’t fix the issue with missed font. To avoid font lost you can try replace SmartObject with the Regular Layer.

using (PsdImage image = (PsdImage)PsdImage.Load(sourceFile, warpLoadOptions)) 
{
   foreach (var layer in image.Layers)
   {
     if (string.Equals(layer.DisplayName, "test", StringComparison.InvariantCultureIgnoreCase))
     {
        if (layer is SmartObjectLayer smartObjectLayer)
        {
            Console.WriteLine("替换 -- >  " + layer.DisplayName);
            using (PsdImage replacement = (PsdImage)PsdImage.Load(replaceFile, warpLoadOptions))
            {
                smartObjectLayer.Right = smartObjectLayer.Left + replacement.Width;
                smartObjectLayer.Bottom = smartObjectLayer.Top + replacement.Height;
                smartObjectLayer.ReplaceContents(replacement);
                
                smartObjectLayer.UpdateModifiedContent();
            }
        }
    }
}

image.Save(outputFile);

}

I used code to set the font and modify the text content in the PSB. The saved PSB content is normal, but the font part in Photoshop shows that the font was not found, and in the font display part, it is garbled. I used Aspose. psd 23.7.0.0, and the following part is the execution code

textData.Items[0].Text = “hello”;

textData.Items[0].Style.FontName = “创艺简行楷”;

textData.UpdateLayerData();

Image Save (outputFile);
999990000.jpg (40.5 KB)

@vincent2024 could you please provide whole code snippet and input data to reproduce this. We need to test this on the current version

       string sourceFile = @"test.psb";
        string outputFile = @"output.psb";
    public bool UpdatePsd(string sourceFile, string outputFile) 
    {
        PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
        psdLoadOptions.LoadEffectsResource = true;
        var warpLoadOptions = new PsdLoadOptions() { LoadEffectsResource = true, ReadOnlyMode = false, UseDiskForLoadEffectsResource = true };
        using (PsdImage image = (PsdImage)PsdImage.Load(sourceFile, warpLoadOptions)) 
        {
            var length = image.Layers.Length;
            for (int i = 0; i < length; i++)
            {
                var layername = image.Layers[i].DisplayName;

                if (layername == "test1")
                {
                    var textLayer = image.Layers[i] as TextLayer;
                    var textData = textLayer.TextData;
                    textData.Items[0].Text = "hello";
                    textData.Items[0].Style.FontName = "创艺简行楷"; 
                    textData.UpdateLayerData();
                }                  
            }
            image.Save(outputFile);
        }

    }               

demo2.7z (2.5 MB)

My implementation code attachment is the tested PSB and font

@vincent2024 thank you. I’ll check and then text you back.

Okay, thank you for your hard work

@vincent2024 after the investigation, Aspose.PSD Team found the issue. Team will try deliver this fix in 24.5

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-2033

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.

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