We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Change Font and Color for TextLayer PSD

The issues you have found earlier (filed as PSDNET-806) have been fixed in this update.

Hi @mudassir.fayyaz and @aspose.notifier,

 ITextPortion firstPortion = textLayer.TextData.Items[0];
                firstPortion.Style.FontName = FontSettings.GetAdobeFontName("Lobster");

FontSettings.GetAdobeFontName(“Lobster”) is always return null although I have install this font to “C:\Windows\Fonts”.

Lobster (1).zip (143.4 KB)

Please help me to check.

Thanks,
Duy

@nlduy157

For sake of your reference, you can please try using following complete example.

            string outputFilePng = "result_fontEditTest.png";
            string outputFilePsd = "fontEditTest.psd";

            void AssertAreEqual(object expected, object actual)
            {
                if (!object.Equals(expected, actual))
                {
                    throw new Exception("Objects are not equal.");
                }
            }

            using (var image = new PsdImage(500, 500))
            {
                FillLayer backgroundFillLayer = FillLayer.CreateInstance(FillType.Color);
                ((IColorFillSettings)backgroundFillLayer.FillSettings).Color = Color.White;
                image.AddLayer(backgroundFillLayer);

                TextLayer textLayer = image.AddTextLayer("Text 1", new Rectangle(10, 35, image.Width, 35));

                ITextPortion firstPortion = textLayer.TextData.Items[0];
                firstPortion.Style.FontName = FontSettings.GetAdobeFontName("Comic Sans MS");

                var secondPortion = textLayer.TextData.ProducePortion();
                secondPortion.Text = "Text 2";
                secondPortion.Paragraph.Apply(firstPortion.Paragraph);
                secondPortion.Style.Apply(firstPortion.Style);
                secondPortion.Style.FontName = FontSettings.GetAdobeFontName("Arial");

                textLayer.TextData.AddPortion(secondPortion);
                textLayer.TextData.UpdateLayerData();

                image.Save(outputFilePng, new PngOptions());
                image.Save(outputFilePsd);
            }

            using (var image = (PsdImage)Image.Load(outputFilePsd))
            {
                TextLayer textLayer = (TextLayer)image.Layers[2];

                string adobeFontName1 = FontSettings.GetAdobeFontName("Comic Sans MS");
                string adobeFontName2 = FontSettings.GetAdobeFontName("Arial");

                AssertAreEqual(adobeFontName1, textLayer.TextData.Items[0].Style.FontName);
                AssertAreEqual(adobeFontName2, textLayer.TextData.Items[1].Style.FontName);
            }

Can you please share the source font and used working example so that we may try to verify the same on our end.

Hi @mudassir.fayyaz
When I update text layer to new Font , I have problem with some fonts.
Font Errors : Mrs Saint Delafield, Mr De Haviland, Allura, Great Vibes, Kaushan Script , Parisienne, Patua One, Playball, Yellowtail, Lobster, Vidaloka.
I have downloaded fonts and installed it to my local
Font.7z (387.4 KB)

  • I also attached 11 images for 11 fonts:
    example Allura.jpg (191.0 KB)
  • Problems : Fonts after rendering by aspose have the isse with charactor : L , ‘,’ or not space between character in text. Please see image as attached above :
    Font error.7z (1.7 MB)
  • This is my code that I implement to change font ( update lasted version )
    ChangeFontTextLayer.7z (7.3 MB)

Please help me to take a look as a high priority.

Thanks,
Duy

@nlduy157

This issue require further investigation and a ticket with ID PSDNET-948 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be addressed.

Hi @mudassir.fayyaz,

Can you share with me ETA for issue PSDNET-948 ?

Thanks,
Duy

@nlduy157

This issue has just been created and is pending for investigation in issues queue. We will share the good news with you as soon as the issue will be addressed.

Hi @mudassir.fayyaz,
Great, I hope can get your good news soon !

Thanks,
Duy

@nlduy157

We will keep you posted for updates as soon as they will be shared.

Hi @mudassir.fayyaz,

Can I get any update ?

Thanks,
Duy

@nlduy157

I regret to share that at present the issue is still unresolved. We request for your patience and will share the good news with you as soon as it will be fixed.