Setting a font on a PSD text item in javascript?
Hi there,
I'm new to photoshop scripting and am having a bit of trouble editing a text layer in Photoshop using javascript.
I have a few PSD templates in which I'd like to replace text on specific layers with javascript before generating hundreds of animated GIFs. I have placeholder text on the target layers and have been able to replace it with:
"textItemRef.contents = "Hello, world";
however this loses ALL text formatting. Is there a different way to replace existing text keeping sizes/colors/fonts in tact? All examples I can find create new layers needing all the attributes. I've tried assigning a paragraph style to the placeholder text using Photoshop cc 2014 stylesheets but that doesn't retain styles when the text is replaced, either.
I also can't find mention of TEXT STYLESHEETS in the scripting guides or photoshop DOM references, presumably because they're so new? If anyone has been able to assign TEXT styles, what is the syntax? Or is there one for clearing overrides if that's possible?
If the only way IS to style everything one attribute at a time, I am having problems with the font attribute. var myFont = app.fonts.getByName("Arial"); does not seem to work.
