![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 802
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
|
Problem with embedded fonts
I have an epub file converted from odt by Calibre. It has subsequently been run through Sigil which has changed the directory structure somewhat. I need some extra characters in the font to handle pinyin, which is basically normal english letters with several accents over and above the ones that can be considered normal.
If I don't embed the font, words with some of these characters have them replaced by ?. It is worth noting that every occurrence of these characters has the additional attribute that the font at the time is italic. I've done the following to my epub subfiles: Added the following to the css file: Code:
@font-face { font-family: "Times New Roman", serif; font-weight: normal; font-style: normal; src: url(../fonts/Times New Roman Regular.ttf); } @font-face { font-family: "Times New Roman", serif; font-weight: bold; font-style: normal; src: url(../fonts/Times New Roman Bold.ttf); } @font-face { font-family: "Times New Roman", serif; font-weight: normal; font-style: italic; src: url(../fonts/Times New Roman Italic.ttf); Code:
.S-T { background-color: white; font-family: "Times New Roman", serif; this line added font-size: 1em; this line added font-style: italic; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0 } Code:
<item id="tnrbold_font" href="fonts/Times New Roman Bold.ttf" media-type="application/x-truetype-font" /> <item id="tnritalic_font" href="fonts/Times New Roman Italic.ttf" media-type="application/x-truetype-font" /> <item id="tnrregular_font" href="fonts/Times New Roman Regular.ttf" media-type="application/x-truetype-font" /> One section which contains the strange letters is as follows in a file called index_split_001.xhtml: Code:
<p class="P-P4">“<span class="S-T">N</span><span class="S-T2">ǐhǎo</span><span class="S-T3">,” said Nancy, and helped them to say the word correctly.</span> </p> <p class="P-P4">“How about “thank you”, and “goodbye”?” asked Tomas.</p> <p class="P-P4"><span class="S-T3">“Thank you is</span> <span class="S-T2">zhěxič</span> <span class="S-T3">and goodbye is</span> <span class="S-T2">zŕijiŕn</span><span class="S-T3"> . It really means “see you later”.”</span> </p> I'd very much like to solve this one, so if anyone has any suggestions, I'd be extremely grateful. TIA |
![]() |
![]() |
![]() |
#2 | |
Created Sigil, FlightCrew
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,982
Karma: 350515
Join Date: Feb 2008
Device: Kobo Clara HD
|
Quote:
The problem with embedded italic fonts not displaying comes from a Qt bug, which both Calibre and Sigil use. |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
Those words are covered by a span using class="S-T2". You haven't shown us the code for that class.
|
![]() |
![]() |
![]() |
#4 |
Booklegger
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,801
Karma: 7999816
Join Date: Jun 2009
Location: Toronto, Ontario, Canada
Device: BeBook(1 & 2010), PEZ, PRS-505, Kobo BT, PRS-T1, Playbook, Kobo Touch
|
I have noticed problems with ADE's use of embedded fonts when the @font-face definition contains a fall-back font after the desired font. Apparently the fall-back font should only be used in the css class definition where the embedded font is called for.
I don't know if that is how font-faces are supposed to work according to the CSS standard, or just the way Adobe has chosen to implement embedded fonts. Should this be added to the list of ADE bugs and quirks? |
![]() |
![]() |
![]() |
#5 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,542
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Indeed, the "font-family" inside @font-face can only have a single family name, unlike the "font-family" in other normal CSS rules.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 802
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 | ||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 802
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#8 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 802
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
|
Quote:
Code:
.S-T2 { background-color: white; font-size: 1em; font-family: "Times New Roman", serif; font-size: 1em; font-style: italic; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0 } |
|
![]() |
![]() |
![]() |
#9 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 802
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
|
Valloric, whilst I've got your attention, is there some way I can take an expanded epub book directory structure and load it into Sigil? I expand an epub and get all the subdirectories and files, make changes, then want to turn it back into an epub with a new name. Or I do the editing outside Sigil and want Sigil to do the compression back to an epub file. Can I persuade Sigil to load the directories so that I can run "Save As"?
|
![]() |
![]() |
![]() |
#10 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
Quote:
@font-face { font-family: "Garamond", serif; ... } Will cause the referenced font to be used for both font-family: "Garamond"; and font-family: serif; attributes. You shouldn't really be using fallbacks, though, they were put in because css on the web has to operate in a range of different user environments, whereas an epub's environment should be fully defined at the time it's coded. The only reason to use them is to accommodate the shortcomings in UserAgents like iBooks. |
|
![]() |
![]() |
![]() |
#11 | |
Created Sigil, FlightCrew
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,982
Karma: 350515
Join Date: Feb 2008
Device: Kobo Clara HD
|
Quote:
But to get such a folder structure into Sigil just zip it up and change the extension to epub (no need to worry about the mimetype, Sigil doesn't care when opening). Then save. Sigil will take care of turning it into a "proper" epub. |
|
![]() |
![]() |
![]() |
#12 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 802
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
|
Thanks, Valloric. That saves me making a script file to be run in a terminal window.
|
![]() |
![]() |
![]() |
#13 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 802
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
|
OK so I've changed the path to have a capital F for Fonts, I've removed the default "serif" from the @fontface statements and I've recompressed into a new epub. The results are:
Adobe had no italics, and some ? instead of pinyin characters My Iriver had the same as Adobe Calibre had no italics, but showed the pinyin characters correctly Stanza had the same as Calibre Does this suggest anything to anyone? What other changes/additions have I missed? TIA |
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,196
Karma: 1281258
Join Date: Sep 2009
Device: PRS-505
|
Remove the serif fallback from the font-family attribute in your spans as well.
But I think the best thing to do is for you to create and upload a sample that fails to show your italic font. |
![]() |
![]() |
![]() |
#15 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 802
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
|
Quote:
Stanza no italics, pinyin ok Adobe no italics, no pinyin Calibre no italics, pinyin ok Iriver no italics, no pinyin I've uploaded a copy of a much shortened file, comprising merely a part of chapter one. All the words in a foreign language should be in italics, that's the following words/phrases: Tanda panee lao mehebani Ji Nǐhǎo (i and a in this word appear as ? in some cases) zhěxič zŕijiŕn Also note that the epub file includes two images which I have yet to begin experimenting with. Sufficient unto the day is the evil thereof! Grateful for any help. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Embedded fonts, Calibre, and choice of fonts | AlexBell | ePub | 8 | 05-30-2010 06:00 AM |
iPad Embedded Fonts | JSWolf | Apple Devices | 24 | 04-26-2010 02:41 PM |
Embedded fonts in epub | erik5000 | ePub | 7 | 12-08-2009 11:55 AM |
Using embedded fonts with italics only | sherman | Calibre | 2 | 06-27-2009 04:32 AM |
ePub + Embedded Fonts | Cygfrydd | ePub | 11 | 03-02-2009 05:56 PM |