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

List of missing fonts in Photoshop (.psd images)

Explorer ,
Feb 19, 2021 Feb 19, 2021

Hi All,

 

I am trying to find the "missing font list" from the *.psd file (Photoshop) using the javascript. Please help me to find the missing font list.

 

Thanks,
Magesh

TOPICS
Actions and scripting
803
Translate
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

correct answers 1 Correct answer

Mentor , Feb 20, 2021 Feb 20, 2021

missing fonts in the stylesheet are marked with fontAvailable == false

 

#target photoshop

var s2t = stringIDToTypeID,
    missingFontList = {};

(r = new ActionReference()).putProperty(s2t('property'), p = s2t('numberOfLayers'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var len = executeActionGet(r).getInteger(p);

for (var i = 1; i <= len; i++) {
    (r = new ActionReference()).putProperty(s2t('property'), p = s2t('textKey'));
    r.putIndex(s2t('layer'), i);
    if 
...
Translate
Adobe
Community Expert ,
Feb 20, 2021 Feb 20, 2021

I don’t recall a font list in the document properties. 

Which, if I’m not mistaken, would mean having to process the Type Layers – I am not sure if missing fonts can be directly recognized or if one would have to compare a list of all fonts with the list of fonts the application has access to. 

 

@r-bin , @Kukurykus , @jazz-y , please forgive the intrusion, but you seem to be some of the most active current posters when it comes to Photoshop Scripting – do you have ideas on this issue? (Or recall an existing Script for the task? ) 

Translate
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
Mentor ,
Feb 20, 2021 Feb 20, 2021

missing fonts in the stylesheet are marked with fontAvailable == false

 

#target photoshop

var s2t = stringIDToTypeID,
    missingFontList = {};

(r = new ActionReference()).putProperty(s2t('property'), p = s2t('numberOfLayers'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var len = executeActionGet(r).getInteger(p);

for (var i = 1; i <= len; i++) {
    (r = new ActionReference()).putProperty(s2t('property'), p = s2t('textKey'));
    r.putIndex(s2t('layer'), i);
    if (executeActionGet(r).hasKey(p)) {
        var sList = executeActionGet(r).getObjectValue(p).getList(s2t('textStyleRange'));
        for (var x = 0; x < sList.count; x++) {
            var k = sList.getObjectValue(x).getObjectValue(s2t('textStyle'))
            if (k.hasKey(s2t('fontAvailable'))) {
                if (!k.getBoolean(s2t('fontAvailable'))) {
                    missingFontList[k.getString(s2t('fontPostScriptName'))] = false
                }
            }
        }
    }
}

alert(missingFontList.toSource())

 

(I think it makes no sense to check the defaultStyle of the paragraph and the baseStyle of the textStyle)

 

Translate
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 ,
Feb 21, 2021 Feb 21, 2021

Impressive, thanks for checking into this thread! 

Translate
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 ,
Mar 09, 2021 Mar 09, 2021
LATEST

Thanks for your support!!!

Translate
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