Copy link to clipboard
Copied
Why can't I add the font I want to the text layer with this script? It always returns with the font called "Myriad Pro" Is there any rule about this? What if I need to add a custom font?
How to add any font?
function func(){
var ActiveDoc = app.activeDocument
var myLayerRef = ActiveDoc.artLayers.add();
myLayerRef.kind = LayerKind.TEXT;
myLayerRef.name = "Layer Name here";
var myTextRef = myLayerRef.textItem;
myTextRef.contents = "Layer Contents here";
myTextRef.font = "Amaze"; ///++++++ Font
}
func()
{Thread renamed by moderator}
alert(app.activeDocument.activeLayer.textItem.font);
Copy link to clipboard
Copied
Hi Smith,
As you're trying to add custom font to the script, could you please let us know if the font you're trying to add is preset ont he computer or not?
Also, what operating system and Photoshop version are you working with?
Regards,
Sahil
Copy link to clipboard
Copied
Hello Sahil.Chawla Operating system I use is Windows 10 Version 1903 64 bit and Photoshop version is 20.1
I have already tested some predefined fonts from the "Arial" type computer as well as other fonts that I install manually or those fonts that I add directly to Adobe's font directory, C: \ Program Files \ Common Files \ Adobe \ Fonts, but its success.
The answer from r-bin has already solved my problem. Grateful for your attention
Copy link to clipboard
Copied
alert(app.activeDocument.activeLayer.textItem.font);
Copy link to clipboard
Copied
r-bin that Cool! This script of yours revealed the magic.
Now it becomes possible, everything just got easier.
Thank you for sharing this wonderful script.