• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Doubt about font in text layer in Photoshop

Engaged ,
Jan 23, 2020 Jan 23, 2020

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}

 

 

TOPICS
Actions and scripting

Views

846

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
community guidelines

correct answers 1 Correct answer

People's Champ , Jan 23, 2020 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);

 

 

Votes

Translate

Translate
Adobe
Adobe Employee ,
Jan 23, 2020 Jan 23, 2020

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

Votes

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
community guidelines
Engaged ,
Jan 23, 2020 Jan 23, 2020

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

 

Votes

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
community guidelines
People's Champ ,
Jan 23, 2020 Jan 23, 2020

Copy link to clipboard

Copied

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);

 

 

Votes

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
community guidelines
Engaged ,
Jan 23, 2020 Jan 23, 2020

Copy link to clipboard

Copied

LATEST

 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.

Votes

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
community guidelines