![]() |
#1 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,749
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
images and captions
What's the best way to keep a caption with an image such that the caption never ends up on another screen from the image?
|
![]() |
![]() |
![]() |
#2 |
Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
If I needed to do that, I'd probably draw the bitmap and the caption text using SVG in a single "image", and then use the usual techniques for scaling the SVG image up to the size of the screen.
Caveat: With this approach, you probably must include at least one embedded font and use it for all your captions if you want the rendering to be even halfway consistent across readers. I mean, there are ways to embed arbitrary blobs of HTML in SVG, which could in theory allow you to let the reader determine the sizing and style, but IIRC, that feature isn't very well supported. |
![]() |
![]() |
![]() |
#3 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,749
Karma: 145864619
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I don't need it to be consistent. I just need it to drop both the image and the caption yto the next screen if the both don't fit in the space left on the screen. I'm hoping to find a way that's not having to use SVG to draw the caption. I want the caption to be in whatever the body font is.
|
![]() |
![]() |
![]() |
#4 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Easy:
Code:
<div style="page-break-inside: avoid"> <img src="snowball.jpg" alt=""/> <p>A cool image</p> </div> ![]() Since I'm afraid ADE and relatives don't obey "page-break-inside", dgatwood's suggestion is probably the best that you can expect. Personally, I code it as I showed, I don't like to use workarounds for specific software bugs and limitations. (I'm still hoping for a decently compliant reader some time in the future.) |
![]() |
![]() |
![]() |
#5 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,764
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
https://www.mobileread.com/forums/sho...92&postcount=4 The caption will be in the main font (also you could use a custom font if you embed it). In that post I don't set a font-size but is possible to do it. Regards |
|
![]() |
![]() |
![]() |
#6 | ||
Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Quote:
![]() Quote:
I suppose you could remove the viewBox so that everything gets sized to the largest thing in the SVG image (which might be the text), but I'm not sure what other problems that could cause. I'm not saying it won't work if you don't specify an explicit font and size, but in the back of my head, it sets off warning bells. Last edited by dgatwood; 04-04-2015 at 05:31 PM. |
||
![]() |
![]() |
![]() |
#7 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,764
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
3.6.10 Image Guideline #10: Displaying Text Correctly within SVG To display text correctly within an SVG, use the font-size attribute for <text> inside the SVG. Example <html> <body> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <text x="20" y="20" font-size="20" fill="red">svg text sample</text> </svg> </body> </html> Regards Rubén Last edited by RbnJrg; 04-05-2015 at 05:54 AM. |
|
![]() |
![]() |
![]() |
#8 |
Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
I think you missed my point. You can't guarantee what fonts are going to be available on the device, and different fonts render at different sizes. And when you're printing those fonts into a fixed-size box, the odds of them getting clipped are pretty good.
|
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,764
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
https://www.mobileread.com/forums/sho...36&postcount=4 Again, this method only works for Kindle with support for .kf8. Regards Rubén |
|
![]() |
![]() |
![]() |
#10 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
But this is the ePub forum, so Kindle (and iPad, if you mean iBooks) are secondary
![]() |
![]() |
![]() |
![]() |
#11 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,764
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Quote:
![]() |
||
![]() |
![]() |
![]() |
#12 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
|
![]() |
![]() |
![]() |
#13 | |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
Quote:
If the image size is greater that what the screen can accommodate what happens depends entirely on the Reader. It may work with widow/orphan attributes (again provided the physical size allows it), of course where supported. Or one can make a floating block with display: inline-block eg in a div comprising both items. Again, where it is supported. |
|
![]() |
![]() |
![]() |
#14 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,549
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Yes, the difference is page-break-inside is a required property, and inline-block isn't. Readers that don't support the former are non-compliant, those that don't support the latter are probably non-compliant too, but for other reasons. However, it's probably more likely to find support for inline-block, so maybe one should try this.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cracked.com: Missing images and small image captions | damien18 | Recipes | 4 | 11-30-2014 11:14 PM |
Best way to format images and captions in EPUB | silviolorusso | ePub | 6 | 05-03-2013 07:51 AM |
Epubs: keeping images and captions together | verydeepwater | ePub | 13 | 12-02-2012 04:33 PM |
Images and captions in epub | Balaji | Workshop | 3 | 08-19-2011 08:00 AM |
captions and images together | detede | Apple Devices | 11 | 06-14-2010 09:00 PM |