Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 09-21-2013, 09:13 PM   #16
Tex2002ans
Fanatic
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 530
Karma: 562971
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by mtrahan View Post
But still there must be something I'm doing wrong (long story). What's the good way to add the .svg image so that it appears inline with the text (ie. I want to downsize it so that it is just the size of a letter in the middle of a paragraph)? Style an image class with something like "height: 1em;"? Or there is a better way?
Sorry, I don't know more details... SVG is one area where I don't have any experience.

Just wanted to toss it out there that using SVG is also a choice when dealing with odd characters/symbols.

I would say embedding a subsetted font would be the MOST COMPATIBLE bet. More devices/programs support font-embedding than those that have proper SVG support... and to my knowledge, the Kindle formats, and iBooks, don't support SVG. Also going the SVG route would need some sort of relevant fallback anyway.

Also, let us say you wanted to use a tool (like Calibre) to convert from EPUB -> DOC. I bet Calibre would handle the font-embedded Apple character fine... while an Apple SVG... who knows what would happen.

Quote:
Originally Posted by mtrahan View Post
EDIT: OK, styling an image class with "height: 1em;" just doesn't work in iBooks. I end up with a giant apple... Argh.
And if all else fails (even the font embedding), I generated a (quite large) PNG from that Wikimedia SVG that you can scale down to 1em.

To generate the Apple PNG: I used Inkscape (exported as a 600px wide PNG) -> GIMP (stripped transparency and made grayscale) -> Export as PNG -> Ran the PNG through ScriptPNG to optimize it.

I haven't tested it in a long while, but last time I did something similar (if I remember, it had to deal with formulas needing to be in-line), scaling the image down to 1em worked on ADE + Kindle.

Here is the code from the test EPUB:

Code:
 <p>This is a lot of sample text with the apple <img alt="" class="apple" src="../Images/ApplePNG.png" />.</p>

  <p class="double">This text is <img alt="" class="apple" src="../Images/ApplePNG.png" /> 2em.</p>
Here is the CSS:

Code:
img.apple {
	height: 1em;
}

p.double {
	font-size: 2em;
}
Here are the sample images. First = 100% scale, Second = 200% scale:

Click image for larger version

Name:	100PerecentApple.png
Views:	30
Size:	23.4 KB
ID:	111764Click image for larger version

Name:	200PercentApple.png
Views:	43
Size:	25.4 KB
ID:	111765
Attached Thumbnails
Click image for larger version

Name:	ApplePNG.png
Views:	55
Size:	7.1 KB
ID:	111763  
Attached Files
File Type: epub AppleTest.epub (9.3 KB, 24 views)

Last edited by Tex2002ans; 09-21-2013 at 09:22 PM.
Tex2002ans is offline   Reply With Quote
Old 09-22-2013, 03:57 AM   #17
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,259
Karma: 4801167
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by mtrahan View Post
Style an image class with something like "height: 1em;"? Or there is a better way?

EDIT: OK, styling an image class with "height: 1em;" just doesn't work in iBooks. I end up with a giant apple... Argh.
I would say an <img> element with height:1em style should work. If it doesn't, it's the reader's fault, but that doesn't help you. Maybe there's more to be cleaned in the SVG file?

Quote:
Originally Posted by Tex2002ans View Post
Also going the SVG route would need some sort of relevant fallback anyway.
I'm not sure about that. SVG is required by the ePub spec so no fallback is needed. What is needed is an "alt" text, but that's an advantage. With images disabled you'd see the alt text, with font embedding disabled (or non-working) you'd see nothing meaningful.
Jellby is online now   Reply With Quote
 
Advertisement
Old 09-22-2013, 05:09 AM   #18
Tex2002ans
Fanatic
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 530
Karma: 562971
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by Jellby View Post
Maybe there's more to be cleaned in the SVG file?
Every so often SVG topics pop up, but it usually does not get a concrete answer. And it seems to be an area that many avoid/do not know much about.

I know enough that SVG exists, but not enough to properly get SVGs working.

