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

How can I get the currently selected font in Photoshop?

Engaged ,
Jun 09, 2019 Jun 09, 2019

I would like to let the user choose a font in Photoshop then run a script and get the currently selected font to use with a text layer. How can I get the currently selected font from Photoshop? Thanks.

TOPICS
Actions and scripting
1.2K
Translate
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 , Jun 09, 2019 Jun 09, 2019

var r = new ActionReference();

r.putClass(stringIDToTypeID("typeCreateOrEditTool"));

var d = new ActionDescriptor();

d.putReference(stringIDToTypeID("null"), r);

executeAction(stringIDToTypeID("select"), d, DialogModes.NO);

var r = new ActionReference();

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));

r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var font = executeActionGet(r).getObjectValue(stringIDToTypeID("current

...
Translate
Adobe
People's Champ ,
Jun 09, 2019 Jun 09, 2019

var r = new ActionReference();

r.putClass(stringIDToTypeID("typeCreateOrEditTool"));

var d = new ActionDescriptor();

d.putReference(stringIDToTypeID("null"), r);

executeAction(stringIDToTypeID("select"), d, DialogModes.NO);

var r = new ActionReference();

r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));

r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

var font = executeActionGet(r).getObjectValue(stringIDToTypeID("currentToolOptions")).getObjectValue(stringIDToTypeID("textToolCharacterOptions")).getObjectValue(stringIDToTypeID("textStyle")).getString(stringIDToTypeID("fontName")); 

alert(font);

Translate
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 ,
Jun 10, 2019 Jun 10, 2019

Thanks. Two more questions.

1) How can I get the PostScript font name, which I need to set the font in a script.

2) Where can I find information on the properties of the typeCreateOrEditTool object and other PS tools.

Thanks again.

Translate
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 ,
Jun 10, 2019 Jun 10, 2019

1. Instead of stringIDToTypeID ("fontName") use stringIDToTypeID("fontPostScriptName");

2. I do not know. This is my personal research.

Translate
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 ,
Jun 10, 2019 Jun 10, 2019
LATEST

Thanks very much. You have saved me a lot of time.

Translate
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