Change font for particular text via script in Phot

2019-07-28 22:44发布

Looking for a script or action for changing font face for a particular word or text in a paragraph.

I have multiple .psd files (80+) where I need to change font for a specific text say "Hello" from Arial to Tahoma and also make it bold.

Really appreciate a help!

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-07-28 22:52

You could try "jam" framework. There is class for manipulating with text. http://www.tonton-pixel.com/JSON%20Action%20Manager/jsDoc/symbols/jamText.html You are looking for textStyleRange.

var text = "Bonjour !";
var layerText =
{
    "layerText":
    {
        "textKey": text,
        "textClickPoint": { "horizontal": 50, "vertical": 95 },
        "antiAlias": "antiAliasCrisp",
        "textShape":
        [
            { "textType": "point", "orientation": "horizontal" }
        ],
        "textStyleRange":
        [
            {
                "from": 0,
                "to": text.length,
                "textStyle":
                {
                    "fontPostScriptName": "Myriad-Italic",
                    "size": 288,
                    "color": { "red": 144, "green": 0, "blue": 255 }
                }
            }
        ],
        "paragraphStyleRange":
        [
            {
                "from": 0,
                "to": text.length,
                "paragraphStyle": { "alignment": "center" }
            }
        ]
    },
    "typeUnit": "pixelsUnit"
};
jamText.setLayerText (layerText);

You need: - create loop which checks all layers - read one text layer - find on which character index substring starts, where is end - apply jamText.setLayerText - read next layer

It goes also without framework. The structure is analogous. The code will be uglier.

查看更多
登录 后发表回答