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

How to collect/package fonts using Javascript?

Contributor ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

Hi,

 

I need to collect all font files used in an active document in Adobe Illustrator. By looking at the XML header, I'm able to create a list of fonts used in a document, but I can't locate the full path to the font file.

 

How do I locate the full path of the fonts used in a file? How does the "package" feature is able to collect the fonts?

 

Thank you

TOPICS
Scripting

Views

483

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 Expert ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

youre looking to do this with a script? not via the File > Package... option?

 

i dont know of any way to get the full path of a font... but in theory they should be coming from a specific place. so you could hard code the path to your system fonts (or whatever folder your font manager uses) and then get the font name from the api by looping all the textFrames in the document, making an array of the font names, via the TextFrameItem.textRange.textFont.name property, then write a text file with the full paths to each unique font 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 ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

Edit: this info is for Indesign, sorry.

---

Hi @tmmls, you should be able to get the path to the font file using the location property of the Font.

- Mark

 

 

var font = app.fonts.itemByName('Arial\tBold'),
    path = font.location;

$.writeln(path);

 

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
Contributor ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

Hi Mark,

 

It seems that Illustrator does not have an app.fonts, but an app.textFonts. And a TextFont object has no location property.

 

I have found another approach to maybe solve this. By making a BridgeTalk connection, I can probably do it with Indesign as well. However, if I could only do it with Illustrator, that would be a better choice

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 ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

LATEST

Hi @tmmls, stupid me! On my phone, because of the forum UI, I can't easily see if it is an Illustrator or Indesign question. BridgeTalk/Indesign is a clever workaround.

- Mark

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