I linked over to those two topics with RbnJrg examples/discussing SVG (which is the latest I recall).

Do you happen to have any good samples of SVG being used in EPUB?

For example, how would you go from an SVG of Red Apple (U+1F34E):

http://www.fileformat.info/info/unic.../red_apple.svg

to getting that SVG working/scaling in an EPUB?

I happened to plop that SVG into Sigil, and it is very large (see attached image and EPUB). All quick attempts at resizing using width/height seemed to have failed miserably.

Maybe a step-by-step tutorial on how to make sense of the SVG file, strip it down/add to it (if necessary), and get some actual usage out of it?

Or maybe a tutorial on how to use Inkscape to bash the SVG to your will?

I do know how to go from SVG -> Inkscape -> high resolution PNG -> EPUB (see ApplePNG attached above). (I can post steps on how I do this if anyone is interested).

On a related note, here is a link to SVG in the MobileRead Wiki: http://wiki.mobileread.com/wiki/SVG
Attached Thumbnails
Click image for larger version

Name:	RedGreen.png
Views:	47
Size:	37.7 KB
ID:	111786  
Attached Files
File Type: epub RedGreenApple.epub (33.3 KB, 19 views)

Last edited by Tex2002ans; 09-22-2013 at 05:13 AM.
Tex2002ans is offline   Reply With Quote
Old 09-22-2013, 10:48 AM   #19
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,259
Karma: 4801167
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Tex2002ans View Post
Do you happen to have any good samples of SVG being used in EPUB?
Not really, at least not for pictures... Testing in my device is not the most convenient, and I haven't really found the need for it yet.

Quote:
For example, how would you go from an SVG of Red Apple (U+1F34E):

http://www.fileformat.info/info/unic.../red_apple.svg

to getting that SVG working/scaling in an EPUB?
That SVG is actually pretty simple. If you open it with any text editor, you'll see it's a single path, and it does not seem to have any hard-coded size that would prevent it from resizing. Maybe the font-size="12" is the culprit, or maybe it needs some kind of width/height.

And let's not forget that readers are buggy anyway.

Quote:
Or maybe a tutorial on how to use Inkscape to bash the SVG to your will?
For that, nothing like the XML browser in Inkscape, you can see the structure, remove all unnecessary objects and rearrange the others.
Jellby is online now   Reply With Quote
Old 09-22-2013, 10:56 AM   #20
PoP
Antonín ♯♭♪♮♫ ᵖʸᶠᵍᶜʳˡ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 512
Karma: 6391817
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3.₄, PRS-350, SGS3, Rπ, iPad Air
Quote:
Originally Posted by Tex2002ans View Post
...[snip]

And if all else fails (even the font embedding), I generated a (quite large) PNG from that Wikimedia SVG that you can scale down to 1em.

To generate the Apple PNG: I used Inkscape (exported as a 600px wide PNG) -> GIMP (stripped transparency and made grayscale) -> Export as PNG -> Ran the PNG through ScriptPNG to optimize it.

I haven't tested it in a long while, but last time I did something similar (if I remember, it had to deal with formulas needing to be in-line), scaling the image down to 1em worked on ADE + Kindle.


[snip]...
Avoiding font or svg... indeed. I liked the png scaling to 1em trick. in this case of the single apple character, it does the job quite effectively.

Quote:
Originally Posted by Tex2002ans View Post
...[snip]
I do know how to go from SVG -> Inkscape -> high resolution PNG -> EPUB (see ApplePNG attached above). (I can post steps on how I do this if anyone is interested).
[snip]...
Sure, if you have the time to detail a bit more.

I don't want to hijack this thread but I would apply the idea in my Nadsat Translation Dictionary where I have strings of multiple characters (in alien language fonts). Since dictionaries are KF7 only, I could not use font embedding or svg and it annoys me that the images of text that I included cannot scale when font sizes are changed.

