Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

Textline property not set within function, but available outside

$
0
0

Dear all.

Let's see whether I can explain my current problem:

I have a function DrawTextLine which - at it's end - decides whether the text is just placed at the coordinates x0/y0 or it shall be centered within a given length (or right adjusted within this space) - line 20.

// ---------------------------------------------- Centre/right adjust within tLength  boundLeft = 0.;  if (tLength == (undefined || null)) {    oTextLine.BasePointX = x0 * goFgr.CM;         // .Width, .Height set by text contents !    oTextLine.BasePointY = y0 * goFgr.CM;         //    oTextLine.Angle = angle * goFgr.DEGREE;    return oTextLine;  } else {    textLen = oTextLine.Width/goFgr.CM;           // cm    if (tLength > 0){      boundLeft = (Math.abs(tLength) - textLen)/2;    } else {      boundLeft = (Math.abs(tLength) - textLen);    }  }
// ---------------------------------------------- Place and rotate text  dY = dX = 0.;  dX = boundLeft * angSin;  dY = boundLeft * angCos;  oTextLine.BasePointX = (x0 + dX) * goFgr.CM;    // units  oTextLine.BasePointY = (y0 + dY) * goFgr.CM;  oTextLine.Angle = angle * goFgr.DEGREE;  return oTextLine;
} //--- end DrawTextLine

 

In all tests this routine works fine, as the following diagram demonstrates (watch the numbers within the 1cm grid):

Test-DawTextLine.png

Now, when using this function within in another function DrawAxisCal to center the month name between the adjacent scale tics - it does not behave!

When stepping through the code the text properties show that it should be placed correctly, but it is not.

- Still within DrawTextLine the property oTextLine.Width is 0

- After DrawTextLine ahs been left the Width is set correctly.

Hence in  DrawAxisCal I again set the proper value for oTextLine.BasePointX

xLabel  = xTic;
monthLen = (monStart[j+1] - monStart[j])*vUnit;
if (xLabel + monthLen > progressEnd) {break Cycles; } // no space for month annotation
aText.length = 0;                       // clear prophylactically
aText[0] = sMonShort[langMonth][j];
if (monthLen > 1.35) {aText[0] = sMonNames[langMonth][j];} // 1.35 determined by trial
oObject = DrawTextLine (xLabel, yLabel, aText, aFormat, angle, monthLen); // centred
// for unknown reason centring does not work inside of DrawTextLine!
oObject.BasePointX =  xLabel* goFgr.CM + (monthLen*goFgr.CM - oObject.Width)/2; // units

 

I have carefully checked the scope of the variables. My only guess is that ESTK may become tired and skip certain statements. Yes, I have observed this in other circumstances already. Only after restarting FM and ESTK it worked correctly again...

 

… And while I'm writing this - after taking a screenshot from the open FM-document - FM-15.0.603 quits with Internal Error …

 

Test-DawTextLine2.png


Viewing all articles
Browse latest Browse all 888

Trending Articles



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