Mobile app version of vmapp.org
Login or Join
Eichhorn212

: How to replace a font by another on all text layers in Photoshop? I have a big PSD file with hundreds of text layers all placed in a lot of folders and subfolders. Some of those layers

@Eichhorn212

Posted in: #AdobePhotoshop #PhotoshopScripting

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 ;)

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Eichhorn212

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi706

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!


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




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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme