ExtendScript: cache in app.textFonts?

Community Beginner ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

I have installed the font programmatically and I can see the font in Windows Font directory, however,  when I try to get the font via:

var fontName = app.textFonts.getByName("SourceHanSansCN-Bold")
fontName always get null, Is there cache in the app.textFonts? Any advise?
TOPICS
Performance , Scripting , SDK

Views

130

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
community guidelines
Advocate ,
Apr 22, 2022 Apr 22, 2022

Copy link to clipboard

Copied

That expression should get you the font object (although still not null).  This should get you the font name:

var fontName = app.textFonts.getByName("SourceHanSansCN-Bold").name;

 

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
community guidelines
Adobe Community Professional ,
Apr 23, 2022 Apr 23, 2022

Copy link to clipboard

Copied

Did you install the font "For all users"?

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
community guidelines
Community Beginner ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

yeah, I put the font to the "C:\windows\Font" directory.

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
community guidelines
Adobe Community Professional ,
Apr 23, 2022 Apr 23, 2022

Copy link to clipboard

Copied

can you see the font in the Illustrator UI?

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
community guidelines
Advocate ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

LATEST

If ExtendScript can't access the font object, you would have gotten an error ("no such element found" or something to that effect).  If you're really getting "null", there is more to this than we are being told.  

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
community guidelines