by nologic01 · 3y ago · 0 comments
> a two-dimensional representation to utilize the integrative capabilities of the human visual cortex
into:
SVG is a re-usable two-dimensional representation of data to utilize the integrative capabilities of the human visual cortex.
In a sense canvas, png/jpg etc are to SVG what PDF is to HTML. An information black hole.
As an example of the information-retaining quality of SVG representations you could fairly easily imagine the reverse operation: SVG Images TO Postgres.
SVG is an over-romanticised format.
Support for logic makes it a major XSS vector, XML makes it inefficient, and the path langage makes it unreadable.
at least this part seems over-the top criticism :-)
Anything that can capture free-form graphical information will be unreadable. You could represent paths with points but that would make it more inefficient.
The thing to keep in mind too is that because it fell out of favor the standard has not really evolved.
Individually the XML and the path format are “fine”, the problem is that they’re both in the same file format.
> Anything that can capture free-form graphical information will be unreadable.
It’s not the question of being freeform, it’s the weird-ass single-letter command names in an attribute string.
In an XML document which is otherwise self-descripting.
> In an XML document which is otherwise self-descripting.
This is an odd plaint. M/m is for move, L/l is for line-to, C/c is for curve-to, V/v and H/h are for vertical and horizontal lines respectively, and svgo might throw some 's' curves in there. It's the best of both worlds, giving excellent compression while remaining human readable enough for a novice to manipulate geometry by just messing about.
Here is a mostly compatible alternative: https://tinyvg.tech/
Tiny disagreement: PDF isn't necessarily an information black hole compared to HTML. PDF is a structured format, not quite plaintext, yet not quite binary either. It can preserve original text and formatting metadata. It's the publishing tools that often (these days less so than in the past) pre-rasterize data, storing bitmaps instead of original text inside the PDF.
The nice thing PDF has going over HTML is fixing the layout. This is not desirable for most content of actual value (i.e. not glorified marketing brochures that half of the web is these days), but sometimes it is useful.
These days, SVG could probably be used as plaintext PDF replacement (maybe with some extensions for pagination, and other print-related metadata), though I bet some people would still opt to "render" SVGs using embedded data-url/base64 images instead of text + metadata...
this applies to SVG at low level as well (path data break with the semantically annotated pattern of higher level constructs). It is in some sense unavoidable / desirable to be able to include such numerical data intensive blobs.
Where PDF (and its broader ecosystem) blundered is that it feels it would be rather low cost to maintain logic and metadata that would make re-usability of document information much easier.
Of-course we talk with hindsight etc.
Can SVGs embed fonts? PDFs that don't embed fonts tend to have issues with rendering.
I actually did this several years ago!
I ended up collecting the floorplan/layout for most of Australia's largest shopping centres by scraping the SVGs from the interactive maps on their websites. I parsed the coordinates they contained — the location/size of individual shops, ingress/egress points, ATMs, etc — as Well-Known Text and stored them as native geometry data types in PostgreSQL.
The shopping centres were even kind enough to leave labels and metadata embedded as attributes in the SVG. Bless.
PDF is also an under-appreciated graphics format. It can be a mere container for more primitive data, but a PDF can do a lot more, way more than HTML (I mean, Postscript is Turing complete on its own)