Highlighted

I`m trying to change font by scripting, but not all font working

Community Beginner ,
Aug 23, 2020

Copy link to clipboard

Copied

this is my script blow:

var textItemRef = app.activeDocument.activeLayer.textItem;

var fonts = app.fonts;

for(var i  = 0; i < fonts.length; i++){

var fontName = fonts[i].postScriptName;

textItemRef.font = fontName;

}

i`m trying to set every font installed, but some font(most of them) are set failed(without any changing),is any script i wrote wrong,thanks for any help!

thanks for your replay,  i find out what the problem is, if textItem contens is not support the font i trying to set, then the action will be fail!

Topics

Actions and scripting, How to, Windows

Views

54

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

I`m trying to change font by scripting, but not all font working

Community Beginner ,
Aug 23, 2020

Copy link to clipboard

Copied

this is my script blow:

var textItemRef = app.activeDocument.activeLayer.textItem;

var fonts = app.fonts;

for(var i  = 0; i < fonts.length; i++){

var fontName = fonts[i].postScriptName;

textItemRef.font = fontName;

}

i`m trying to set every font installed, but some font(most of them) are set failed(without any changing),is any script i wrote wrong,thanks for any help!

thanks for your replay,  i find out what the problem is, if textItem contens is not support the font i trying to set, then the action will be fail!

Topics

Actions and scripting, How to, Windows

Views

55

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Aug 23, 2020

Copy link to clipboard

Copied

Without actually testing this, most fonts are no longer postscript. Does just using font(i).name work?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Aug 23, 2020

Copy link to clipboard

Copied

thanks for your replay,  i find out what the problem is, if textItem contens is not support the font i trying to set, then the action will be fail!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Aug 23, 2020

Copy link to clipboard

Copied

Hi,

I tried your script, each and every fonts work. May be some of the fonts are different from you. Could you please let us know some of fonts name which are not working at your end?

Best regards

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Aug 23, 2020

Copy link to clipboard

Copied

i fixed the problem, my textItem contens not support some font, so the action failed

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...