svglibreofficeodp

Open document format: meaning of "G" command in drawooo:enhanced-path attribute


I'm writing converter from .odp to .html with some cutomized formatting. I represent elements as with path in it. Everything works until there is "drawooo:enhanced-path" attribute, like: <draw:enhanced-geometry draw:mirror-horizontal="false" draw:mirror-vertical="false" draw:text-areas="?f5 ?f5 ?f6 ?f7" svg:viewBox="0 0 0 0" draw:type="ooxml-roundRect" draw:modifiers="16667" draw:enhanced-path="M 0 ?f2 L ?f3 0 L ?f11 ?f4 L ?f2 ?f10 Z N" drawooo:enhanced-path="M 0 ?f2 G ?f2 ?f2 ?f12 ?f13 L ?f3 0 G ?f2 ?f2 ?f14 ?f15 L ?f11 ?f4 G ?f2 ?f2 ?f16 ?f17 L ?f2 ?f10 G ?f2 ?f2 ?f18 ?f19 Z N">

What causes problems is "G" command, which is not supported inside svg path's "d" attribute.

When I converted the presentation by libreoffice command to .svg, it produced this element: <path fill="rgb(0,0,0)" stroke="none" d="M 2468,2780 L 2468,2780 2469,2745 2472,2710 2476,2675 2483,2641 2491,2607 2501,2573 2513,2540 2526,2507 2541,2476 2558,2445 2576,2415 2596,2386 2617,2358 2640,2332 2664,2306 2690,2282 2716,2259 2744,2238 2773,2218 2803,2200 2834,2183 2865,2168 2898,2155 2931,2143 2965,2133 2999,2125 3033,2118 3068,2114 3103,2111 3138,2110 7934,2110 7934,2110 7969,2111 8004,2114 8039,2118 8073,2125 8107,2133 8141,2143 8174,2155 8207,2168 8238,2183 8269,2200 8299,2218 8328,2238 8356,2259 8382,2282 8408,2306 8432,2332 8455,2358 8476,2386 8496,2415 8514,2445 8531,2476 8546,2507 8559,2540 8571,2573 8581,2607 8589,2641 8596,2675 8600,2710 8603,2745 8604,2780 8605,5460 8605,5460 8604,5495 8601,5530 8597,5565 8590,5599 8582,5633 8572,5667 8560,5700 8547,5733 8532,5764 8515,5795 8497,5825 8477,5854 8456,5882 8433,5908 8409,5934 8383,5958 8357,5981 8329,6002 8300,6022 8270,6040 8239,6057 8208,6072 8175,6085 8142,6097 8108,6107 8074,6115 8040,6122 8005,6126 7970,6129 7935,6130 3138,6131 3138,6131 3103,6130 3068,6127 3033,6123 2999,6116 2965,6108 2931,6098 2898,6086 2865,6073 2834,6058 2803,6041 2773,6023 2744,6003 2716,5982 2690,5959 2664,5935 2640,5909 2617,5883 2596,5855 2576,5826 2558,5796 2541,5765 2526,5734 2513,5701 2501,5668 2491,5634 2483,5600 2476,5566 2472,5531 2469,5496 2468,5461 2468,2780 Z M 2468,2110 L 2468,2110 Z M 8605,6131 L 8605,6131 Z"/>

Just to illustrate how the final shape is affected by ignoring the "G", see a comparison.

I would like to do a similar conversion, but I cannot find any specification of "G" command anywhere on the internet.

Can you please point me to some specification of it, or better, to some library already doing some kind of conversion?


Solution

  • From ximpcustomshape.cxx in the LibreOffice source code:

    case 'G' :
    {
        nLatestSegmentCommand = css::drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO;
        nParametersNeeded = 2;
        nIndex++;
    }
    

    This leads us to EnhancedCustomShape2d.cxx which contains the following:

    OSL_TRACE("ARCANGLETO scale: %f x %f angles: %f, %f", fWR, fHR, fStartAngle, fSwingAngle);
    

    Apparently the G command takes two pairs of floating point parameters: (fWR, fHR) and (fStartAngle, fSwingAngle).