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 11-04-2015, 10:34 PM   #1
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
size relative to textsize

I want to embed a small image of a symbol in the text, to act as a letter.

Is there a way to style it so it scales with the text?

I've looked at several retail books and so far those that do this just have a small image, e.g 16x24 px, and put it as e.g.

.imgepub {height: auto; width: auto;}

So it stays at a constant size if you zoom the text.

So is there a way to refer to the current font size?

I tried
.textsize { height: inherit; width: inherit; }

But that didn't work; presumably it inherits from <img>.
I can't put it inside a <p> tag without starting a new paragraph.


Ten minutes later:
SOLUTION (Seems that stating the problem helps to solve it).

.textsize { height: 1em; width: 1em; }

-- maybe just
.textsize { height: 1em; }
would be more general, if you have an image of several symbols or a word.

Last edited by AlanHK; 11-04-2015 at 11:57 PM.
AlanHK is offline   Reply With Quote
Old 11-05-2015, 07:59 AM   #2
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: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
It doesn't need to be 1em, depending on the image it may be larger or smaller, just specify the size in em units and it will scale with the text size.

However, note that the best size is font-depending, so what looks fine with one font may be a bit too large or a bit too small with another font.
Jellby is offline   Reply With Quote
Advert
Old 11-05-2015, 10:33 AM   #3
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by Jellby View Post
It doesn't need to be 1em, depending on the image it may be larger or smaller, just specify the size in em units and it will scale with the text size.
However, note that the best size is font-depending, so what looks fine with one font may be a bit too large or a bit too small with another font.
Well, thanks, but once I realised what "em" meant in this context the rest was straightforward.
AlanHK is offline   Reply With Quote
Old 11-15-2015, 03:27 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,874
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Is this a symbol that's available in a font? if so, embed a font with that symbol and do that. Too many publishers take the lazy way out and it looks awful.
JSWolf is online now   Reply With Quote
Old 11-15-2015, 06:53 PM   #5
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
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
Quote:
Originally Posted by JSWolf View Post
Is this a symbol that's available in a font? if so, embed a font with that symbol and do that. Too many publishers take the lazy way out and it looks awful.
This is what I was thinking...but you shouldn't even need to embed a font if it is a unicode letter rather than a made-up new symbol...you can simply use the unicode:

Try this website for an online table of unicode characters...click on the one you want, copy to clipboard, then paste.
Attached Thumbnails
Click image for larger version

Name:	2015-11-15_17-51-02.png
Views:	238
Size:	127.6 KB
ID:	143806  
Turtle91 is offline   Reply With Quote
Advert
Old 11-15-2015, 08:34 PM   #6
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by JSWolf View Post
Is this a symbol that's available in a font? if so, embed a font with that symbol and do that. Too many publishers take the lazy way out and it looks awful.
To add a few (like 6) Chinese characters in a book, you need to embed an 8 megabyte font. I have done that, and even when I used font shrinking, it was still 3 or 4 MB of font for a few glyphs. If font shrinking actually gave a font with only the glyphs needed it would be about 10 kB, but none of the utilities I tried did that despite claiming to.

So if it was just one Chinese character, I preferred to use a 1 kB image and size it as the code discussed above. Of course, more than a handful isn't sensible to do that.


But in some books I was reading, not creating, I see there are few words of say Russian or Greek, and they are ugly miss-sized images plonked on the page. If I can work out what they are supposed to be by OCR or otherwise, I replace them with Unicode, as those glyphs are in the default fonts and don't need an embedded font.

I guess these books were created from some process that only recognises English and throws everything else into an image; e.g. it's very common to see asterisks as a scene separator done as images (sometimes a dozen slightly different images), so If I notice that I replace them with text.

Embedded fonts do have uses, of course. One book had a few words in blackletter so adding a 40 kB font replaced the larger images and gave better results.

Last edited by AlanHK; 11-15-2015 at 08:40 PM.
AlanHK is offline   Reply With Quote
Old 11-16-2015, 04:07 AM   #7
doubleshuffle
Unicycle Daredevil
doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.doubleshuffle ought to be getting tired of karma fortunes by now.
 
doubleshuffle's Avatar
 
