问题
I want replace font color and weight and size of certain word in text layer.
For example:
I want <b>THIS</b> look different
and <b>this</b> as well.
My plan was replacing every characters' color between <b> and </b> then "<b>" and "</b>" to be removed.
First of all, I'd like to know that changing colors and size of certain words in a text layer would even be feasible.
Another thing is, even if I somehow manage to change font color in a text layer and then remove <b> and </b>, font colors change back to what it was before. To the color of first character of the layer.
function Replace132Step1(){
var desctxt = app.activeDocument.artLayers.getByName ("Description");
var reg = new RegExp("(<b>.*<\/?b>)");
var boldColor1 = new SolidColor();
boldColor1.rgb.hexValue= 'EE3E2E';
//I got stuck from here. .replace doesn't seem like to work.
}
function Replace132Step2(){
var desctxt = app.activeDocument.artLayers.getByName ("Description");
desctxt.textItem.contents = desctxt.textItem.contents.replace("<b>", "");
desctxt.textItem.contents = desctxt.textItem.contents.replace("</b>", "");
}
来源:https://stackoverflow.com/questions/36934335/extendscriptchange-font-color-size-of-certain-word-in-text-layer