Skip navigation
Currently Being Moderated

Adding text frames

Jun 26, 2012 3:07 PM

I'm adding text frames via a script to every layer of every spread of a file.

The only properties I address are the geometric bounds and stroke color and size.

 

On some client provided files if I run another script to tell me the geometric bounds of the textframes, on certain pages it shows the first two geometric bounds as being -.999999999999 and 0 when it is has been assigned to be -1 and 0.  But if I manually click on the text frames they are correctly showing the x y coordinates that I expect(-1,0).

 

 

I'll try to post the code in a bit but I'm pretty sure this has more to do with the files changing from being facing pages to not and it leaving some lingering issue. Maybe I need to totally clear all facing pages properties before adding the text frames??

 
Replies
  • Currently Being Moderated
    Jun 26, 2012 3:20 PM   in reply to pkrk

    InDesign is extremely accurate with its dimensions. Inside, all of your measurement units are converted to points (1/72"), with up to 12 or 13 digits of accuracy. However,

     

    1. Every manipulation of an object may increase or decrease the size of an object by a fractionally rounded value, due to this limited accurary of mathematic operators. Rest assured, this usually is in the range of 1E-10 points, or slightly below the wavelength of visible light. But Small Errors May Round Up. On the other hand ...

     

    2. I'd go barking mad if InDesign showed every single measurement in the User Interface with all of the internal digits. To preserve my sanity, ID only shows two or three most significant decimals, attuned to the scale of the current measurement unit (inches have lots of decimals, millimeters not).

     

    So your -.999999999999 is slightly rounded downwards, by a mere 0.000000001%, to facilitate easy reading and conserve valuable on-screen space.

     

    [Edit] Hah, I forgot to address that you actually input "-1" bu get something else out (*). In what unit would that be? Since ID's internal measurement unit is in points, every other unit needs to be converted into that, including some inevitable rounding.

     

    (*) Only by aforementioned 0.000000001%, but still, it is something else.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 12:49 PM   in reply to pkrk

    Converting the value up front is not necessary, ID does that on its own.

     

    Strangely enough, a conversion from inches to points *is* exact -- one inch equals 72 points. Or at least it does if you use Adobe's definition (which I think InDesign is using internally).

     

    I'd simply not bother about the 0.00000001% discrepancy. Even if your output is going to be scaled up, it would need to be miles (or kilometers ;) ) wide before anyone should notice it, and at such magnifications the process itself would be adding much more to any inaccuracies.

     

    If you want to display the value to a user, use rounding:

     

    valRounded = Math.round(value*1000)/1000;

     

    will return your value with a modest three digits of accuracy.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points