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

Need some support with syntax from FDK to ExtendScript : Getting FontFamily

Guest
Mar 29, 2013 Mar 29, 2013

Copy link to clipboard

Copied

Hi there, I am using some scripts to traverse my text and add tags to specific characters when they use a given font. This works fine if the PlatformName is known, but every now and a while these seem to be not set. I therefore want to do the following : If no FontPlatformName get the FontFamily instead, but I'm struggling to get it working as the scripting references are a bit limited on covering conversion.

This is what's in the fdk (simplified for my needs) :

families = F_ApiGetStrings(0, FV_SessionId, FP_FontFamilyNames);

for (i=0; i < families.len; i++)

if(F_StrIEqual(families.val, "myFont")

     /* Do something*/

) break;

But I can't get it working on extendscript

What I have now is something like below :

var doc = app.ActiveDoc;

var families = Constants.FP_FontFamilyNames.GetStrings;

for (var i = 0; i < families.length; i += 1)

{

// alert fontname of families.val

}

But I'm doing something wrong as it fails on my for loop. Anybody that can help getting the syntax correct ?

Thanks in advance already

TOPICS
Scripting

Views

685

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 29, 2013 Mar 29, 2013

Copy link to clipboard

Copied

The equivalent to the FDK's (and FrameScript's) Session is the app. So this gives you the Font Family Names:

app.FontFamilyNames

Rick

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 29, 2013 Mar 29, 2013

Copy link to clipboard

Copied

LATEST

The FontFamily property is an index into the list of FontFamilyNames. For example, you can tell the font that is used by the paragraph containing the insertion point with this:

#target framemaker

var doc = app.ActiveDoc;

var pgf = doc.TextSelection.beg.obj;

alert (app.FontFamilyNames[pgf.FontFamily]);

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