It would be very useful if an image could be embedded into a Leo body.  
Probably no one would want to do this in a program or script, but for 
documentation it could be very helpful.  You can put an image into a ReST, 
MD, or Asciidoc node and view it with VR3 or by creating Sphinx output.  
But even better would be to have an image in an ordinary text page.

In theory it should be possible to put an image into a Leo node.  Qt has a 
way to do it, and I have written a little test Qt program that can put one 
into a QTextBrowser or a QTextEdit widget at the cursor location.

The way Qt does it is to insert a special Unicode character:

"Inline images are represented by a Unicode value U+FFFC (OBJECT 
REPLACEMENT CHARACTER) which has an associated QTextImageFormat."

I *think* that Qt converts an image file to a data: url and stores it in 
that character.  Aside from the issue of how to implement commands to let a 
user work with an image (have text reflow around it, delete it, etc), there 
is the question of how to save and restore the image  data along with the 
rest of the outline.

One possibility is that saving the file will simply include the data: url's 
data (which would be encoded as base64, so it should not be a problem to 
save), and the file load will simply restore it with no extra effort.  This 
is probably too much to hope for.

If that turns out not to happen, maybe it would not be too hard to save the 
data as a UA, and restore it from the UA.  The problem, I think, is to get 
the data into that special character in the right place.  Another 
possibility would be to write Leo code to restore the image from the 
original image file.  That sounds harder to me, but I'm not sure.  It would 
be better not to have to depend on an external image file if possible.

I'm very interested in this, and I hope we can have a good discussion about 
it!

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/7723eb4d-8495-4107-8c6a-dd79180479a7n%40googlegroups.com.

Reply via email to