Posts: 13,923
Karma: 185041098
Join Date: Jan 2011
Location: Planet of the Pudding Brains
Device: Aura HD (R.I.P. After six years the USB socket died.) tolino shine 3
Quote:
Originally Posted by AlanHK View Post
To add a few (like 6) Chinese characters in a book, you need to embed an 8 megabyte font. I have done that, and even when I used font shrinking, it was still 3 or 4 MB of font for a few glyphs. If font shrinking actually gave a font with only the glyphs needed it would be about 10 kB, but none of the utilities I tried did that despite claiming to.
Have you tried subsetting the font? It's easily done in Calibre's book editor, and there should be a Sigil plugin as well for that.

Sorry it that's what you've already tried, but that should strip all unused glyphs. If it doesn't with the fonts you've tried, it might be a bug worth reporting.
doubleshuffle is offline   Reply With Quote
Old 11-16-2015, 06:28 AM   #8
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by doubleshuffle View Post
Have you tried subsetting the font? It's easily done in Calibre's book editor, and there should be a Sigil plugin as well for that.

Sorry it that's what you've already tried, but that should strip all unused glyphs. If it doesn't with the fonts you've tried, it might be a bug worth reporting.
That's what I did try.

It made the font about half the original size, but still obviously contained thousands of glyphs in addition to the 6 actually used.

I had a deadline so had to submit it regardless of bloat.

I haven't had time since to return to it.
AlanHK is offline   Reply With Quote
Old 11-16-2015, 08:42 AM   #9
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Quote:
Originally Posted by AlanHK View Post
That's what I did try.

It made the font about half the original size, but still obviously contained thousands of glyphs in addition to the 6 actually used.

I had a deadline so had to submit it regardless of bloat.

I haven't had time since to return to it.
Try to use a ttf font instead of an otf font. Subsetting works a lot better on the otf fonts. Also, I understood from others that the subsetting in Calibre is not always that good in reducing the size of the font.
Toxaris is offline   Reply With Quote
Old 11-16-2015, 09:59 AM   #10
SBT
Fanatic
SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.
 
SBT's Avatar
 
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
What about using Fontforge and copying the required glyphs into a new, blank font?
However, converting the font to SVG may be the safest bet.
SBT is offline   Reply With Quote
Old 11-16-2015, 11:34 AM   #11
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by SBT View Post
What about using Fontforge and copying the required glyphs into a new, blank font?
However, converting the font to SVG may be the safest bet.
Certainly possible, I've done a fair bit of font hacklng, but messy. For one thing, just locating the characters you need in a huge Chinese font isn't easy if you aren't literate in Chinese.

Otherwise, I stay away from SVG. I used some simple SVG (as generated by the Sigil plugin) to make some ad pages that scaled nicely, but they apparently disappeared on some devices and didn't translate to Kindle at all. Impossible to debug when I don't have the devices myself, so I just dumbed the code down.

The scaled image solution is pretty likely to work in all situations, inelegant though it may be.

However, even if any of these these hacks work they make a mess of code that is a pain to edit and maintain.

If it comes up again I'll have another try at making subsetting work efficiently.

Last edited by AlanHK; 11-16-2015 at 08:34 PM.
AlanHK is offline   Reply With Quote
Old 11-16-2015, 02:06 PM   #12
RbnJrg
Wizard
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: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by AlanHK View Post

