View Single Post
Old 12-30-2011, 05:35 AM   #256
kado
Enthusiast
kado began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Dec 2011
Device: Nook 1st Edition
Quote:
A Calibre conversion puts the @font-faces into every html file in the epub, rather than once in the .css file (don't know why).
This upsets me as well Jackie_W. Because I have a very few epubs I came across on the web in which all Turkish fonts are displayed correctly and when I check the file content of these very rare epubs, I see a separate stylesheet.css file in which after the first line there is a whole body of @font-face decleration as exactly as proposed in the earlier posts here. So, not having this css file just gives me another reason to fail, perhaps.

I see my situation like this: I have been trying to solve an equation with 3 unknowns. To be able to sort it out, all these 3 unknowns should be identified correctly. The unknows I am facing are:
1- Whether the font I try to use includes all Turkish characters correctly. I currently try to use LiberationSerif as it is the one suggested in many blogs.
2- Whether the folder in which this font is located are correctly referred to for my Nook within @font-face declaration, i.e. the blue bits in your post.
3- Whether Calibre correctly converts epub to epub as it was expected to. I understand it does not "Override Css" but puts an "Extra Css" as was named under the "Look & Feel" menu in the latest version of Calibre I have been using, namely 0.8.32. From this different menu item naming, I tend to think that, before Calibre was just overriding the stylesheet.css but now it just adds it by renaming it to stylesheet1.css. But I wonder where the stylesheet.css file then...

I realize my long-awaited success will not only be when I correctly resolve each of these 3 unknowns - for each of which there are dozens of alternatives to try; but also I implement only the correct alternatives at once. Perhaps I finally and unwittingly figured out the second unknown correctly but all others were not right when I gave it a try, which eventually led to a failing epub full of ? marks instead of Turkish letters.

Frankly speaking I have tried almost all combinations and I am almost about to give up... I cannot tell you enough since when and how many days I have spent so far for a permanent solution.

As a last attempt I would like to summarize what I have done so far, despite the fact that I realize this is a thread for Sony readers only, not for Nook; however, I do hope you guys would allow me here as I see many expert comments on this thread relevant to my problem as it is mainly an epub/font/css/Calibre issue:

1- "The font" with Turkish Character set: As per a suggestion in one of the blogs I have read, I first used the LiberationSerif font available in the Calibre2\resources\fonts folder, even though I still don't get the logic behind it. Does this font have a built-in and guaranteed Turkish char set inside? Trials, trials, and later I downloaded the very same font from a website specialized on fonts, which also allowed me for a "test-drive" to be able to check whether the chars I am interested in are displayed correctly. Trials, trials And finally I just used the LiberationSerif set I came across inside one of those rare epubs with which my Nook worked correctly. There were this LiberationSerif set embedded inside the epub and I just copied them to "my fonts" folder in my Nook. I don't know if I could do anything furhter to make sure that the font set is correct. How can I see if a font I am interested in contain all the Turkish characters correctly? I suspect some fonts are already installed in my Windows 7 and therefore they are displayed correctly in W7, but not in Nook, which misleads me a great deal, I think. I use W7 in English, could it be the reason?

2-"Syntax" for referring to "my fonts" folder in @font-face: My Nook shows the location of epub files as:
Code:
nook/my documents/[writer's name]/[book name.epub]
Truly, when I connect my Nook into my computer, the drive name becomes "nook"; when I double click the drive, I see all relevant folders right beneath the root such as "my document", "my fonts" etc. Therefore, I don't understand where "system/fonts", "data/fonts" etc come from. Nevertheless I have tried all of them but failed. I even thought of the blank character between "my" and "fonts" and used %20 for a proper url reference. No hope. I later chanded the folder "my fonts" to "fonts" not to add another uncertainty to my already complex equation. I now realize that I will keep on failing on absolute referencing for the fonts folder unless I certainly know the inner folder structure of Nook Standard. So far, nobody does seem to be aware of that. For Nook Color it might be "system/fonts" and for Sony "data/fonts" but for my Nook Standard I don't know what it is. Therefore, in order to eliminate this parameter, now I am thinking of relative referencing -thanks to Wikipedia for examples. Consider this reasoning: If the book is under "my documents" folder which is under "[writer's name]" folder, and the fonts folder is located under the root and inside "fonts" folder, would it be correct to refer to the fonts in @font-face declaration with:
Code:
src: url(res://../../fonts/LiberationSerif-Italic.ttf);
Do I need "res://" bit here as I have only come across examples without that bit? It doesn't seem to be harmful as it seems merely a protocol which forces the reader to resolve the string, but who knows. I should say, with all what I have been trying to achieve here, I am swimming in foreign waters and this is completely out of my league. I hope what I type makes sense for all of you computer experts.
If this syntax is succesful, it would just give me one less issue to worry about.

3- Calibre "epub to epub" conversion: The epub file which perfectly displays the long-sought-for Turkish characters have a stylesheet.css file and is perfectly a match for what was suggested earlier in posts #9 and #18 and is attached below - the second line is quite long and goes to the right:

Code:
@namespace h "http://www.w3.org/1999/xhtml";
@font-face {font-style: italic;font-family: 'Liberation', serif, sans-serif;font-weight: normal;src: url(LiberationSerif-Italic.ttf);}@font-face {font-style: normal;font-family: 'Liberation', serif, sans-serif;font-weight: normal;src: url(LiberationSerif-Regular.ttf);}@font-face {font-style: italic;font-family: 'Liberation', serif, sans-serif;font-weight: bold;src: url(LiberationSerif-BoldItalic.ttf);}@font-face {font-style: normal;font-family: 'Liberation', serif, sans-serif;font-weight: bold;src: url(LiberationSerif-Bold.ttf);}.calibre {
    display: block;
    font-size: 1em;
    margin-bottom: 0;
    margin-left: 5pt;
    margin-right: 5pt;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0;
    page-break-before: always
    }
.calibre1 {
    display: block;
    font-family: Arial, sans-serif;
    font-size: 1em;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
    margin-top: 0;
    text-indent: 0
    }
.calibre2 {
    font-weight: bolder
    }
.t {
    font-size: 1.66667em
    }
.t1 {
    font-size: 1em
    }
What I end up with after converting a non-Turkish epub to a hopefully-Turkish epub is like this - The filename is stylesheet1.css with a "1" at the end and does not look similar to the previous one at all; I see LiberationSerif which gives me a hope though:

Code:
@namespace h "http://www.w3.org/1999/xhtml";
.calibre {
    display: block;
    font-family: "LiberationSerif", serif;
    font-size: 1em;
    line-height: 1.2;
    margin-bottom: 0;
    margin-left: 5pt;
    margin-right: 5pt;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0
    }
.calibre1 {
    display: block;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1em
    }

Having seen this and considered it as an incorrect content for the css file, I decided to manually update the stylesheet.css with the @font-face statement that I believe should be working as stated below and added as the second line:
Code:
@namespace h "http://www.w3.org/1999/xhtml";
@font-face { 
font-style: italic; 
font-family: 'LiberationSerif', serif, sans-serif; 
font-weight: normal; 
src: url(res://../../fonts/LiberationSerif-Italic.ttf); 
} 
@font-face { 
font-style: normal; 
font-family: 'LiberationSerif', serif, sans-serif; 
font-weight: normal; 
src: url(res://../../fonts/LiberationSerif-Regular.ttf); 
} 
@font-face { 
font-style: italic; 
font-family: 'LiberationSerif', serif, sans-serif; 
font-weight: bold; 
src: url(res://../../fonts/LiberationSerif-BoldItalic.ttf); 
} 
@font-face { 
font-style: normal; 
font-family: 'LiberationSerif', serif, sans-serif; 
font-weight: bold; 
src: url(res://../../fonts/LiberationSerif-Bold.ttf); 
} 
body { 
margin-right: 8pt; 
font-family: 'LiberationSerif', serif; 
}
.calibre {
    display: block;
    font-size: 1em;
    margin-bottom: 0;
    margin-left: 5pt;
    margin-right: 5pt;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0;
    page-break-before: always
    }
.calibre1 {
    display: block;
    margin-bottom: 1em;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1em
    }
But no success again...

Thinking now, perhaps what you have said Jackie_W is right, perhaps Calibre is just working fine but I ruin the overall file integrity by manually manipulating stylesheet.css with this version of Calibre I have. Because, as you reasoned I checked out the index.html file and all LiberationSerif font statements were there. This brings my mind another question for proper referencing to the fonts folder: What is the correct file now for relative referencing: the html files or stylesheet.css? This might be an issue if these two files are located under different folders within the epub; if not, just forget it. But I recall an epub file inside of which there were several html files split probably because of size limitation and Calibre's option for files larger than 260K. These files were, if I am not wrong, were located under another folder. If this is the case the above question of mine still applies.

As you see guys, I feel I am at the end of my adventure with my Nook. And my success is totally depend on fixing each of 3 unknowns and utilizing them in one lucky try.

Could you guys give a hand of what items are we certain, what not. This could help me narrow down my trials and reach a final, permanent and long-awaited solution.

Many thanks in advance.

Kadir
kado is offline   Reply With Quote