4 ms·
A subset of SVG with just basic lines and shapes is fairly simple, and in fact is very similar to what OP is doing. It's only when you go into colours, fonts,
by ainar-g 4y ago
A subset of SVG with just basic lines and shapes is fairly simple, and in fact is very similar to what OP is doing. It's only when you go into colours, fonts, animations, and stuff like that stuff gets progressively more complex.
- cal85 4y agoI've often just wanted a "simple SVG" subset with just basics, as you describe, omitting all the fancy stuff that tends to lead to surprises and incompatibilities. For example, as the format for a very simple icon editor. Do you know if there is some formal way to 'declare' such a subset (something to do with XML/namespaces maybe?), or if there's any existing standard "simple SVG" format that someone has already defined? Obviously I could just informally stick to a subset by avoiding whatever features I don't want to use, but I think it would be useful to have a formally defined subset, and to be able to scan an SVG to detect if it's within the subset or not.
- ainar-g 4y agoThere's the SVG Tiny profile[1] which was created back in the day for the low-power mobile devices. Seems like a good start! [1]: https://www.w3.org/TR/SVGTiny/ https://www.w3.org/TR/SVGTiny/
- aendruk 4y agoAnd for a real world example of this see BIMI logo images.
- cal85 4y agoTried googling but can't find what you are referring to. Got a link?
- aendruk 4y agoBrand Indicators for Message Identification, part anti-phishing feature, part marketing gimmick. Essentially favicons for email. The Wikipedia article does the best job of summarizing it without marketing industry fluff: https://en.wikipedia.org/wiki/Brand_Indicators_for_Message_Identification https://en.wikipedia.org/wiki/Brand_Indicators_for_Message_I...
- deleted 4y ago[deleted]
- Athas 4y agoBut then it might easily become unclear exactly which subset of SVG is supported. I am personally leery of implementing subsets of other formats. I find it better to define entirely new formats, at least for simple things like this. To render this "lines" format, you could of course easily write a translator that turns it into SVG. It's mostly the other direction that I would be hesitant about.
- bestest 4y agoWhy would you want implement a subset of SVG? It's native for browsers, and is surely supported in a plethora of languages using various libraries.
- aidos 4y agoHmmm. There actually a lot to it and you don’t want to end up in a situation where documents don’t render properly unless you’re using a really complete viewer.
- cxcorp 4y agoBecause standards compliant SVG introduces XSS surfaces.
- badsectoracula 4y agoNow you replaced a trivial file format that (from a quick glance at the code) needed about ~35 of easily readable and self-contained Lua code to parse with an external dependency that would be much larger and harder to follow and either having (at least) an XML parser as its own dependency or implementing its own XML parsing, as well as being at the mercy of their developers. Also unless you are using some highly popular library, you may end up with some abandoned dependency. Examples of both are at [0] (C++ based parser, you'd also need to write some bindings for lua) and [1] (Lua based parser for a subset of the format, abandoned for almost a decade). There are times when using an external dependency might be a good idea, but a text-based file format that describes lines and can be implemented in a few lines of code is not one. [0] https://github.com/svgpp/svgpp https://github.com/svgpp/svgpp [1] https://github.com/luapower/svg_parser https://github.com/luapower/svg_parser