Regarding the serialization of Spiro control points
by Fred Brennan
Greetings,
I write from the FontForge project. Of particular interest to me is the Spiro
spline feature, which was originated around ten years ago by Raph Levien.
One thing I'd like to add, (which would benefit both our projects,) is the
ability of FontForge to understand the Inkscape Spiro serialization format.
However, there are several things about the format which to me as an outsider
appear to be defects serious enough that I have no idea how to even *import*
these splines correctly, much less export our Spiro splines to this format. I
would very much like to support the _de facto_ standard Inkscape has
originated of supporting Spiro in SVG, but I am lost.
George Williams, FontForge's original author, noticed this defect over eleven
years ago.[1] Things are virtually unchanged since then, I checked `git
blame`.
Spiro has five point types, not including beginning and ending points. They
are:
* G4 curve (o)
* G2 curve (c)
* Corner (v)
* Left Constraint ([)
* Right Constraint (])
The ASCII single letters are the normal method of Spiro serialization, as
championed by Raph Levien and by us in FontForge.
Inkscape seems to create what I will call a "pseudo-SVG path". So, it is not
really an SVG path, but rather is an SVG path which undergoes transformation
into the typical Spiro format. Inkscape stores this in the "original-d"
attribute.
So, given a Bezier spline with control points defined as (x, y, c1, c2),
Inkscape interprets a control point with only (x, y) to be a corner, meanwhile
a control point with all four is a G4 curve, and (x, y, c1, NULL) is a left
constraint while (x, y, NULL, c2) is a right constraint.
I can probably overcome this, although George Williams was right to be
skeptical of this format. There is no way I can see to define a G2 curve in
this strange "original-d" format.
Thus, this email. I write to ask a few things. I suppose first of all, what
are the chances that we can convince you guys to store Spiro splines in
plate[2] format, or another widely accepted Spiro serialization format?
Second, if we cannot convince you to do that, how do I export FontForge spiros
which contain G2 control points to Inkscape's original-d format? It's not
possible, yes? So should I just silently fail and save them as G4? The curves
will not be the same if I do that. Should I disallow export to SVG w/Spiro if
glyph contains G2 control point? That seems a steep cost that will just
confuse my users, so perhaps I should abandon the whole thing if it comes to
that.
Cordial regards,
Fredrick Brennan (@ctrlcctrlv)
[1]: https://narkive.com/63FADpG3.4
[2]: https://levien.com/garden/ppedit/README, section "Plate files"
1 year, 8 months
openswatchbook hijacked
by Nozz
Hi,
when saving svg in inkscape 1.0.1, the file contains a link to openswatchbook dot org and that website appears to have been hijacked and is serving porn and possibly malware.
I'm new to inkscape so I was curious what that address is about and why it's in the generated svg file. If you could explain why a svg file needs url links in the first place I would love to know.
I don't know what relationship inkscape has with that website but you should contact whoever you think is the original owner and let them know of the situation.
Best regards
2 years, 12 months
finally, finished using boolean operators
by NASA Jeff
finally, i finished off by trimming the lhsf eyebrow to the face using
boolean operations.
I couldn't seem to get them to work how I wanted, to trim the eyebrow
bit. And selection order didn't seem to change the precedence in the
boolean operation.
In the end I ended up doing a copy and paste replacing the face, then
a copy of the eyebrow with no paste, then the boolean operation
between the eyebrow and one face copy, then paste from the eyebrow
copy the style (opacity/blur didn't seem to copy, just the colour, not
sure it stroke styles copied or not), then deleted the original
eyebrow. And renamed everything correctly again using the XML editor.
I noticed you can't do a multiple select in the XML editor, only
select a single element.
So, I think I'll raise three bugs from this, boolean operation
precedence, style paste not pasting blur and transparency and maybe
stroke styles etc.. and inability to select multiple shapes/groups via
the XML editor dialogue.
I'll leave the snapping as an enhancement to look into and not raise
as a bug as the enhancement I suggested may be best as a different
snap modulator.
3 years
path snap
by NASA Jeff
As I mentioned in my last email, I found snap to path, but it didn't
work that great. It seemed to fit curve to a curve well some of the
time and didn't seem to snap vertices to the path curve.
What would be great is if it could snap a curve to a curve all of the
time by inserting vertices as needed to make the snap happen.
I'm also going to play around with grow and shrink, to see if that's a
better option for multilayer hair, that just adjusting the paths
manually.
There would still be some alignment of paths between objects with
higher/lower z-orders needed and it still wouldn't solve the eyebrow
problem.
I may end up just doing a boolean operation.
3 years
found path snap
by NASA Jeff
I found path snap and it worked okish, though not that great.
An example of where matching two paths is required because you can't
just use z-order and have a blob underneath is the eyebrow, where I
have a semi transparent top layer for the hair and an opaque
background that has to be beneath or fit the face and above or fit the
eyebrow.
https://imgur.com/4oHHL6Z
3 years
simple edge detection of a bitmap
by NASA Jeff
I can't remember exactly how to do an edge detection mask for a bitmap
but it's something like
0 -1 0
-1 0 -1
0 -1 0
as a matrix applied to the bitmap,
this has issues with jpeg compression though as you get square
artefacts from the lossy-ness of the compression, soi it may be an
idea to detect the compression window for the jpeg image and use that
to scale the matrix.
I believe jpeg compression is more or less just an inverse fast
Fourier transform.
3 years
Here's the image I've drawn
by NASA Jeff
https://svgshare.com/i/RUo.svg
Some curves I've hand fitted to each other and some I've just relied
on z-order with a cruder edge for the lower shape.
I'm not sure how well relying on using z-order to account for matching
detail of the edges of paths would work if we wanted to animate the
shapes. e.g. make the dress and hair move as if the wind was blowing..
Incidentally, this svg renders funny in chrome, I've added some
blurred, semi-transparent detail on a higher z-order than the base
image but it's not showing...
Here's a png exported from inkscape..
https://imgur.com/j8mDI6b
3 years
slightly more advanced
by NASA Jeff
Something slightly more advanced would be being able to take the
pattern from the traced portion of an underlying image.
So lets say I trace a sofa and I want to take the pattern from the
material of the sofa and use it to fill my vector shape.
Even more advanced is that the possibility to extract the shading from
an underlying image and turn it into fill gradients may become
possible once a uniform texture is extracted from the material.
3 years
snapping to lines &co.
by NASA Jeff
I've just been hand tracing a jpg image someone asked me to turn into a drawing.
Here are my notes on the process:
When moving points they need to be able to snap to points on the curve
of lines of other shapes, maybe controlled by being in the same group.
Smoothing worked quite well, it would be nice if there were some
option to do it to the contours of an image either,
Fitting when smoothing,
Snapping curves to to an underlying image when editing a curve over an
image, could be controlled by layers and opacity etc..
Another feature that would be nice is to snap one part of a path to
another part of a path, breaking segments where necessasasary.
So say you have two hand drawn paths, where some segments of one are
close to or partly overlap the some of the segments of the other path.
An option to fit the two segment sets of the path that are close to
each other would be nice.
I expect I can prototype some of this.
3 years