Skip to main content
Inspiring
March 2, 2021
Answered

Script to set text type to bold italic.

  • March 2, 2021
  • 1 reply
  • 1616 views

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.

 

This topic has been closed for replies.
Correct answer Kukurykus

 

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

 

1 reply

Kukurykus
Legend
March 2, 2021
Arial-BoldItalicMT
Inspiring
March 2, 2021

What about other fonts? For example Courier New?

Kukurykus
KukurykusCorrect answer
Legend
March 2, 2021

 

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