Open fukuchi opened 12 years ago
This is something I have been thinking about as well, although my initial plan was to add the original text as comment (in SVG as well). Using a title tag would definitely make more sense though.
For SVG, one could resort to plopping the thing in a CDATA: the only care that needs to be taken then is that the (unlikely) sequence ]]>
must be split across two CDATA sections, which is very easy to do. The only thing that should be ensured is that the character encoding of the XML is set correctly (so, shift_jis
or iso-8859-1
as appropriate).
For EPS, the text would need to go in some comment, so the only escaping that would be needed is that of newlines, probably, although I' d have to refresh my knowledge of EPS and the DSC to be sure about that.
For PNG with arbitrary data, one could encode the thing with base64 before stuffing it in a text chunk if it contains anything that is not a printable latin1 character.
I'll see if I can cook up something for the SVG part. EDIT: I've started working on the feature in my embed-intext branch.
David Dahl suggests:
While I like this suggestion, the implementation seems to be not simple: 1) How to embed binary (8-bit) data? 2) Embedding text data to SVG/EPS may require sanitizing.
Your comments are welcome.