Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Script to find SVG font and Multiple Master fonts

Participant ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

Hi,

Can we possible to find the SVG and Multiple Master fonts with coding?

 

var myfo = app.activeDocument.fonts; for(var f=0; f<myfo.length; f++){ alert(myfo[f].fontType) }

 

Screenshot 2021-05-07 at 5.13.34 PM.png

 

Screenshot 2021-05-07 at 4.51.16 PM.png

 

Screenshot 2021-05-07 at 5.01.07 PM.png

 Any other way to find these type of fonts?

 

 

Thanks,

Selva

TOPICS
Scripting

Views

738

Likes

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

correct answers 1 Correct answer

Adobe Community Professional , May 10, 2021 May 10, 2021
Hi Selva, this code snippet is working for me to get variable fonts used in a document: var docFontsArray = app.documents[0].fonts.everyItem().getElements(); var variableFontsArray = []; for( var n=0; n<docFontsArray.length; n++ ) { if( "numDesignAxes" in docFontsArray[n].properties ) { variableFontsArray[ variableFontsArray.length++ ] = docFontsArray[n] ; } }; for( var n=0; n<variableFontsArray.length; n++ ) { $.writeln( variableFontsArray[n].name ); }; No idea if it can detect eve...

Likes

Translate

Translate
Adobe Community Professional ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

Hi Selva,

Multiple Master fonts?

 

Do you mean perhaps Variable Type fonts?

Check for numDesignAxes in the font object.

 

"numDesignAxes" in app.documents[0].fonts[0].properties

 

would return true if the font is a VAR font, false if not. And if true you could read out the number of design axes. This rationale is empiric and is not mentioned as such in DOM documentation.

 

Hm.

For SVG I currently cannot see a solution.

Suggestions are very welcome…

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Participant ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

Hi Uwe,

Thanks for this method, I have used 2 VAR fonts, but return only one font. 

 

var myfo = app.activeDocument.fonts;

for(var f=0; f<myfo.length; f++){

    if(myfo[f].properties.numDesignAxes){alert(myfo[f].name)}

}

 

Thanks,

Selva

Likes

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 Professional ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

A variable font without property numDesignAxes?
How can that font work as a variable one?

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Participant ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

Hi Uwe,

I have used numDesignAxes from your suggestion, the return result is the number. So, I assumed this method is suitable for me. 

 

I'm new to this and not familiar to handle the 'properties', kindly suggest if alternate any. 

 

Thanks,

Selva

Likes

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 Professional ,
May 07, 2021 May 07, 2021

Copy link to clipboard

Copied

Hm. After testing a bit more. Would it work to ask this:

"fontType" in app.documents[0].fonts[0].properties

if that returns false it's not one of the current known 10 font type possibilities listed in DOM documentation.

FontTypes.ATC
FontTypes.BITMAP
FontTypes.CID
FontTypes.OCF
FontTypes.OPENTYPE_CFF
FontTypes.OPENTYPE_CID
FontTypes.OPENTYPE_TT
FontTypes.TRUETYPE
FontTypes.TYPE_1
FontTypes.UNKNOWN

But this is only a hint, that it could be a SVG font. One example for this:

SourceCodePro-Medium where the Find Font dialog is reading out OpenType Type 1 (SVG) for property Type.

 

Other SVG fonts like Noto Color Emoji SVG Regular are different examples. My script snippet above would return true for "fontType". And the value for fontType would be FontTypes.OPENTYPE_CFF.

Here we could apply a distinct CMYK fill color to a character where this font is applied to and inspect the fill colors of the graphic frames that are added when the character is converted to outlines. If they are all in RGB one could assume it is a color SVG font.

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Participant ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

Hi Uwe,

Thanks for the suggestion. I'll check and get back to you shortly. 

 

Thanks,

Selva

Likes

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 Professional ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

Hi Selva,

this code snippet is working for me to get variable fonts used in a document:

var docFontsArray = app.documents[0].fonts.everyItem().getElements();
var variableFontsArray = [];

for( var n=0; n<docFontsArray.length; n++ )
{
	if( "numDesignAxes" in docFontsArray[n].properties )
	{
		variableFontsArray[ variableFontsArray.length++ ] = 
		docFontsArray[n] ;
	}
};

for( var n=0; n<variableFontsArray.length; n++ )
{
	$.writeln( variableFontsArray[n].name );
};

 

No idea if it can detect every variable font in the world that can be used with InDesign.

Testing this way is pure empiric. For now that test is sufficient.

 

If it fails in your case, please do a screenshot of the dialog Type > Find/Replace fonts…, select the font and look into "More Information" what the details are ( screenshot from my German InDesign 2021 ) :

 

DetectVariableFonts-UsedInDocument-1.PNG

 

Regards,
Uwe Laubender

( ACP )

Likes

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
Participant ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

Hi Uwe,

Thank you so much for this guidance and the clear explanation. 

 

Can I raise the query to Adobe official sites related to SVG?

 

Thanks,

Selva

Likes

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 Professional ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

For feature requests and bug reports use InDesign UserVoice:

https://indesign.uservoice.com/

 

"Performance/Usability" is a category where you could do a feature request for InDesign's Preflight.

There is also "Scripting"…

 

I'd first search at UserVoice if there already is a feature request or bug report that fit your needs and upvote that.

When done with your bug reports or feature requests, please come back here and share the links to the reports so that all who are reading this here can upvote.

 

Regards,
Uwe Laubender

( ACP )

Likes

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 Professional ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

Ganesh already did a feature request on SVG Fonts with Preflight:

 

In Preflight option to identify OTF SVG font used
Ganesh, May 07, 2021
https://indesign.uservoice.com/forums/601021-adobe-indesign-feature-requests/suggestions/43372281-in...

 

"Like Type 1 multiple Master font to find OTF VAR font type. We need option to find OTF SVG font used in the document."

 

Support it with your vote!

And of course everybody else who is reading this.

 

Thanks,
Uwe Laubender

( ACP )

Likes

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
Participant ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

LATEST

Hi Uwe,

The vote has been completed. Thanks for the initiative. 

 

 

Thanks,

Selva

Likes

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