11-01-2019, 10:58 PM | #1 |
Member
Posts: 12
Karma: 10
Join Date: Nov 2019
Device: iphone
|
Trouble embedding font
I'm working on an epub of a story that contains text messages between the characters. I'm using a condensed version of this CSS and HTML. I want the reader to be able to pick their own font, per normal, for most of the story, but I want certain sections to be locked into the text message font.
I've had a lot of trouble embedding fonts, and even now that I think I've finally managed it (it says the font is embedded, and looks ok on the comupter) when I download the epub to my phone, the font is gone and we're back to whatever font the reader picks. I try to talk myself into "that's fine," but it really doesn't look like texting when it's in a serif font. Help? |
11-02-2019, 12:17 AM | #2 |
Well trained by Cats
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Look at you devices reader app. It must allow something like 'Publishers font' or styles. Not all do
Also: Did you verify your code? Calibres viewer tolerates a lot of bad/poor coding. RMSDK (ADE) is famous for tossing a poorly coded CSS. VALIDATE |
11-02-2019, 12:40 AM | #3 |
Member
Posts: 12
Karma: 10
Join Date: Nov 2019
Device: iphone
|
My reader is the iBooks app on my iphone. Are you saying that even a completely properly embedded font will still not show up on some readers?
|
11-02-2019, 04:29 AM | #4 | |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Quote:
For epub2: You need to add this file to the META-INF directory: Code:
com.apple.ibooks.display-options.xml Spoiler:
For epub3: On the opf file, add the ibooks prefix to the <package> element: Code:
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" unique-identifier="isbn-id" prefix="ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/ a11y: http://www.idpf.org/epub/vocab/package/a11y/#" xml:lang="pt-BR"> Code:
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"> ... <meta name="cover" content="cover.jpg"/> <meta property="ibooks:specified-fonts">true</meta> ... </metadata> |
|
11-02-2019, 02:21 PM | #5 | |
Member
Posts: 12
Karma: 10
Join Date: Nov 2019
Device: iphone
|
Quote:
|
|
11-02-2019, 06:30 PM | #6 |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Yes, verbatim.
Is this copyrighted material? If not, attach the file here so we can have a look at it. Also, I just looked at the link you pointed as the CSS used. I don't see any @font-face rule. So, did you created a @font-face rule? Did you actually saved the font within your epub file? If the font is just referenced with a font-family rule, then it might work on the computer (if you have that font on your system), but won't show on your device (where the font is not present). Last edited by thiago.eec; 11-02-2019 at 06:39 PM. |
11-03-2019, 01:02 AM | #7 |
Member
Posts: 12
Karma: 10
Join Date: Nov 2019
Device: iphone
|
In fonts.css I've got:
Code:
@font-face { font-family: "Helvetica Neue"; font-weight: normal; font-style: normal; src: url(fonts/Helvetica-Neue-1.ttf); } The texting CSS in stylesheet.css is: Code:
/* Texting wrapper */ .texting { max-width: 300px; font-family: "Helvetica Neue", sans-serif; display: table; margin: auto; padding-left: 0.5em; padding-right: 0.5em; } /* All texts */ .text { margin: 0 0 0.5em; border-radius: 1em; padding: 0.5em 1em; max-width: 75%; clear: both; position: relative; } .text:after { content: ""; position: absolute; bottom: 0; width: 0.5em; height: 1em; } /* Outgoing (sent from this phone) */ .out { float: right; background: #1289fe; color: #FFF; } .out:after { right: -0.5em; border-left: 0.5em solid #1289fe; border-bottom-left-radius: 1em 0.5em; } /* Incoming (reply from other person) */ .in { float: left; background: #e5e5ea; color: #000; } .in:after { left: -0.5em; border-right: 0.5em solid #e5e5ea; border-bottom-right-radius: 1em 0.5em; } |
11-03-2019, 02:49 AM | #8 |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
Look, to further help you, I would have to take a look at the file. Send me via pm, if it is copyrighted material.
|
11-03-2019, 08:41 AM | #9 | |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
11-06-2019, 11:10 PM | #10 |
Member
Posts: 12
Karma: 10
Join Date: Nov 2019
Device: iphone
|
Here's the epub file, if that's what you're saying
|
11-06-2019, 11:36 PM | #11 |
Bibliophagist
Posts: 35,401
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Just a quick look has me asking why you declare font-family "Helvetica Neue" for both your embedded fonts (one in fonts.css, the other in page-styles.css)?
Code:
@font-face { src: url(../Fonts/Helvetica-Neue.ttf); font-family: "Helvetica Neue"; panose-1: 2 0 5 3 0 0 0 2 0 4 } @font-face { font-family: "Helvetica Neue"; font-weight: normal; font-style: normal; src: url(../Fonts/Helvetica-Neue-1.ttf); } |
11-06-2019, 11:52 PM | #12 |
Member
Posts: 12
Karma: 10
Join Date: Nov 2019
Device: iphone
|
That happened when I was trying to upload the font. I'm not really sure why.
|
11-07-2019, 06:50 AM | #13 |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
I'm attaching the corrected file. Some pointers:
1) The apple settings file MUST be on the META-INF folder. It was not there. In the Editor, you can right-click the file and rename it like this: META-INF/com.apple.ibooks.display-options. Then it will be put on the META-INF folder. 2) This file MUST NOT be manifested. So, you MUST erase this entry from the content.opf: Code:
<manifest> ... <item href="com.apple.ibooks.display-options.xml" id="id" media-type="application/xml"/> ... </manifest> 4) The font file was duplicated (causing the file to get bigger). One of then was referenced from font.css and the other from page_stylesheet.css (as pointed by @DNSB). Every font must be inserted only once, and then used along the css file using the font-family rule. Last edited by thiago.eec; 11-07-2019 at 06:54 AM. |
11-07-2019, 02:12 PM | #14 |
Member
Posts: 12
Karma: 10
Join Date: Nov 2019
Device: iphone
|
Thank you so much!! This is invaluable to me. I spent like a week of 1 ams trying to figure it out on my own.
|
11-08-2019, 09:01 AM | #15 |
Guru
Posts: 927
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
|
You're welcome! Glad it helped you.
|
Tags |
font, font embedding, font epub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Embedding font in books that already have embedded font | Barty | Calibre | 2 | 10-16-2013 11:38 PM |
Font Embedding? | teh603 | Writer2ePub | 75 | 01-08-2013 07:57 PM |
Font embedding | sachin | Sigil | 36 | 03-30-2012 03:26 AM |
Font embedding | sachin | Sigil | 3 | 03-21-2012 09:19 AM |
Do I need a font license if all I'm doing is referring to the font (not embedding)? | Stodder | Workshop | 21 | 04-21-2011 04:19 AM |