View Single Post
Old 09-06-2010, 06: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