[EDIT 2013-09-22 13:52]
Alas no success. Kindlegen reports no error but Height: and Width: image scaling properties are simply ignored by the mobi-only KF7 on the K3.
Spoiler:

Code:
<style>
 img.oneEMh {height: 1em;}
 img.oneEMw {width: 1em;}
</style>
with
Code:
<I>vul:</I>   <img alt="" class="oneEMw"  src="../Images/t'hai'la 3.gif"/> /t'hai'la/
or
Code:
<I>fer:</I>  <img alt="" class="oneEMh"  src="../Images/itl 3.jpg"/> /itl/
has no effect on the images when changing the text size on the reader

Last edited by PoP; 09-22-2013 at 02:54 PM.
PoP is online now   Reply With Quote
Old 09-22-2013, 11:44 AM   #21
mtrahan
Colonel Mustard
mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.
 
mtrahan's Avatar
 
Posts: 87
Karma: 1426
Join Date: Feb 2010
Location: Montreal
Device: iPod Touch, Kindle 3, iPad 2
OK. Trying to please every e-reader around is enough to literally drive a man crazy. I spent way too much time in this &%!&% ePub and every time I manage to get something working I seem to break something else.

The Apple symbol. Yes, it works in Sigil: I set "height: 1em;" and the symbol is the size I want (just as Text2002ans showed). But as soon as I open the ePub in ADE the Apple gets back to its giant size. And frankly, I have no idea why.

The most confusing thing is that when I open Text2002ans's AppleTest.epub in ADE, it works just fine! The Apple symbol is shown at the good size. So I tried to import his exact code in my ePub, same PNG file, copied the CSS and HTML. And it doesn't work anymore! Giant Apple in ADE again...

Frankly, this is getting insane. I really have no idea what is causing this. At this point I'm a little desperate. I spent way too much time trying to get this ePub to work this week...

Even my other embedded symbols seem to have stopped working in ADE. And my 'Special-character.epub' test file posted on the first page still works fine in ADE, and the fonts are embedded exactly the same way.

I can't upload the ePub here because of copyright, but if anyone is curious about this and wants to have a look at it, let me know and I'll send a link in private.

Thanks again for all the help.

EDIT: Oh and by the way, the AppleTest.epub (with the PNG file) doesn't work in iBooks either. I get giant apples there too... The most frustrating thing is that iBooks is pretty much the only reader where I wouldn't even need to do this: Apple symbols are already embedded in it so the symbol appeared automatically on the first try...

Last edited by mtrahan; 09-22-2013 at 01:08 PM. Reason: Another test.
mtrahan is offline   Reply With Quote
Old 09-22-2013, 03:00 PM   #22
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 6,259
Karma: 4801167
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by mtrahan View Post
The most confusing thing is that when I open Text2002ans's AppleTest.epub in ADE, it works just fine! The Apple symbol is shown at the good size. So I tried to import his exact code in my ePub, same PNG file, copied the CSS and HTML. And it doesn't work anymore! Giant Apple in ADE again...
Maybe you have some syntax problem elsewhere in the CSS file. ADE is known for ignoring the whole stylesheet if a semicolon is missing anywhere, for instance.
Jellby is online now   Reply With Quote
Old 09-22-2013, 03:23 PM   #23
mtrahan
Colonel Mustard
mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.
 
mtrahan's Avatar
 
Posts: 87
Karma: 1426
Join Date: Feb 2010
Location: Montreal
Device: iPod Touch, Kindle 3, iPad 2
Quote:
Originally Posted by Jellby View Post
Maybe you have some syntax problem elsewhere in the CSS file. ADE is known for ignoring the whole stylesheet if a semicolon is missing anywhere, for instance.
Yeah, 10 minutes ago I found a missing semicolon after a "border-collapse: collapse;"... I don't know if it was this, but I now get the image to scale down correctly in ADE.

Only problem is: it is useless. Neither my book or Text2002ans's AppleTest.epub works in iBooks (for the scaled symbol that is). I still get giant apples with both... And frankly, I'm beginning to think to only way to do this is to do downsize the PNG file directly to something very small, similar to a letter.

