4 Replies Latest reply on Dec 6, 2011 10:54 AM by Dan Macy

    IDML geometry

    Dan Macy Level 1

      I started with a new document in InDesign. It has facing pages set but only 1 8.5" x 11" page in the document. I put a 1" x 1" rectangle with a stroke weight of 1 pt. in the center of the page (X = 4.25" and Y = 5.5" for the center point of the rectangle). I then export this document to an IDML file and unpack it.

       

      In the one spread XML file, I have the following ItemTransform values (just the last two values; the first four are always "1 0 0 1"):

       

      Spread: 0 0

      Page: 0 -396

      Rectangle: -19.44 29.52

       

      The four path points for the rectangle are (289.94, -65.02), (289.94, 5.98), (360.94, 5.98) and (360.94, -65.02). The difference of the X and Y coordinates of these points is 71 x 71. I have StrokeAlignment defaulting to CenterAlignment. However, the coordinates of the path points suggests that they are the inside corners of the rectangle's stroke.

       

      I don't understand how InDesign is coming up with these values. How are the ItemTransform values for the rectangle being calculated?

       

      Also, why are the coordinates of the path points not the actual coordinates of the center of the path if I want a 1" square and stroke alignment is set to CenterAlignment?

       

      Thanks for your help!

        • 1. Re: IDML geometry
          John Hawkinson Level 5

          Dan:

            I changed my mind, I think the scripting forum is a better place for these questions.

           

          I'm not sure what your actual real question is. if your question is how InDesign comes up with the set of coordinate transformations for a particular rectangle, well, why would you care? It probably has to do with the exact steps you use to create the object, whether you do it in relation to other objects, create it and move it, etc., etc.

           

          Anyhow, you report:

          Spread: 0 0

          Page: 0 -396

          Rectangle: -19.44 29.52

          So that gives you an aggregate transformation matrix of [ 1 0 0 1  -19.44 -366.48 ].

          If you apply that to your points, you get (270.5, -431.5), (270.5, -360.5), (341.5, -360.5), and (341.5, -431.5).

           

          That all seems right to me. For instance, the X center is (270.5+341.5)/2 => 306pt => 4.25".

          The difference of the X and Y coordinates of these points is 71 x 71. I have StrokeAlignment defaulting to CenterAlignment. However, the coordinates of the path points suggests that they are the inside corners of the rectangle's stroke.

          Why do you think so? You have a CenterAligned 1pt stroke, which means it extends 0.5pt into the rectangle and 0.5pt out of the rectangle. So, in the X direction, your stroke starts 0.5pt before the rectangle (at 270pt), then the rectangle starts at 270.5pt,and then the stroke ends at 271pt.

           

          Also, why are the coordinates of the path points not the actual coordinates of the center of the path if I want a 1" square and stroke alignment is set to CenterAlignment?

          I think that they are. But when you ask for a 1" square with a 1pt CenterAlignment stroke, then the width measured from the outside of the stroke to the outside of the stroke is going to be 1pt larger (half a pt on each side) than square to which it is aligned. So, you'll either have 72pt (1") around the stroke and a 71pt square, or you'll have a 72pt square and 73pt bounds of the stroke.

           

          But if your goal is to create IDML, again, I don't see why any of this matters to you.

          p.s.: It might be clearer if you just included the relevant chunk of IDML and perhaps a screenshot. But perhaps it wouldn't be. I dunno.

          • 2. Re: IDML geometry
            Dan Macy Level 1

            John,

             

            Thanks very much for your answers and for your patience with my ignorance!

             

            I was concerned about the origin of the rectangle's coordinate system only because I didn't know if there might side effects (that I'm not aware of) from choosing it arbitrarily. I take it from your comments that it doesn't matter, so I can choose the upper left corner of the page if that's most convenient for me.

             

            Also, I think I understand the stroke alignment a little better now through your explanation.

             

            From now on, I'll post my IDML questions in the scripting forum.

             

            Again, thanks for your help!

            • 3. Re: IDML geometry
              John Hawkinson Level 5

              I was concerned about the origin of the rectangle's coordinate system only because I didn't know if there might side effects (that I'm not aware of) from choosing it arbitrarily. I take it from your comments that it doesn't matter, so I can choose the upper left corner of the page if that's most convenient for me.

              Yup, you can absolutely do that. Certainly InDesign chooses what is most convenient for it!

               

              I would tend to think what makes the most sense is for you to have your rectangle's coordinates be relative to the  the rectangle, and use the rectangle's item transformation matrix to position the rectangle on the page. That is:

              <Rectangle ItemTransform="1 0 0 1 306 -396">
                <Properties>
                  <PathGeometry><PathPointArray>
                    <PathPointType Anchor="-31.5 -31.5">
                    <PathPointType Anchor="31.5 -31.5">
                    <PathPointType Anchor="31.5 31.5">
                    <PathPointType Anchor="-31.5 -31.5">
              

              Though maybe it would be clearer to use a corner of the rectangle instead of its center:

               

                  <PathGeometry><PathPointArray>
                    <PathPointType Anchor="0 0">
                    <PathPointType Anchor="72 0">
                    <PathPointType Anchor="72 72">
                    <PathPointType Anchor="0 72">
              

               

              But it really all depends on your application and what kind of page objects you are using and their relationship to each other...

              1 person found this helpful
              • 4. Re: IDML geometry
                Dan Macy Level 1

                That's helpful too. Thanks very much!