SVG passthrough precision
bjango.com
bjango.com
If you're comfortable with outline view, that is a good way of speeding things up. However, for drawing it's a lot easier to rely on a raster sketch and then to trace the result in Inkscape either with the fill bucket or using the technical drawing and tweak tools. As of right now my experiences suggest that it's in a state where direct content creation can be really awkward, but it's very good for tracing and finishing images.
Bravo for phrasing that neutrally, because I see at least 4 ways to export SVGs, and I have no idea what Adobe actually wants you to use, because I increasingly think Adobe hates you.
1. Export for Screens… (which is what I generally use)
2. Export As…
3. The Asset Export panel.
4. Save As…
The first 3 all use the same export engine (or at least I think they do), but they all expose the settings in different locations. And then there is Save As… which tends to mangle things, as described in the article, and also lets you save as SVGZ, which is supposedly compressed, but it’s not.
This is probably pretty tongue in cheek, but this may be anecdotally more true than you think. I once had the privilege of being part of an Adobe Creative Cloud user research/focus group. It was appalling. They were very defensive of their product and even hostile towards certain kinds of feedback. It very much diminished my faith in Adobe as a company. At the time I just sort of shrugged it off because in many ways there just simply was no viable professional alternative, but I feel like this is increasingly not the case. In a way I think their chickens may be coming home to roost.
> "Black is the default shape colour for SVGs, so the fill attribute can be omitted entirely, as per the source SVG."
This isn't entirely true, as there's a specificity difference between having the attribute and not having it. I'm not sure which is the "right" approach though for a design tool. If this were purely a svg command line tool, I'd expect there to be no additional metadata, but considering this is the export from a design tool, I'm not sure what the right approach is. When you export something you often want it to look exactly as it is on the canvas, not to dynamically change color if there's a `fill` css declaration somewhere up the chain. Both Sketch and Figma* look like they've made the decision to go with consistency of visuals rather than consistency of meaning.
Very impressed with Sketch here in how accurately it preserves the precision, but disappointed it's exporting with non-unique IDs. Illustrator feels like it's doing a very Adobe thing - two different ways of doing something in the app results in either the best output or the worst output. Figma I'm disappointed transforms the rects into paths. This feels like it's optimizing for the general case rather than what the best output might be. I'll lump XD into the same category here with their transform hack for positioning. Not a fan of either.
* Disclaimer: I work for Figma.
I work on the design system features (components / variants / libraries / etc). Hit me up if you have any feedback! Happy to route it to the right people.
Try putting the input values into e.g. https://www.h-schmidt.net/FloatConverter/IEEE754.html - the outputs are just the closest representable float numbers (converted back to a reasonable base-10 representation).
The awesome SVG Optimizer [1] has a filter (cleanupNumericValues) to process SVG files to a fixed precision.
The equally awesome SVG Optimizer Missing Gui (SVGOMG) [2] provides a web-based GUI [3] to interactively adjust precision and see the resulting render (and file-size).
[1] https://github.com/svg/svgo
The only way to avoid doing that losslessly is to track the original text that you parsed into your IR nodes, which is a bit expensive if you think about it. A double is 64 bits, most shape/path data is packed and dense lists of doubles. Interleaving strings or ids that can be used to track them can be really annoying to thread through your program without performance or memory issues.
(Note that if you want to serve the SVG file, you should still "export as SVG" it, since Inkscape embeds a lot of semi-sensitive informations into the SVG like file path etc.)
I make a rough draft of the icon in Figma or Affinity then export it and do the rest by hand and it can never be viewed in a visual editor again. Our design tools have failed us at providing good tooling for web and product work.
Inkscape is very much an "SVG editor" and largely preserves what you have. I think most if these other tools are general design tools with SVG output which means that you don't expect much correlation to the input.
(Baudrillard would say that anybody using the word "real" is trying to bind you with illusion and like a wolf that craps on a trap to protect the pack he crapped on that word pretty bad!)
In a case like that it should "snap-to-grid" on the last decimal place of the number that's being edited, maybe the grid should even be displayed on the screen. That grid might be rotated or skewed because of coordinate transforms, and there ought to be some way to add another digit worth of fineness if not a factor of 2 or 5.
You can easily sidestep problems with errors of calculation (which includes already parsing decimal floats into binary floats, and happens here also with addition) by keeping the error smaller than what you care about: Read in as double precision float and use double for calculation, convert back to single precision before converting to decimal floating point. The error you will do in double precision will be smaller than what you loose converting to single precision. You can use that for SVG path optimization where you will run across 0.1+0.2!=0.3 problems.
If you really want exact measurements, then you would want fractional numbers, so you can also cut lengths in e.g. three precisely.
https://www.crockford.com/dec64.html
IMHO it would be nice to see it used in larger-integer-presenting domains: with some limitations, accounting; interpreters where you want 0.1 + 0.2 == 0.3; anywhere there are measurements with units, and factor-of-ten scaling of finite digits is helpful; anywhere you want the simplicity of a single number-type and number-builder; possibly where you want to reserve some exponents for giving language keywords orthogonal number representations.