I wanted to change the font from Arial to Calibri of my text in textlayer. can we do that?
Please try using following sample on your end to change the font family for the text in layer.
//Creates an instance of Image com.aspose.psd.Image image = new com.aspose.psd.fileformats.psd.PsdImage(500, 500); //Creates and initialize an instance of Graphics class com.aspose.psd.Graphics graphics = new com.aspose.psd.Graphics(image); //Clears Graphics surface graphics.clear(com.aspose.psd.Color.getWheat()); //Creates an instance of Font com.aspose.psd.Font font = new com.aspose.psd.Font("Times New Roman", 16); //Create an instance of SolidBrush having Red Color com.aspose.psd.brushes.SolidBrush brush = new com.aspose.psd.brushes.SolidBrush(com.aspose.psd.Color.getRed()); //Draw a String graphics.drawString("Created by Aspose.PSD for .Net", font, brush, new PointF(100, 100)); // create export options. com.aspose.psd.imageoptions.GifOptions options = new com.aspose.psd.imageoptions.GifOptions(); // save all changes image.save("C:\\temp\\output.gif", options);
I don’t want to draw string as i am updating text of TextLayer .
Have tried draw string also but it’s not working.
Layer textLayer = findLayer(“AHORRA HOY”,psdImage);
TextLayer txtlyr = (TextLayer) textLayer;
Here findLayer will just return a layer with the name “AHORRA HOY”.
In the above code, I just want to change the font of this “Some text”.
I am able to change font size and color but unable to change Font.
We regret to share that at present we don’t provide API to change Font for layer at this moment. We have already added a ticket for this with ID PSDNET-806 in our issue tracking system for providing requested support. This thread has been linked with the issue so that you may be notified once the support will be included.
Is there any update on this ticket?
At present the requested feature is unavailable in API and I request for your patience. We will share the good news with you as soon as the feature will be available.