Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

how to get font properties like line height, ascend, descend, ideographic top etc..?

$
0
0

I would like to know if we can access font properties like line-height, ascend, descend etc. through scripting.

 

I have been trying to get this now by applying a font to sample text as mentioned below.

 

var fontLists = app.fonts.everyItem().getElements();

var applicationDocument = app.documents.add();

var appPage = applicationDocument.pages.item(0);

 

var appTextFrame = appPage.textFrames.add();

 

appTextFrame.contents = "sample";

 

var appParagraphText = appTextFrame.paragraphs[0];

 

for (var i=0; i<fontLists.length; i++){

     var xfont = app.fonts[i];

    //alert('font name '+xfont.name);

    appParagraphText.appliedFont = app.fonts.item(xfont.name);

    var line = appParagraphText.lines[0];

    var myLineheight = line.ascent + line.descent

    alert('font name '+xfont.name +' \n baselineShift -'+appParagraphText.baselineShift+' \n fontStyle - '+appParagraphText.fontStyle

    +' \n fontAscent - ' + appParagraphText.ascent+' \n descent - '+appParagraphText.descent) + ' \n line height '+myLineheight;

}  

 

Is there any other better way to get this?


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>