06-20-2022, 09:16 PM | #1 |
Wizard
Posts: 1,094
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
<svg><text>
epub v3.0
Reference... https://developer.mozilla.org/en-US/...Tutorial/Texts I am attempting to add an image and a note underneath the image. If I used a simple <img> tag, the note ends up on the next page, even though there is enough space on the page for the text I am now trying to use the <svg> with a <text> field, but I can't seem to get the text to wrap. Instead the start and end of the text disappears off the edges of the page. This is my code... PHP Code:
How do I force the text to wrap to the next line, using centre align method? Also... How to remove the large top margin and centre the image horizontally. Using <div class="centre"> won't centre the image. Thanks Last edited by Karellen; 06-20-2022 at 09:33 PM. |
06-20-2022, 09:34 PM | #2 |
A Hairy Wizard
Posts: 3,094
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
People have been beating their heads against this wall for a while now. There are a few threads talking about it if you really want to do the searching.
Bottom line: There IS a way to make it work, but it takes a lot of effort and isn't guaranteed to work on all devices. The best easiest way is to use a photo editor and place the text exactly how you want it to appear. Then save the image with the text included. |
06-20-2022, 10:23 PM | #3 |
Sigil Developer
Posts: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
|
The svg 1.1 spec has no text wrap capability and any solution to make it requires javascript or lots of obscure cssorboth.
If epub3/html5, have you tried making the img tag a child of a figure tag and using the figcaption tag immediately after inside the figure tag. Of course sizing the img using css is needed as well to make sure it fits on the page with enough space for a caption. You can add a page-break before to make it start on a new page if that helps. Last edited by KevinH; 06-20-2022 at 10:40 PM. |
06-21-2022, 12:17 AM | #4 |
Wizard
Posts: 1,094
Karma: 4911876
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
@KevinH
Thank you, that was a very simple and easy solution and it all works nicely in the Libra 2. I had not come across the <figure> tab before. After losing track of time and spending well over an hour trying to figure out the svg text method, when I thought I finally had it working using <foreignobject>, I sideloaded the book to the Libra 2 and there was no text, even though I could see it in Calibre Editor and Reader as well as Kindle Previewer. Removed the <foreignobject> tags and just used <text> and all I got was ⌧⌧⌧⌧ symbols. So it looks like the Libra does not recognise <svg> text tags. Thanks again |
07-03-2022, 01:34 PM | #5 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
I have adopted a policy of putting the cart before the horse: the caption information is worked into the paragraph preceding the image. So the reader has presumably already absorbed the information by the time he/she/it sees the image, and can always page back if (as usually happens) it's on the preceding "page".
What prompted me to do this was a photo book about my home state that I borrowed from the state e-brary. Starting toward the beginning of the book, every page showed a caption for the preceding image at the top of the page, with the rest of the page given over to another and unrelated photo. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Forma no svg text as the cover page image, epub3 | lumpynose | Kobo Reader | 15 | 06-05-2019 11:56 AM |
adding text after svg (not caption) on single page | dbb1480 | Sigil | 7 | 06-11-2016 05:00 AM |
Svg wrapper with a caption text field | roger64 | ePub | 13 | 01-31-2016 06:45 PM |
[Tutorial] Convert TEXT to SVG IMAGE with Inkscape | GrannyGrump | Workshop | 3 | 04-22-2014 05:38 AM |
epub-kindle conversion blanks svg with text | bobb40 | Conversion | 2 | 09-28-2012 08:05 AM |