11-04-2015, 10:34 PM | #1 |
Guru
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. |
11-05-2015, 07:59 AM | #2 |
frumious Bandersnatch
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. |
Advert | |
|
11-05-2015, 10:33 AM | #3 | |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
|
|
11-15-2015, 03:27 PM | #4 |
Resident Curmudgeon
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.
|
11-15-2015, 06:53 PM | #5 | |
A Hairy Wizard
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:
Try this website for an online table of unicode characters...click on the one you want, copy to clipboard, then paste. |
|
Advert | |
|
11-15-2015, 08:34 PM | #6 | |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
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. |
|
11-16-2015, 04:07 AM | #7 | |
Unicycle Daredevil
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:
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. |
|
11-16-2015, 06:28 AM | #8 | |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
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. |
|
11-16-2015, 08:42 AM | #9 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
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.
|
11-16-2015, 09:59 AM | #10 |
Fanatic
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. |
11-16-2015, 11:34 AM | #11 | |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
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. |
|
11-16-2015, 02:06 PM | #12 | |
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
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 |
|
11-16-2015, 08:27 PM | #13 | |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
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. |
|
11-17-2015, 02:40 AM | #14 | |
Fanatic
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
|
Quote:
|
|
11-23-2015, 08:21 PM | #15 |
Resident Curmudgeon
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
|
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.
|
Thread Tools | Search this Thread |
|
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 |