Otherwise, I stay away from SVG. I used some simple SVG (as generatd by the Sigil plugin) to make some ad pages that scaled nicely, but they apparently disappeared on some devices and didn't translate to Kindle at all.
To convert a glyph in a svg image is a piece of cake. Do the following:
  1. Open the font (with the glyph of your interest) with the Windows Font Viewer (you don't need to install the font).
  2. After that, open Inkscape.
  3. In Inkscape, select the Text tool (or press F8).
  4. Now, in the toolbar, select the font family that you open in the step 1 (it will be available on the font family list) and also select a font size of 144.
  5. Type the letter (the glyph) you want to convert in a svg image.
  6. Press F1 (to change to Select tool); after that the glyph will appear selected.
  7. Now select Path/Object to path command in the menu bar.
  8. After that select Archive/Document properties... and in the dialog that appears select "Fit page to content".
  9. Save all as Plain SVG (very important).

That's all. Now you'll be able to use that glyph as any other image. The resulting file will have no more than 2KB

Kindle (at least Kindle models that support .kf8) has plenty support of svg images. Maybe you didn't save the svg image as plain svg and for that reason you can see the image on those devices. Do the try with the above procedure and the svg will display in Kindle.

Regards
RbnJrg is offline   Reply With Quote
Old 11-16-2015, 08:27 PM   #13
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by RbnJrg View Post
To convert a glyph in a svg image is a piece of cake. Do the following:
Making the svg isn't the problem. It's that I was told the pages using svg simply did not appear on some devices. (iPad using their Kindle player.)

Since it worked for me, in Sigil, Calibre, and Amazon's Kindle previewer, but not my client, who is on another continent, trying to track down the problems(s) is impractical. Every modify/check takes a day and we have a deadline.

I've had to back off from using elegant code several times because of this kind of issue.

I know some people leap into things like media queries and try to code for every device separately, I don't have the time and am not earning enough from this one job to devote the time and money (to buy hardware) to make it work. So I use the simplest, least demanding code that works in all cases.

In this case, I have 2 solutions that do work: embedded font and embedded image. Going forward I hope I can make the font subsetting work better. A file that works and has standard coding is preferable, to me, even at the cost of a bloated file.

Last edited by AlanHK; 11-16-2015 at 08:38 PM.
AlanHK is offline   Reply With Quote
Old 11-17-2015, 02:40 AM   #14
SBT
Fanatic
SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.SBT ought to be getting tired of karma fortunes by now.
 
SBT's Avatar
 
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
Quote:
Originally Posted by AlanHK View Post
I know some people leap into things like media queries and try to code for every device separately, I don't have the time and am not earning enough from this one job to devote the time and money (to buy hardware) to make it work. So I use the simplest, least demanding code that works in all cases.
@AlanHK: You are probably sensible in your priorities. I'll add a couple of observations:
  • The aesthetic advantage of using SVG instead of raster formats for inline glyphs is that the anti-aliasing is more or less the same as for ordinary text, giving nice crisp outlines. Rasters will very often have a slight fuzziness and jaggedness. The quality of scaling algorithms also vary between e-readers. I've had some bad experiences with PNG downscaling, and now use GIF instead for loss-free compression.
    However, as long as you get the scaling of your character image right, you should get a result satisfacory for all but the most discerning readers...
  • Kindle for iOS seems like a near complete train wreck to me. Even with an iPad and Mac available, there seems no way of converting anything except trivial texts to a decent version.
  • Specifying width in em's doesn't seem to work for mobi-only devices, you have to have a fixed size. To ensure a sufficient DPI, I specify the width and height HTML attributes (not as CSS). However, this requires use of media queries (Anybody know of a better way?)
  • The Previewer isn't quite up to the job (but you've probably noticed that already). I particularly miss proper support for media queries and the opportunity to change line spacing.
  • And let's not forget that some devices, particularly older ones, have pretty limited UTF-8 support, so that even with embedded fonts, you risk getting just a '?'
SBT is offline   Reply With Quote
Old 11-23-2015, 08:21 PM   #15
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,874
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by AlanHK View Post
That's what I did try.

It made the font about half the original size, but still obviously contained thousands of glyphs in addition to the 6 actually used.

I had a deadline so had to submit it regardless of bloat.

I haven't had time since to return to it.
I find that if I use ePUBOptimizer to reduce the size of TTF fonts, I can still get a little bit more by using Calibre after that to subset. It works better than either one on it's own. Also ePUBOptimizer optimizes images to be smaller without changing the resolution or quality. Try it, it will work rather well and it will make your book that much better. I have to say that hate is a good word in describing authors (who make their own eBook) and publishers who use graphics instead of an embedded font for some characters. This is a serious no-no and should never be done. You did it and I now hate your eBook.
JSWolf is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with relative logo size abusimbel Conversion 2 12-19-2014 11:01 AM
relative or symbolic paths BetterRed Calibre 6 12-04-2013 07:58 AM
PB622(touch)-relative Berührungsunempfindlichkeit? tropi PocketBook 5 07-19-2012 06:41 AM
How do I display images Relative to Page Size in Kindle books? Kratos Kindle Formats 11 04-09-2012 11:15 AM
epub-library: relative paths josepinto EPUBReader 2 12-03-2009 06:40 AM


All times are GMT -4. The time now is 06:55 AM.


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