Any way to get all fonts installed on computer using Photoshop API 2021?

With API 2022 I can use ‘require(‘photoshop’).app.fonts’ to get the list of fonts installed on my computer, but my extension is still using API 2021. So is there a similar api in API 2021 to get all fonts? Or any api to get the display name of a font?

You cannot get fonts in that way using the Photoshop DOM API v1 (2021), or get the display names of a font. We recommend that you stray from using API 2021 at all as API 2022 is most up-to-date.

Is there any reason why you’re using API 2021 over 2022? I’d like to understand your use case.

Best,

Amanda

Thanks for replying. The reason is most of my users are still using Photoshop v22 or below and if I’m not wrong, API 2022(v2?) only supports Photoshop v23 or above.

You are correct - v2 of the API requires at least Photoshop v23.0.

We encourage developers to move to v2 of the API because v1 is not being updated anymore. I’m curious about why are most of your users using Photoshop v22 or below?

You could try fontList in Application class:

const {batchPlay} = require("photoshop").action;

const result = await batchPlay(
   [
      {
         _obj: "get",
         _target: [
            {
               _property: "fontList"
            },
            {
               _ref: "application",
               _enum: "ordinal",
               _value: "targetEnum"
            }
         ],
         _options: {
            dialogOptions: "dontDisplay"
         }
      }
   ],
   {}
);
1 Like

Wow it works. That’s so helpful thank you!

1 Like

It’s always customary to mark the post, which solved a problem, as a solution by clicking on a Solution checkbox under that specific post :wink: This helps when others are searching the forums and keeps things tidy :slight_smile: