none
Preset rendering issue RRS feed

  • Question

  • Hello All,

    I am facing issues in rendering following presets with specific height and width:

    Moon

    No Symbol

    Oval Callout

    Multiply

    Flow Chart - Sequential Access Storage

    I am using the preset definitions mentioned in the ECMA 376, Second edition. Is there something known to be wrong with this?

    Can someone share the pathlist and guidelist for these shapes, for me to confirm.

     

    -Sucheta K

    Wednesday, November 16, 2011 5:22 AM

Answers

  • Hi Sucheta,

     

    You are right the “at2” function definition in “Office Open XML Part 1 – Fundamentals And Markup Language Reference” in section 20.1.9.11 is not correct.

     

    ('at2') - ArcTan Formula

    Arguments: 2 (fmla="at2 x y")

    Usage: "at2 x y" = arctan(y / x) = value of this guide

     

    The two most obvious problems are: “arctan” returns radians, “at2” returns 60000<sup>th</sup> of a degree; if x is zero y/x is not interpreted, “at2 0 1”, as I’ll show you below, returns 90<sup>0</sup>, i.e. 5400000. I’m going to file a suggestion that the “at2” function should be documented in MS-OI29500.

     

    Let’s check how the “at2” function works in PowerPoint. As far as I know there is no way to display the value directly what the “at2” returns, but we can use the value for drawing a shape. Because “at2” returns angle, the pie shape looks a natural choice for rendering the value. In my previous posting on Nov. 28 I described how to make and edit a flat xml file from a PP file, we’ll use the same technique, again.

     

    Let’s check what the “at2” function returns for any x y values. Create an empty PP presentation and insert a pie, save as, e.g. “pie_at2_custGeom.xml” and close it. In Visual Studio open it and format it by Edit -> Advanced -> Format Document. For simplicity at lines 168 and 169 set all the four variables, x y cx cy, to 914400, one inch.

     

    Make our own pie based on its definition. At line 171 you should see

    <a:prstGeom prst=”pie”>
    delete its content, the <a:avLst>.

    Change the line 171 to
    <a:custGeom>
    and change line 172 from </a:prstGeom> to

    </a:custGeom>
    Now copy the pie definition from the presetShapeDefinitions.xml to our file. The pie definition starts from line 14,153, <avLst> and ends at line 14,216, </pathLst>.
    To check this save the file in VS and open it in PP, you should see the default pie in a one inch square, close it. With this the preparation is done, let’s check how the “at2” function works.

     

    In pie_at2_custGeom.xml file at line 173 you can give any value to adj1, it will be overwritten. Give value 0 (zero) to adj2, the pie ends on the positive x axis.

    The line 177 should be
    <gd name="stAng" fmla="pin 0 adj1 21599999" />
    to be sure the starting angle is in the range [0,2π). Copy the next adj1 setting before line 177

    <gd name="x" fmla="val 2" />

    <gd name="y" fmla="val 1" />

    <gd name="w1" fmla="at2 x y" />

    <gd name="w2" fmla="abs w1" />

    <gd name="w3" fmla="+- 21600000 0 w1" />

    <gd name="adj1" fmla="?: w1 w3 w2" />

    You can set (x,y) to any point and the starting line of the pie will go through on that point. Keep in mind that the “at2” function returns the angle from the x axis up and for the pie the angle is given from the x axis down.

     

    E.g. for (2,1) you will see a small pie above the positive x axis.

    For (0,1) – a quarter circle between the positive x and y axes.

    For (-2,0) – an upper half circle.

    For (0,-1) – ¾ circle missing the part between the positive x and the negative y axes.

     

    So we can see that “at2 x y” returns the angle in 60000<sup>th</sup> of a degree between the (0,0) (x,y) line and the positive x axis if y >= 0.

    If y < 0 then “at2 x y” returns “-at2 x –y”. The return value is in the range [-10800000, 10800000].

     

    Thanks, Vilmos

     

    Wednesday, December 14, 2011 1:14 AM
  • Hi Sucheta,

     

    Thank you again for bringing to our attention that the at2 function definition used in PowerPoint should be documented in the Microsoft documentation. Because there is no respond to this issue since my last posting, in which I explained how the at2 function is used in PowerPoint, I assume your problem is solved.

     

    Thanks, Vilmos

    Wednesday, December 28, 2011 8:02 PM

