Change font for particular text via script in Photoshop

二次信任 提交于 2019-12-24 17:07:05

问题


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:


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.



来源:https://stackoverflow.com/questions/37700236/change-font-for-particular-text-via-script-in-photoshop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!