Free Support Forum -

How to set font ( Font name ) of a text layer of a Psd File

I use this code to add a text layer to PSD file in C#:

            var tLayer=image.AddTextLayer("AAA", new Rectangle(50, 50, 400, 400));
            tLayer.UpdateText("BBB", 120, Color.Green);

 but I don't know how to determine the font of text layer.

 I really appreciate your quick answer.



I suggest you to please try using following example for your kind reference.

//Creates an instance of Image
using (Aspose.PSD.Image image = new Aspose.PSD.FileFormats.Psd.PsdImage(500, 500))
    //Creates and initialize an instance of Graphics class
    Aspose.PSD.Graphics graphics = new Aspose.PSD.Graphics(image);

    //Clears Graphics surface

    //Creates an instance of Font
    Aspose.PSD.Font font = new Aspose.PSD.Font("Times New Roman", 16);

    //Create an instance of SolidBrush having Red Color
    Aspose.PSD.Brushes.SolidBrush brush = new Aspose.PSD.Brushes.SolidBrush(Color.Red);

    //Draw a String
    graphics.DrawString("Created by Aspose.PSD for .Net", font, brush, new PointF(100, 100));

    // create export options.
    Aspose.PSD.ImageOptions.GifOptions options = new Aspose.PSD.ImageOptions.GifOptions();

    // save all changes
    image.Save("C:\\temp\\output.gif", options);