All replies

  • Hi Sucheta,

     

    Thanks for your question.

     

    Someone from our team will contact you shortly regarding this request.

     

    Regards,

     

     


    SEBASTIAN CANEVARI - MSFT Escalation Engineer Protocol Documentation Team
    Wednesday, November 16, 2011 3:33 PM
  • Hi Sucheta,

    I am the engineer who will be working with you on this issue. I am currently researching the problem and will provide you with an update soon.

    Thanks,
    Vilmos Foltenyi | Escalation Engineer | Open Specifications Support Team
    Email: vilmosf@microsoft.com
    Phone: +1 (425) 421-2642
    Time zone: (UTC-08:00) Pacific Time (US & Canada)

    Thursday, November 17, 2011 6:51 AM
  • Hi Sucheta,

    In your posting you mentioned five shapes suggesting you have the same kind of problems with them, I’ll deal only the first one, the Moon. In order to better see the generated file in PowerPoint we save the presentation as xml file (*.xml). Let’s use the Microsoft Visual Studio to open it and use  Edit -> Advanced -> Format Document  so we’ll have only one file in an easy human readable form. How to edit a pptx file see, e.g.
    http://blogs.msdn.com/b/openspecification/archive/2011/11/14/how-to-use-the-presetshapedefinitions-xml-file-and-fun-with-drawingml.aspx
    and in addition you can learn how to modify an existing shape.

    In your post you are referring to ECMA-376 2nd Edition; in our discussion we will use the 3rd Edition / June 2011.

    Let’s start with an empty document and insert the Moon shape and save the file in xml form. Open it in VS in the above mentioned way. Above the element <a:prstGeom prst=”moon”> at line 169 <a:ext cx=”457200” cy=”914400”/> shows that the default Moon is in a ½ x 1 inch rectangle. In PowerPoint the rectangle has handles by which the size and ratio of the sides can be changed. If the accuracy of the graphical interface is not enough then the Format -> Size dialog box can be used. By editing the xml file the size can be set with the accuracy of 914400th part of an inch.

    In PP the Moon has only one handle by which the shape can be modified, the thickness of the moon. This corresponds to the fact that in the presetShapeDefinitions.xml, the avLst element of the <moon> definition at line 13593 has only one element (with the default value of 50000). If the thickness of the Moon changed a new avLst element will appear in the presentation file with the new value at line 173, which overrides the default value. This value in the presentation file can be edited in MS (Visual Studio), and a bigger value yields a thicker Moon.

    Different values above 87500 don’t change the thickness, this is because of the first element, guide, in the guidelist, gdLst (line 13599 in presetShapeDefinitions.xml) <gd name=”a” fmla=”pin 0 adj 87500” /> ensures that the value always is between 0 and 87500. The pathLst defines how to draw the shape, e.g.  <arcTo wR=”w” hR=”hd2” stAng=”cd4” swAng=”cd2” />  at line 13668 in presetShapeDefinitions.xml describes how to draw the outer shape of the Moon; the arcTo element and its attributes are described in the “Office Open XML Part 1 – Fundamentals And Markup Language Reference”.

    Thanks, Vilmos

    Monday, November 28, 2011 5:48 PM
  • Thanks Vilmos for the detailed answer.

     

    I have actually found the problem in my rendering code, which helped get "Moon", "NoSymbol" and "Sequential Access Storage" work correctly.

    Although there are still problems in rendering mathMultiply symbol.

    What I have figured is, "at2" is the formula which is causing this issue. Can you please explain how "at2" should be implemented by the rendering engines.

     

    Should "at2 x y" be "atan2 (y,x)". What I have figured is, mathMultiply also uses "at2" function. If in my formula, I make the at2 function return the values in degrees * 6000) then the shape works correctly.

    Does this mean there should be 2 implementations of "at2" one which returns in radians and other which returns 60000 of a degree?

     

    Can you please provide exact formula to be used for "at2" function.

     

    -Sucheta


    • Edited by Sucheta K Tuesday, November 29, 2011 7:08 AM
    Tuesday, November 29, 2011 7:08 AM
  • Hi Sucheta,

     

    I’ll consider the original question as resolved and will work with you on this new issue involving “at2”.  Please stand by as I research this for you.”

     

    Thanks, Vilmos

    Thursday, December 8, 2011 6:17 PM
  • Hi Sucheta,

     

    You are right the “at2” function definition in “Office Open XML Part 1 – Fundamentals And Markup Language Reference” in section 20.1.9.11 is not correct.

     

    ('at2') - ArcTan Formula

    Arguments: 2 (fmla="at2 x y")

    Usage: "at2 x y" = arctan(y / x) = value of this guide

     

    The two most obvious problems are: “arctan” returns radians, “at2” returns 60000<sup>th</sup> of a degree; if x is zero y/x is not interpreted, “at2 0 1”, as I’ll show you below, returns 90<sup>0</sup>, i.e. 5400000. I’m going to file a suggestion that the “at2” function should be documented in MS-OI29500.

     

    Let’s check how the “at2” function works in PowerPoint. As far as I know there is no way to display the value directly what the “at2” returns, but we can use the value for drawing a shape. Because “at2” returns angle, the pie shape looks a natural choice for rendering the value. In my previous posting on Nov. 28 I described how to make and edit a flat xml file from a PP file, we’ll use the same technique, again.

     

    Let’s check what the “at2” function returns for any x y values. Create an empty PP presentation and insert a pie, save as, e.g. “pie_at2_custGeom.xml” and close it. In Visual Studio open it and format it by Edit -> Advanced -> Format Document. For simplicity at lines 168 and 169 set all the four variables, x y cx cy, to 914400, one inch.

     

    Make our own pie based on its definition. At line 171 you should see

    <a:prstGeom prst=”pie”>
    delete its content, the <a:avLst>.

    Change the line 171 to
    <a:custGeom>
    and change line 172 from </a:prstGeom> to

    </a:custGeom>
    Now copy the pie definition from the presetShapeDefinitions.xml to our file. The pie definition starts from line 14,153, <avLst> and ends at line 14,216, </pathLst>.
    To check this save the file in VS and open it in PP, you should see the default pie in a one inch square, close it. With this the preparation is done, let’s check how the “at2” function works.

     

    In pie_at2_custGeom.xml file at line 173 you can give any value to adj1, it will be overwritten. Give value 0 (zero) to adj2, the pie ends on the positive x axis.

    The line 177 should be
    <gd name="stAng" fmla="pin 0 adj1 21599999" />
    to be sure the starting angle is in the range [0,2π). Copy the next adj1 setting before line 177

    <gd name="x" fmla="val 2" />

    <gd name="y" fmla="val 1" />

    <gd name="w1" fmla="at2 x y" />

    <gd name="w2" fmla="abs w1" />

    <gd name="w3" fmla="+- 21600000 0 w1" />

    <gd name="adj1" fmla="?: w1 w3 w2" />

    You can set (x,y) to any point and the starting line of the pie will go through on that point. Keep in mind that the “at2” function returns the angle from the x axis up and for the pie the angle is given from the x axis down.

     

    E.g. for (2,1) you will see a small pie above the positive x axis.

    For (0,1) – a quarter circle between the positive x and y axes.

    For (-2,0) – an upper half circle.

    For (0,-1) – ¾ circle missing the part between the positive x and the negative y axes.

     

    So we can see that “at2 x y” returns the angle in 60000<sup>th</sup> of a degree between the (0,0) (x,y) line and the positive x axis if y >= 0.

    If y < 0 then “at2 x y” returns “-at2 x –y”. The return value is in the range [-10800000, 10800000].

     

    Thanks, Vilmos

     

    Wednesday, December 14, 2011 1:14 AM
  • Hi Sucheta,

    Here are the pie shape pictures which correspond to the end of my previous posting

     

      

     

    Thanks, Vilmos

    Wednesday, December 14, 2011 6:02 AM
  • Hi Sucheta,

     

    Thank you again for bringing to our attention that the at2 function definition used in PowerPoint should be documented in the Microsoft documentation. Because there is no respond to this issue since my last posting, in which I explained how the at2 function is used in PowerPoint, I assume your problem is solved.

     

    Thanks, Vilmos

    Wednesday, December 28, 2011 8:02 PM
  • Thanks for the reply Vilmos,

    I will try to make use of this in my app. If stuck anywhere will get back to you.

     

    -Sucheta

    Tuesday, January 10, 2012 11:53 AM