Path XML - M changed to m in the definition?

Discuss SVG code, accessible via the XML Editor.
indy2005
Posts: 11
Joined: Wed Apr 07, 2010 5:01 am

Path XML - M changed to m in the definition?

Postby indy2005 » Sun Aug 29, 2010 9:35 pm

Hi,

I am using an XML parser to create Box2D bodies from XML files. The parser doesnt support the "m" tag for paths, just "M". In Inkscape 0.48, just moving paths around changes the original upper case M to an m and so breaks the parsing. Also, creating new beziers, always creates a lowercase m and not the uppercase M which my parser supports. I cant change the lowercase m to an M, Inkscape defaults it back.

Can I ask, has anything changed in terms of the way paths are defined? Whats the difference between the lower and upper case "m"?

For example, this was working fine

M -145,465 769,-6 -18,-878 -810,7 59,877 z

but now just moving it around it becomes

m -145,465 769,-6 -18,-878 -810,7 59,877 z

and the parser breaks.

Regards


i

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Path XML - M changed to m in the definition?

Postby ~suv » Sun Aug 29, 2010 9:52 pm

indy2005 wrote:Can I ask, has anything changed in terms of the way paths are defined? Whats the difference between the lower and upper case "m"?

There was a change in Inkscape 0.47 to default to writing optimized path data if possible:
Release notes 0.47 > Optimized path data

More details about the difference between absolute and relative commands:
SVG 1.1 Specification > Paths > Path data

You can change the settings (to pre-0.47 behavior) in
Inkscape Preferences > SVG Output > Path data:
    [ ] Allow relative coordinates
    [x] Force repeat commands

indy2005
Posts: 11
Joined: Wed Apr 07, 2010 5:01 am

Re: Path XML - M changed to m in the definition?

Postby indy2005 » Sun Aug 29, 2010 10:54 pm

Thanks, really helpful.

Can I ask, if things have reverted back to relative, and then you change the references - do all existing paths change, or do you need to redefine them once the option to force repeats has been set?

Regards

i

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Path XML - M changed to m in the definition?

Postby ~suv » Sun Aug 29, 2010 11:01 pm

indy2005 wrote:Can I ask, if things have reverted back to relative, and then you change the references - do all existing paths change, or do you need to redefine them once the option to force repeats has been set?

After changing the preferences, you have to trigger Inkscape to rewrite the path data e.g. by selecting the objects and moving them with the cursor keys - one tick up and one back down. IIRC this works on groups as well, but you better verify yourself (you can see the changes live-updating in 'Edit > XML Editor…') - else enter the group with a double-click, select all (Ctrl+A) and move the selection a step up and back down again.

Example:

Code: Select all

m 300,100 c -100,50 -100,50 -200,0 100,-50 100,-50 200,0 z
Change preferences (no relative coordinates), select path and move it one step up and back down:

Code: Select all

M 300,100 C 200,150 200,150 100,100 200,50 200,50 300,100 z
Change preferences (force repeat commands), select path and move it one step up and back down:

Code: Select all

M 300,100 C 200,150 200,150 100,100 C 200,50 200,50 300,100 z

indy2005
Posts: 11
Joined: Wed Apr 07, 2010 5:01 am

Re: Path XML - M changed to m in the definition?

Postby indy2005 » Sun Aug 29, 2010 11:12 pm

Thanks for the very quick response


Return to “SVG / XML Code”