A proposal with captions
Testing
I asked for advice on
this thread. I got nearly instantly quite concrete answers. Please find enclosed two EPUBs, each with two images of a very different file size with a caption which make use of this rich information. They are just examples and a base for discussion. All the mistakes here are mine.
As you will see there are two slightly different techniques. While the code is basically the same, the first one makes use of a view box about the size of the image. The second one makes use of a standard 600x800 view box. For both, the images are untouched and the display looks good and reliable.
Personally, I would go for the second solution (bacelar) because it looks more easy to implement for a batch treatment. You can easily define some fixed bundles according to the number of lines needed for the caption and/or the font-size. I gave an example with a one line and four lines caption for two images of a very different size.
For the first solution however, things seem to be more complicated: the needed font-size varies according to the image definition, so you need to check it for each new image. For this reason too, you can obtain a uniform font-size for the captions through the book only if the images have strictly the same size.
On the technical side, I can't say if there is a drawback to any of them. They both take care of azw3 conversion while being Epubcheck compliant. However, as Toxaris remarked, it is possible that some readers with old machines experience font-display problems (no centering?). An EPUB3 version will soon be needed (with a new Doctype and a properties="svg" attribute) but it does not seem it will require a lot of changes.
Proposal
While it's not possible to match the flexibility of CSS, a reasonable choice could be to offer
five different bundles. One could imagine (dream?) a new menu with a matrix where the user would select a number for each image. He should also have the possibility to select a column (all images) as a whole as images in the same book tend to use the same kind of caption.
- 1 without any txt (like now). Maybe this could be selected by default.
- 2 and 3 with short caption (up to two text lines) with average (24?) and smaller (20?) font-sizes.
- 4 and 5 with a longer caption (up to five text lines) with average and smaller font sizes.
One could simplify this to
three bundles:
- 1 like today
- 2 short caption - average font-size
- 3 longer caption - smaller font-size
- If one needs over five lines of text, he would have to split fastidiously the intended caption paragraph. Maybe this would not be the most practical method.
- If one wishes a different font-weight or font-style, he can use a plain regex to change them.
- If one wishes to add its own style-sheet link in the head, idem.
An alternative idea would be to let the user select a font-size and number of text-lines but it would require probably more processing.