Skip to main content
Inspiring
November 3, 2022
Question

Determine if font is type kit font

  • November 3, 2022
  • 1 reply
  • 1175 views

I can determine the number of fonts I have with:

 

var numOfFonts = app.fonts.length;

 

Yay! I have three fonts installed!

 

But I now need a way to determine if that font belong to typekit or not. - This process can be done manually but I'm keen to script this. However, I don't think there are any properties for this in TextItem.

Can it be done with scripting?

 

This topic has been closed for replies.

1 reply

Inspiring
November 9, 2022

Well.. that didn't quite get the response I was hoping for. #wasitsomethingIsaid

Legend
November 9, 2022

Photoshop does not provide any additional attributes for typekit fonts.

 

In Windows* you can find a list of such fonts by reading the entitlements.xml file located at:

%userprofile%\AppData\Roaming\Adobe\CoreSync\plugins\livetype\c\

 

This XML file have enough attributes to match them with the list of fonts that Photoshop provides:

 

<font> <url>https://api.typekit.com/desktop_v2/sync/F030623B4FAC08CA0A490D44%40AdobeID/TkD-48850-f80dffe04cf3ca5b0e91778f3f76c5c2e76bb9c1</url>
      <id>48850</id>
      <properties>
        <fullName>BD Supper Regular</fullName>
        <familyName>BD Supper</familyName>
        <variationName>Regular</variationName>
        <familyURL>https://typekit.com/fonts/bd-supper</familyURL>
        <sortOrder>800</sortOrder>
        <owner>Adobe Fonts</owner>
        <installState>OS</installState>
        <installStateUpdatedAt type="dateTime">2022-11-09T10:17:13Z</installStateUpdatedAt>
        <syncFontId>TkD-48850-f80dffe04cf3ca5b0e91778f3f76c5c2e76bb9c1</syncFontId>
        <familyWebId>wbqb</familyWebId>
        <fvd>n4</fvd>
        <isVariable>false</isVariable>
      </properties>
</font>

 

We can work with this file** like this:

 

var f = new File(Folder.userData + '/Adobe/CoreSync/plugins/livetype/c/entitlements.xml');
if (f.exists) {
    f.open('r')
    var xmlStr = f.read();
    f.close();
    if (xmlStr.length) {
        var contentXML = new XML(xmlStr),
            typeKitFonts = new XML(contentXML.fonts),
            i = 0, s = [];
        while (typeKitFonts.font[i]) s.push(typeKitFonts.font[i++].properties.fullName);
        alert(s.join('\n'));
    }
}

 

macOS uses a different livetype storage system and this trick won't work.

** you can find more information about working with XML in JAVASCRIPT TOOLS GUIDE