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-06-2010, 05:25 PM   #1
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
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);
Still in the css file, changed the following:

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
    }
Added these lines to content.opx just in front of the /manifest tag:

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" />
That's all the changes I have made, apart from adding the three files with the names above to the fonts folder.

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>&nbsp;</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">&nbsp;. It really means “see you later”.”</span>&nbsp;</p>
Now the words "Nǐhǎo", "zhěxič" and "zŕijiŕn" should appear in italics. They don't, and the first word, on my reader and in Adobe epub reader shows as N?h?o. In Calibre and Sigil it appears as Nǐhǎo but not in italics. No other italics appear as they should either.

I'd very much like to solve this one, so if anyone has any suggestions, I'd be extremely grateful.

TIA
James_Wilde is offline   Reply With Quote
Old 09-06-2010, 05:44 PM   #2
Valloric
Created Sigil, FlightCrew
Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.
 
Valloric's Avatar
 
Posts: 1,978
Karma: 350515
Join Date: Feb 2008
Device: Sony Reader PRS 505
Quote:
Originally Posted by James_Wilde View Post
Now the words "Nǐhǎo", "zhěxič" and "zŕijiŕn" should appear in italics. They don't, and the first word, on my reader and in Adobe epub reader shows as N?h?o. In Calibre and Sigil it appears as Nǐhǎo but not in italics. No other italics appear as they should either.
If the epub came from Sigil, the path should be "src: url(../Fonts/Times New Roman Regular.ttf)"; notice that the Fonts folder starts with a capital F in Sigil 0.2.x. This is important.

The problem with embedded italic fonts not displaying comes from a Qt bug, which both Calibre and Sigil use.
Valloric is offline   Reply With Quote
Old 09-06-2010, 06:19 PM   #3
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,188
Karma: 727236
Join Date: Sep 2009
Device: PRS-505
Quote:
Originally Posted by James_Wilde View Post
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>&nbsp;</p>
Now the words "Nǐhǎo", "zhěxič" and "zŕijiŕn" should appear in italics.
Those words are covered by a span using class="S-T2". You haven't shown us the code for that class.
charleski is offline   Reply With Quote
Old 09-06-2010, 08:18 PM   #4
pholy
Booklegger
pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.pholy ought to be getting tired of karma fortunes by now.
 
pholy's Avatar
 
Posts: 1,787
Karma: 7999034
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?
pholy is offline   Reply With Quote
Old 09-07-2010, 04:34 AM   #5
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,054
Karma: 4571547
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.
Jellby is offline   Reply With Quote
Old 09-07-2010, 05:36 AM   #6
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
Quote:
Originally Posted by pholy View Post
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?
Thanks, Pholy. Are you referring to the ", serif" after the font name? So that the reader's default serif font might be used by mistake.
James_Wilde is offline   Reply With Quote
Old 09-07-2010, 05:39 AM   #7
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
Quote:
Originally Posted by Valloric View Post
If the epub came from Sigil, the path should be "src: url(../Fonts/Times New Roman Regular.ttf)"; notice that the Fonts folder starts with a capital F in Sigil 0.2.x. This is important.
Oh crap, thanks Valloric. I'll take a good look at that.

Quote:
The problem with embedded italic fonts not displaying comes from a Qt bug, which both Calibre and Sigil use.
Thanks for this, too. I'll check it out.
James_Wilde is offline   Reply With Quote
Old 09-07-2010, 05:40 AM   #8
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
Quote:
Originally Posted by charleski View Post
Those words are covered by a span using class="S-T2". You haven't shown us the code for that class.
Sorry Charleski. Here it is:


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
    }
James_Wilde is offline   Reply With Quote
Old 09-07-2010, 05:46 AM   #9
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
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"?
James_Wilde is offline   Reply With Quote
Old 09-07-2010, 06:07 AM   #10
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,188
Karma: 727236
Join Date: Sep 2009
Device: PRS-505
Quote:
Originally Posted by pholy View Post
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.
...
Should this be added to the list of ADE bugs and quirks?
You're going to have to describe the problem in more detail, because I can't see any issues there. A font-face definition like
@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.
charleski is offline   Reply With Quote
Old 09-07-2010, 03:46 PM   #11
Valloric
Created Sigil, FlightCrew
Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.Valloric ought to be getting tired of karma fortunes by now.
 
Valloric's Avatar
 
Posts: 1,978
Karma: 350515
Join Date: Feb 2008
Device: Sony Reader PRS 505
Quote:
Originally Posted by James_Wilde View Post
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"?
Not really, no. Sigil expects an ".epub" file.

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.
Valloric is offline   Reply With Quote
Old 09-07-2010, 05:07 PM   #12
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
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.
James_Wilde is offline   Reply With Quote
Old 09-07-2010, 05:15 PM   #13
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
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
James_Wilde is offline   Reply With Quote
Old 09-07-2010, 08:05 PM   #14
charleski
Wizard
charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.charleski ought to be getting tired of karma fortunes by now.
 
Posts: 1,188
Karma: 727236
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.
charleski is offline   Reply With Quote
Old 09-08-2010, 09:51 AM   #15
James_Wilde
Guru
James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.James_Wilde ought to be getting tired of karma fortunes by now.
 
James_Wilde's Avatar
 
Posts: 793
Karma: 4727110
Join Date: Aug 2010
Location: Sweden
Device: Iriver Story
Quote:
Originally Posted by charleski View Post
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.
Done that, Charleski. Result is now:

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.
Attached Files
File Type: epub AMOC9.epub (1.39 MB, 105 views)
James_Wilde is offline   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
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


All times are GMT -4. The time now is 01:41 AM.


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