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

Script to set text type to bold italic.

Engaged ,
Mar 02, 2021 Mar 02, 2021

Is it possible to set text type to bold italic via script? I have the following code that works:

app.activeDocument.activeLayer.textItem.font = "Arial";

What would I need to add to make it bold italic?

 

Thanks.

 

TOPICS
Actions and scripting
1.5K
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

LEGEND , Mar 02, 2021 Mar 02, 2021

 

for(i = +(fnts = []); i < fonts.length;) {if (/bolditalic/i.test(fnt = fonts[i++].postScriptName)) fnts.push((fnts.length ? '\n' : '') + fnt)}; alert(fnts)

 

Translate
Adobe
LEGEND ,
Mar 02, 2021 Mar 02, 2021
Arial-BoldItalicMT
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 ,
Mar 02, 2021 Mar 02, 2021

What about other fonts? For example Courier New?

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
LEGEND ,
Mar 02, 2021 Mar 02, 2021

 

for(i = +(fnts = []); i < fonts.length;) {if (/bolditalic/i.test(fnt = fonts[i++].postScriptName)) fnts.push((fnts.length ? '\n' : '') + fnt)}; alert(fnts)

 

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 ,
Mar 02, 2021 Mar 02, 2021
LATEST

Set font manualy, then

alert(app.activeDocument.activeLayer.textItem.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