Quantcast
Channel: Adobe Community: Message List - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 3715

Re: get FontSize of the text

$
0
0

Hi, This is sample script

 

var findSize  = "12";

var changeSize = "20";

var doc = app.ActiveDoc;

var pgf = doc.TextSelection.beg.obj;

main(pgf, doc);

function main (pgf, doc) {

 

    var end = Constants.FV_OBJ_END_OFFSET - 1, begin = 0, textRange;

    

    var textList = pgf.GetText (Constants.FTI_CharPropsChange);

    for (var i = textList.length - 1; i >= 0; i -= 1) {

        begin = textList[i].offset;

        if (begin !== end) {          

            textRange = new TextRange (new TextLoc (pgf, begin), new TextLoc (pgf, end));           

            var oProp = doc.GetTextPropVal(textRange.beg, Constants.FP_FontSize);

            if(oProp.propVal.ival /  65536 == Number(findSize)){

                newVal = 65536 * changeSize;    

                prop = new PropVal ();

                prop.propIdent.num = Constants.FP_FontSize;

                prop.propVal.valType = Constants.FT_Metric;

                prop.propVal.val = newVal;                  

                doc.SetTextPropVal (textRange, prop);

                }                  

            end = begin;

        }

    }

    if (end > 0) {

        textRange = new TextRange (new TextLoc (pgf,0), new TextLoc (pgf,end));

         var oProp = doc.GetTextPropVal(textRange.beg, Constants.FP_FontSize);      

         if(oProp.propVal.ival /  65536 == Number(findSize)){            

         newVal = 65536 * Number(changeSize);     

         prop = new PropVal ();

        prop.propIdent.num = Constants.FP_FontSize;

        prop.propVal.valType = Constants.FT_Metric;

        prop.propVal.val = newVal;

        doc.SetTextPropVal (textRange, prop);

        }

    }

}

 

The above script found text which have font size 12pt successfully.. but did not changed to the size 20pt.. i think it changed by default size..

 

is there any mistake in the above script?


Viewing all articles
Browse latest Browse all 3715

Trending Articles



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