How to replace a font by another on all text layers in Photoshop?


Question

I have a big PSD file with hundreds of text layers all placed in a lot of folders and subfolders.

Some of those layers use font A, the others use font B.

Now I want to replace the font in all layers using font A by font C without altering those using font B. How do I do that ? (obviously without editing each layer by hand, which would take hours)

I guess this could be done with scripting but I have basically zero knowledge about this (I just know how to record and use actions, nothing more advanced) so I have no clue on how to proceed - and am not even sure it is the solution.

Thanks for your help ;)

1
1
6/18/2016 5:44:00 PM

Accepted Answer

Update:

I wrote a script that should do what you want. Save it to a file with a .jsx extension and run the script with your document open. It will prompt you for the name of the font you want to replace, then the font you want to replace with. You will need to enter the PostScript name of the fonts.

var fontToReplace = prompt("Which font would you like to replace?","\(PostScript font name\)","Replace Font");
var replacementFont = prompt("with...","\(PostScript font name\)","Replace Font");

var doc = app.activeDocument;

function replaceFont(target)
{
    var layers = target.layers;
    for (var i = 0; i < layers.length; i++) {

        if (layers[i].typename == "LayerSet") {

            replaceFont(layers[i]);

        } else if (layers[i].kind == LayerKind.TEXT) {

            if (layers[i].textItem.font == fontToReplace) {
                layers[i].textItem.font = replacementFont;
            }
        };
    };
};
replaceFont(doc);

Original Answer:

So this isn't the easiest, fastest or cleanest solution but it's the best I can think of right now!

  1. Disable the font you want to change (i.e. using a font manager)
  2. Using the layers panel, filter by type layers.
  3. All the layers with a missing font (i.e. the font you want to change) will have a little yellow warning triangle—select them.
  4. Use the character panel to change the font.

Filter layers by type

It's not the fastest but it's a bit faster than trawling through all your layers and figuring out what is what. Writing a script to do this would probably be the best way to go.

3
6/18/2016 11:21:00 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
^