(That is another story but I feel I understand less and less as time go by. I managed to get the other symbols working in ADE and iBooks, but I'm beginning to think the embedded 'Symbola' font is simply useless (as in not used by the readers or something). Well, I don't know: before I embedded this font, the symbols didn't work in ADE, now they do. But I'm trying to embed another font the exact same way and it's just not working at all in ADE. Works fine everywhere else. Oh well.)

EDIT: Ah! Found the solution to the problem to the embedded fonts in ADE: a blank space! Font name had two works, and a regular space between them. I didn't think about this (and read nothing nowhere about this either). I renamed the font to remove the space, adjusted the stylesheet and voila! My embedded font now works in ADE. (Let's just hope it still works everywhere else...

Last edited by mtrahan; 09-22-2013 at 03:32 PM. Reason: Solution!
mtrahan is offline   Reply With Quote
Old 09-22-2013, 03:30 PM   #24
Tex2002ans
Fanatic
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 530
Karma: 562971
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by PoP View Post
Sure, if you have the time to detail a bit more.
I'll do it within the coming days, I will mark the thread as "Tutorial: ".

Quote:
Originally Posted by PoP View Post
I don't want to hijack this thread but I would apply the idea in my Nadsat Translation Dictionary where I have strings of multiple characters (in alien language fonts). Since dictionaries are KF7 only, I could not use font embedding or svg and it annoys me that the images of text that I included cannot scale when font sizes are changed.
Hopefully everyone can piece together some code and figure this out. In my experience, usually you can get code like this working in:

Sigil + ADE, and break in Kindle
Sigil + Kindle, and break in ADE
Work in all three, and then explode in iBooks
Work everywhere, and explode in an otherwise perfectly compliant ereader that has never treated you wrong... UNTIL NOW.

Quote:
Originally Posted by mtrahan View Post
OK. Trying to please every e-reader around is enough to literally drive a man crazy. I spent way too much time in this &%!&% ePub and every time I manage to get something working I seem to break something else.

[...]

The most confusing thing is that when I open Text2002ans's AppleTest.epub in ADE, it works just fine! The Apple symbol is shown at the good size. So I tried to import his exact code in my ePub, same PNG file, copied the CSS and HTML. And it doesn't work anymore! Giant Apple in ADE again...

Frankly, this is getting insane. I really have no idea what is causing this. At this point I'm a little desperate. I spent way too much time trying to get this ePub to work this week...
I know your pain!!!

This is why working on such a strict deadline is just asking for gremlins... this EPUB requires a break (of a day or two, maybe a week or two)... and when you come back to it, the gremlins will have disappeared, everything will magically be working, the good ideas will flow right to your brain! It happens in programming all the time!

Quote:
Originally Posted by mtrahan View Post
The Apple symbol. Yes, it works in Sigil: I set "height: 1em;" and the symbol is the size I want (just as Text2002ans showed). But as soon as I open the ePub in ADE the Apple gets back to its giant size. And frankly, I have no idea why.
I will have to see if I hunt down that EPUB I mentioned and see what I did in the code.... What happens when you do 165+ EPUBs is that your brain gets a little rusty, and you forget what you used where.

Quote:
Originally Posted by mtrahan View Post
I can't upload the ePub here because of copyright, but if anyone is curious about this and wants to have a look at it, let me know and I'll send a link in private.
Send it on over.

Quote:
Originally Posted by mtrahan View Post
EDIT: Oh and by the way, the AppleTest.epub (with the PNG file) doesn't work in iBooks either. I get giant apples there too... The most frustrating thing is that iBooks is pretty much the only reader where I wouldn't even need to do this: Apple symbols are already embedded in it so the symbol appeared automatically on the first try...
I don't have any apple device. I test on ADE (my first-generation Nook, and every so often Bluefire reader on my phone) + Sigil + at work there are people who test on Kindles and report any problems.

From what I gather on the forums, iBooks creates horrors for rendering.

I gave up on iBooks with two things:
  • When people were recommending that empty <span> surrounding everything "workaround".
  • When I had an EPUB that had gremlins just like you. A reader contacted me saying that the cover of ONE BOOK wouldn't work on iBooks (the tens of EPUBs with the same exact code worked all fine). I went through maybe six or seven iterations of tiny tweaks to the gremlin EPUB... and right when I thought I was getting down to figuring it out... poof... the original EPUB worked!

You reach a point where you code your EPUB as compliant code, it renders good on 99% of the stuff you test on, and the other 1% can fix their crap, the user can tweak the EPUB to their liking, or they just ignore the one giant sized apple (hopefully you don't use the apple symbol too often? ).

The philosophy in my ebooks is:

Keep your code as minimal code as possible.

I keep things pretty much down to "left" + "center" + "right" + "noindent" + "negindent" + "margintop" + "smallcaps" (I use the CSS bold + font-variant:smallcaps to keep clean code, if the device can't handle smallcaps, the text is bold at least).

If I stray far from my CSS template code with odd code like this, I make sure to mark that it needs some extra testing. But at a point, you just can't have one EPUB file that handles them all! You will pull your hair out!

Quote:
Originally Posted by mtrahan View Post
Only problem is: it is useless. Neither my book or Text2002ans's AppleTest.epub works in iBooks (for the scaled symbol that is). I still get giant apples with both... And frankly, I'm beginning to think to only way to do this is to do downsize the PNG file directly to something very small, similar to a letter.
No no no... you never want a tiny image that is scaled UP. It looks ATROCIOUS.

Since iBooks seems to have the Apple character built into the fonts, why not generate two EPUBs JUST FOR THIS SINGLE CASE.

iBooks version: Toss out the PNG and just use the embedded fonts + it seems like the Apple character works on its own.
Everything else version: Toss in the Apple PNG and scale it in ems instead.

Last edited by Tex2002ans; 09-22-2013 at 03:33 PM.
Tex2002ans is offline   Reply With Quote
Old 09-22-2013, 03:59 PM   #25
mtrahan
Colonel Mustard
mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.
 
mtrahan's Avatar
 
Posts: 87
Karma: 1426
Join Date: Feb 2010
Location: Montreal
Device: iPod Touch, Kindle 3, iPad 2
ePub gremlins, eh. I just know what you mean. This book is no good for my health!

I'll consider the two versions idea... I actually thought about it, because I can choose to add a version to be sold only through iBookstore. The thing is, though, if someone buys it through another retailer he'll get the other version (with the scaled-down png) so if he decides to read it in iBooks it will be all broken again.

Only solution I see at this point is to tweak the 'Symbola' font I already embedded in this ePub and try to add the Apple glyph with Type light or something. I have no idea how to do that, but I can learn. The new problem would probably be a legal one so it is not exactly a solution...
mtrahan is offline   Reply With Quote
Old 09-22-2013, 04:51 PM   #26
RbnJrg
Evangelist
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 474
Karma: 318996
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Tex2002ans View Post

Do you happen to have any good samples of SVG being used in EPUB?

For example, how would you go from an SVG of Red Apple (U+1F34E):

http://www.fileformat.info/info/unic.../red_apple.svg

to getting that SVG working/scaling in an EPUB?

I happened to plop that SVG into Sigil, and it is very large (see attached image and EPUB). All quick attempts at resizing using width/height seemed to have failed miserably.

Maybe a step-by-step tutorial on how to make sense of the SVG file, strip it down/add to it (if necessary), and get some actual usage out of it?

Or maybe a tutorial on how to use Inkscape to bash the SVG to your will?
OK, here is my tutorial.

1. Open Inkscape.

2. Select File/Open and in the dialog "Select file to open", in the field "Name:" write:

http://www.fileformat.info/info/unic.../red_apple.svg

(or the url of the file you wish or another .svg file). After that press the buttom "Open".

3. Do click with the mouse over the apple in the Inkscape page (you'll see a lot of arrows rounding the apple).


4. ATENTION - THIS IS THE KEY: Select the menu File/Document Properties... and select the option "Resize page to content..." and after that, press the buttom "Resize page to drawing or selection". Close the dialog.


5. Now select the menu File/Save as... and chose the name red_apple (or whatever you want) and the type "Plain SVG". That's all with Inkscape.

6. Open Sigil and start a new ePub.

7. On the Images folder, right click with the mouse, chose "Add Existing File..." and select the red_apple.svg file.

8. On the Styles folder, right click with the mouse and select "Add a Blank Stylesheet"

9. Write in that stylesheet the following:


Code:
p {
  font-size: 1em; /* this size must be linked with the height of the svg image */
  text-align: justify;
  text-indent: 1em;
  margin: 0;
}

.svg_img {
  display: inline;
  height: 1em; /* this must be equal to the font-size used to style "p" */
  width: auto;
}
10. In the .html file write (after linking it with the stylesheet) the following:

Code:
<p>This is a test with the <img class="svg_img" alt="red_apple" src="../Images/red_apple.svg" /> used as image inline</p>
That's all

Below you can test my ePub.

Regards
Rubén
Attached Files
File Type: epub red_apple.epub (14.3 KB, 25 views)

Last edited by RbnJrg; 09-22-2013 at 05:04 PM.
RbnJrg is offline   Reply With Quote
Old 09-22-2013, 06:17 PM   #27
mtrahan
Colonel Mustard
mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.
 
mtrahan's Avatar
 
Posts: 87
Karma: 1426
Join Date: Feb 2010
Location: Montreal
Device: iPod Touch, Kindle 3, iPad 2
By the way, for anyone from the future who's looking for the answer, here's a post from Liz Castro, who suggests putting the image in a div and setting the div's width to get the desired size in iBooks (and then set the image to div size to avoid overflow outside of iBooks). I didn't manage to get this working, but for me it's not even an option since my image is in the middle of a sentence and can not be considered as a block like a div. "Currently," I learned on Jutoh documentation, "this won't work if you have multiple images or other content in a paragraph"...
mtrahan is offline   Reply With Quote
Old 09-22-2013, 07:12 PM   #28
Tex2002ans
Fanatic
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 530
Karma: 562971
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by RbnJrg View Post
OK, here is my tutorial.
[...]
Fantastic, worked like a charm!

I went in and added the Green Apple (U+1F34F):

http://www.fileformat.info/info/unic...reen_apple.svg

I also tweaked the SVG file and changed "fill" into the hex for red and green.

Click image for larger version

Name:	AppleSVGFill.png
Views:	49
Size:	46.5 KB
ID:	111843

Sigil:

Click image for larger version

Name:	ColorApples.png
Views:	52
Size:	26.2 KB
ID:	111844

ADE:

Click image for larger version

Name:	ADEApple.png
Views:	45
Size:	34.8 KB
ID:	111856

On Nook:

Click image for larger version

Name:	AppleNookSuccess.jpg
Views:	53
Size:	172.1 KB
ID:	111842

Does this work on Marvin/other devices/reading programs too?

Anyone have any of the Kindles on hand? How well does this transfer over?

Kindle Unpack shows the SVG files sitting in the KF8 version. According to what I read in the Amazon Publishing Guidelines, I am getting mixed signals (SVG only in Kindle Fire (?)).

In section 8.4.2 they recommend using the SVG with an accompanying image. Setting the image to "display:none", and only displaying the image in old MOBI using media queries. UGH:

http://kindlegen.s3.amazonaws.com/Am...Guidelines.pdf

Not much information though on SVG in their documentation.

I also stumbled upon this thread with a formula as SVG, with a sample EPUB plus lots of info:

http://www.mobileread.com/forums/showthread.php?t=87781

Now I want to find more complex SVGs and do some testing.

Quote:
Originally Posted by mtrahan View Post
By the way, for anyone from the future who's looking for the answer, here's a post from Liz Castro, who suggests putting the image in a div and setting the div's width to get the desired size in iBooks (and then set the image to div size to avoid overflow outside of iBooks). I didn't manage to get this working, but for me it's not even an option since my image is in the middle of a sentence and can not be considered as a block like a div. "Currently," I learned on Jutoh documentation, "this won't work if you have multiple images or other content in a paragraph"...
And I bet this "workaround" that people do will be just like those empty spans! Apple will "fix" this bug, and lots of EPUBs which took advantage of this will break. DIE DIE DIE!
Attached Files
File Type: epub ColorAppleTest.epub (50.5 KB, 29 views)

Last edited by Tex2002ans; 09-22-2013 at 07:20 PM. Reason: Added ADE Image
Tex2002ans is offline   Reply With Quote
Old 09-22-2013, 08:27 PM   #29
mtrahan
Colonel Mustard
mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.mtrahan is no ebook tyro.
 
mtrahan's Avatar
 
Posts: 87
Karma: 1426
Join Date: Feb 2010
Location: Montreal
Device: iPod Touch, Kindle 3, iPad 2
Quote:
Originally Posted by Tex2002ans View Post
I also stumbled upon this thread with a formula as SVG, with a sample EPUB plus lots of info:

http://www.mobileread.com/forums/showthread.php?t=87781

[...]

And I bet this "workaround" that people do will be just like those empty spans! Apple will "fix" this bug, and lots of EPUBs which took advantage of this will break. DIE DIE DIE!
Oh, thanks for this link! Following what he did in the sample ePub I managed to get my SVG apple to display correctly in iBooks:

Code:
<span style="display: inline-block; width: 1em;"><img alt="" src="../Images/Pomme.svg" style="width: 100%;" />
Let's hope my ePub can at least survive until Tuesday.

I gotta run but I'll check your work on SVG tomorrow (very nice!). I can test your file on my old Kindle 3.

Happy dance for now:
mtrahan is offline   Reply With Quote
Old 09-23-2013, 08:11 AM   #30
RbnJrg
Evangelist
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 474
Karma: 318996
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Tex2002ans View Post
Fantastic, worked like a charm!
Thank you!

Quote:
Anyone have any of the Kindles on hand? How well does this transfer over?
It works in any Kindle that supports the .kf8 format.

Quote:
I also stumbled upon this thread with a formula as SVG, with a sample EPUB plus lots of info:

http://www.mobileread.com/forums/showthread.php?t=87781

Now I want to find more complex SVGs and do some testing.
Quote:
Originally Posted by PoP View Post
Avoiding font or svg... indeed.
That is for both of you, PoP and Tex; there is no trouble at all by working with text (formulas) inside a .svg image. Just there are two KEYS for that:

1. The first KEY I have already posted in my tutorial in the step #4:
In Inkscape, select the menu File/Document Properties... and select the option "Resize page to content..." and after that, press the buttom "Resize page to drawing or selection".

2. The second KEY is only applicable when we are working with some class of text and is:
In Inkscape, select the menu Path and then the command "Object to Path"
This command must be applied with the object selected (that is, with all the "arrows" rounding it).

That's all. After that we won't have any trouble with the .svg image and we won't need to embed any font in the ePub.

Regards
Rubén
RbnJrg is offline   Reply With Quote
Reply

Tags
epub, special characters, symbols, unicode

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Support of Special Unicode Characters in EPUB? gawl PocketBook 1 03-24-2013 06:12 AM
HTML to Epub conversion dosn`t work because special characters eLit Conversion 2 08-29-2011 03:01 AM
txt to epub tilde/special characters Fuzzy Dustmite Conversion 1 04-11-2011 10:54 PM
special characters in epub? biltron Introduce Yourself 5 12-20-2009 04:50 PM
Epub and special characters again mtravellerh Calibre 3 01-04-2009 01:55 PM


All times are GMT -4. The time now is 03:57 PM.


MobileRead.com is a privately owned, operated and funded community.