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

Installed fonts

Explorer ,
Dec 17, 2013 Dec 17, 2013

Copy link to clipboard

Copied

Hi,

I'm writing script and need it to check if a particular font is install.  Does anyone know if this is possible and how it would be done??  I can't seem to find any documentation on it.

Bill

TOPICS
Scripting

Views

1.5K

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

Explorer , Dec 17, 2013 Dec 17, 2013

Thanks for your help Dan...that seems like the best solution. 

Bill

Votes

Translate

Translate
Community Expert ,
Dec 17, 2013 Dec 17, 2013

Copy link to clipboard

Copied

I don't know of any way currentlyt to get all the installed fonts, but if you just need to know if a font is installed, you could just set your text layer (or maybe a temporary text layer) to that font, read the font back and see if they match:

var myFontName = "xxxx";

var myComp = app.project.activeItem;

var myTextLayer = myComp.layer(1);

var mySourceText = myTextLayer.property("ADBE Text Properties").property("ADBE Text Document");

var myTextDoc = mySourceText.value;

myTextDoc.font = myFontName;

mySourceText.setValue(myTextDoc);

myTextDoc = mySourceText.value;

if (myTextDoc.font != myFontName) alert ("failed");

Something like that.

Dan

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
Explorer ,
Dec 17, 2013 Dec 17, 2013

Copy link to clipboard

Copied

Thanks for your help Dan...that seems like the best solution. 

Bill

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
New Here ,
Jan 14, 2014 Jan 14, 2014

Copy link to clipboard

Copied

Hello!

I needed to do a font test today.

With fontName as it is typed in the character window font dropdown, this code seems to work...

var fontName = "Times New Roman";

var fontExists = false;

try {

    ScriptUI.newFont(fontName, "REGULAR", 1);

    fontExists = true;

} catch(err) {}

if (fontExists) alert("Font exists!");

else alert("Font does not exist!");

As far as getting a list of available machine fonts, I can't seem find a solution so...help needed!

The 'newFont()' function has to look it up...so why can't we? I'm pretty sure you can for InDesign

Jack

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 Beginner ,
Mar 24, 2014 Mar 24, 2014

Copy link to clipboard

Copied

Is there a way to determine what the name is for a particular font installed?

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
New Here ,
Mar 24, 2014 Mar 24, 2014

Copy link to clipboard

Copied

In AE, I believe it's just the string used in the font family dropdown in the character window.

So you'd have to have the font installed for testing.

Jack

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 Beginner ,
Mar 24, 2014 Mar 24, 2014

Copy link to clipboard

Copied

I tried that but AE just put Myriad in instead. Do you need to specify the weight as well? I'm trying to call "Helvetica Neue LT STD" for example. Do I need to write in that I also want "77 Bold Condensed" too?

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 Beginner ,
Mar 24, 2014 Mar 24, 2014

Copy link to clipboard

Copied

I just make a quick tweak to Dan's script snippet and had AE show me the font with it. Apparently, what I wanted is below. I'll use that trick in the future to find how AE spells the font in question.

---------------------------

Script Alert

---------------------------

HelveticaNeueLTStd-BdCn

---------------------------

OK  

---------------------------

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 ,
Mar 24, 2014 Mar 24, 2014

Copy link to clipboard

Copied

LATEST

Ah, I was just getting ready to jump in. This should be all you need (assuming the text layer is layer 1):

var myTextLayer = app.project.activeItem.layer(1);

var mySourceText = myTextLayer.property("ADBE Text Properties").property("ADBE Text Document");

var myTextDoc = mySourceText.value;

alert(myTextDoc.font);

Dan

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