svgtoipe: Support for Arrowtips
I've hacked together code for parsing and writing arrows in svg files. See this commit in my svg-markers branch.
Collecting and writing marker/arrow definitions seems to work. Still I am doing something wrong, as the arrows won't show when loaded with ipe release 7.2.6.
svgtoipe doesn't use the new stylesheet format. But as I understand it, the following fragments should suffice to produce arrowed paths
Within styesheets define the symbol:
<ipestyle> <symbol name="Arrow1Lend" xform="yes"> <path matrix="-0.8 0 0 -0.8 -10 0" stroke="0 0 0" filltest-markers="0 0 0" pen="1"> 0 0 m 5 -5 l -12.5 0 l 5 5 l h </path> </symbol> <ipestyle>
And later in the document use those symbol:
<path stroke="black" arror="Arrow1Lend" rarror="Arrow1Lend"> 81 130 m 120 130 l </path>
Could you help me to clarify that issue?
Have a look at this thread: http://lists.science.uu.nl/pipermail/ipe-discuss/2016-June/001807.html
-
The symbol must have a name of the form "arrow/xyz(spx)".
xyzwill then be the name to use in the path object to use this arrow. -
Do not use
xform="yes". -
You probably want to use
sym-strokeandsym-penin the arrow definition to make the arrow color and line width depend on the path settings.
Here is a modified definition:
<symbol name="arrow/Arrow1Lend(spx)">
<path matrix="-0.08 0 0 -0.08 0 0" stroke="sym-stroke" fill="sym-stroke" pen="1">
0 0 m
5 -5 l
-12.5 0 l
5 5 l
h
</path>
</symbol>
You can then use this from a path like this:
<path stroke="black" arrow="Arrow1Lend/normal" rarrow="Arrow1Lend/normal">
81 130 m
120 130 l
</path>
For your marker, the name of the symbol must be of the form "mark/xyz(sx)" where xyz will be the name of the marker. Do not use xform="yes". Have a look at the definitions in basic.isy for some examples.
Thanks for the help. My plan to add the following stylesheets in the converted ipe file:
- one
<ipestyle/>for a copy of basic.isy - one for the page dimensions
- one for other
svgdefined stuff
Would you'd rather have a straight string copy, or a semi-copy with values, for ocupacity, and colors generated by the svgtoipe?
Another option would be to lookup and read basic.isy from the system path. Do you think it is worth the trouble?
Svgtoipe currently does not include basic.isy at all, since all attributes are either absolute or taken from the SVG. Why exactly to you want to change this?
Separating page dimensions from other SVG definitions sounds like a good idea to me.
If you want to include the standard basic.isy, you should not modify it---it will be overwritten if the user ever executes Update stylesheets. You should put basic.isy at the bottom of the stylesheet cascade, and let another sheet with the SVG definitions override it.
You should certainly not add a copy of basic.isy to svgtoipe.py - that's inelegant, and it's quite likely to change in the future. Either you need to read it from the system, or include a dummy version like this:
<ipestyle name="basic">
</ipestyle>
Then the user can press Shift+Ctrl+U in Ipe after opening the file to replace this by the real basic.isy.
(annotate.py uses this trick, but then runs ipescript update-style.)