Highlighted

Doubt about font in text layer in Photoshop

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}

 

 

Adobe Community Professional
Correct Answer by r-bin | Adobe Community Professional
You must specify the PostScript Name of the font.
For verification, you can set this font for the layer manually and see what name it is by running this script.
 

 

alert(app.activeDocument.activeLayer.textItem.font);

 

 

Topics

Actions and scripting

Views

79

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn More

Doubt about font in text layer in Photoshop

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}

 

 

Adobe Community Professional
Correct Answer by r-bin | Adobe Community Professional
You must specify the PostScript Name of the font.
For verification, you can set this font for the layer manually and see what name it is by running this script.
 

 

alert(app.activeDocument.activeLayer.textItem.font);

 

 

Topics

Actions and scripting

Views

80

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn More

Re: Doubt about font in text layer

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn More
Reply
Loading...

Hello Sahil.Chawla Operating system I use is Windows 10 V...

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

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn More
Reply
Loading...

Re: Doubt about font in text layer in Photoshop

Adobe Community Professional , Jan 23, 2020
You must specify the PostScript Name of the font.
For verification, you can set this font for the layer manually and see what name it is by running this script.
 

 

alert(app.activeDocument.activeLayer.textItem.font);

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn More
Reply
Loading...

Re: Doubt about font in text layer in Photoshop

 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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn More
Reply
Loading...