FYI, I've just released version 3.6.2 of the JSON Action Manager scripting library.
It adds a new module jamText which provides full support for getting and setting layer text programmatically, using the thoroughly documented Layer Text Object Simplified Format, defined as a JSON object.
Text can be multi-styled, and the following layouts are supported:
Point textParagraph textText along a pathText inside a pathYou may want to have a look at and/or run the provided test script Test Text Layers to see how this can be achieved.
A utility script called Get Layer Text (for Photoshop CS3 or later) is also available separately; it lets you get the layer text of the current text layer as a JSON object (it actually calls the function jamStyles.getLayerText). You can then pass the resulting JSON object (stripped down if necessary) to the function jamText.setLayerText to set a layer text in your own scripts.
Here is one simple multi-style example:
Code: Select allvar text = "Bonjour !";
app.documents.add (UnitValue (512, "px"), UnitValue (256, "px"), 72, text);
var layerText =
{
"layerText":
{
"textKey": text,
"textClickPoint": { "horizontal": 50, "vertical": 67 },
"antiAlias": "antiAliasCrisp",
"textShape":
[
{
"textType": "point",
"orientation": "horizontal"
}
],
"textStyleRange":
[
{
"from": 0,
"to": text.length - 1,
"textStyle":
{
"fontPostScriptName": "Myriad-Italic",
"size": 128,
"color": { "red": 144, "green": 0, "blue": 255 }
}
},
{
"from": text.length - 1,
"to": text.length,
"textStyle":
{
"fontPostScriptName": "Minion-BoldItalic",
"size": 192,
"color": { "red": 255, "green": 0, "blue": 0 }
}
}
],
"paragraphStyleRange":
[
{
"from": 0,
"to": text.length,
"paragraphStyle": { "alignment": "center" }
}
]
},
"typeUnit": "pixelsUnit"
};
jamText.setLayerText (layerText);
More information on installation and directions for use is available in the Layer Text Quick Tutorial.
HTH,
--Mikaeru