• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

ExtendScript: cache in app.textFonts?

Explorer ,
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

247

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
Guide ,
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;

 

Votes

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 Expert ,
Apr 23, 2022 Apr 23, 2022

Copy link to clipboard

Copied

Did you install the font "For all users"?

Votes

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
Explorer ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

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

Votes

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 Expert ,
Apr 23, 2022 Apr 23, 2022

Copy link to clipboard

Copied

can you see the font in the Illustrator UI?

Votes

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
Guide ,
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.  

Votes

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