View Single Post
Old 01-29-2016, 07:48 PM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,625
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Svg wrapper with a caption text field

Hi

A brand new plugin allows us to create svg wrappers with Sigil. It's the same technique as the one used by Calibre for cover pages. However as it applies for any image we may find in the text, one naturally thinks as to how make it work with a caption.

This question is about how to insert (integrate?) inside a svg wrapper a text field containing a caption so as the two fit together in the same page.

Rationale

When one adds images to one EPUB, many of them have captions. and it has always been tricky to find the right balance and be confident that the caption will be included with the image in the displayed page.

The current situation is not a happy one: some trust the engine (height: auto, width:auto), some trust the CSS (max-width... and/or page-break-inside: avoid), some others make deep calculations (width:63.5%; ) others even insert the image and its caption in a two cells frame, what is sure is that everybody is praying God.

If a svg all-in-one solution could be found, there would be a good chance that the bundle (image + caption) would stay together. That would be a big step forward for humanity.

I tried to fiddle a little with the code. One should maybe add something like that somewhere, maybe by tweaking the viewbox to add a kind of lower stripe?

Code:
<text text-anchor="middle" x="50%" y="40" style="fill:black; font-size:25px; font-family:serif;font-style:italic;">Caption</text>
Could some expert try to find a solution of this kind? Once we have the code, it should not be too complicated to go from one standard svg image to another with caption.

Please find enclosed an EPUB2 test file with two images of very different size (without caption!) to play with.
Attached Files
File Type: epub test_svg.epub (1,006.4 KB, 266 views)

Last edited by roger64; 01-29-2016 at 08:47 PM.
roger64 is offline   Reply With Quote