View Full Version : want to fix Cryoburn (Lois M Bujold) character spacing


jlocicero
04-29-2013, 11:25 AM
I've got the hard copy of this book, and it came with a CD with all of Lois McMaster Bujold's Barrayar books in various digital formats as a nice bonus.

Everything is great except for the title book. The character spacing for the Cryoburn digital book is too close - the letters are all pushed together. I find this kind of hard to read.

I can't get my mobile reader (mostly Kindle on iOS but now also Marvin for iPad) to adjust this.

Can anyone help me fix the spacing in the file itself? Tweak the CSS? I am hopeless at this, but the file (book) itself seems to be freely available. If not, I can post the CSS to this thread if someone can help. Or is there a way to do it in Calibre or Sigil?

Hope this question makes sense. Thanks for you help!

Turtle91
04-29-2013, 03:10 PM
Depending on your country it can be illegal to have someone else do the actual editing for you if the book is still under copyright, which I'm pretty sure Bujold's are. You can post the css though, and we can see if there is anything obvious.

Use sigil to open, then right click on the css file and "save as".

jlocicero
04-29-2013, 03:13 PM
Thanks for your help! Here is the CSS. Compared to another I looked at, this one really looks like a mess.

If you can spot anything I could change, that would be great!

@namespace h "http://www.w3.org/1999/xhtml";
.Apple-tab-span {
white-space: pre
}
.calibre {
display: block;
font-size: 1.41667em;
margin-bottom: 0;
margin-left: 5pt;
margin-right: 5pt;
margin-top: 0;
page-break-before: always
}
.calibre1 {
font-weight: bolder
}
.calibre2 {
display: block
}
.calibre3 {
font-style: italic
}
.calibre4 {
display: block;
page-break-after: always
}
.calibre5 {
display: table-row-group;
vertical-align: middle
}
.calibre6 {
display: table-row;
vertical-align: inherit
}
.chapter {
display: block;
font-family: Helvetica;
font-size: 1.41176em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 12px;
margin-left: 0;
margin-right: 0;
margin-top: 139.5px;
text-align: center
}
.p {
display: block;
font-family: Impact;
font-size: 1.41176em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: center
}
.p1 {
display: block;
font-family: "Minion Pro";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: center
}
.p10 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 15px;
text-align: justify
}
.p11 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: justify
}
.p12 {
display: block;
font-family: "Times New Roman";
font-size: 0.41176em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 9px
}
.p13 {
display: block;
font-family: "Minion Pro";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: justify
}
.p14 {
display: block;
font-family: "Times New Roman";
font-size: 0.52941em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: center
}
.p15 {
display: block;
font-family: "Times New Roman";
font-size: 0.41176em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0
}
.p16 {
display: block;
font-family: Helvetica;
font-size: 0.52941em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 11px;
text-align: center
}
.p17 {
display: block;
font-family: "Times New Roman";
font-size: 0.52941em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 10px;
text-align: center
}
.p18 {
display: block;
font-family: "Minion Pro";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 14px;
text-align: justify
}
.p19 {
display: block;
font-family: Helvetica;
font-size: 1.41176em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 12px;
margin-left: 0;
margin-right: 0;
margin-top: 108px;
text-align: center
}
.p2 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 15px;
text-align: center
}
.p20 {
display: block;
font-family: Helvetica;
font-size: 1em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 12px;
margin-left: 0;
margin-right: 0;
margin-top: 33.9px;
text-align: center
}
.p21 {
display: block;
font-family: Helvetica;
font-size: 1.41176em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 4.5px;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 40px;
text-align: justify
}
.p22 {
display: block;
font-family: Helvetica;
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 4.5px;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: justify
}
.p23 {
display: block;
font-family: "Minion Pro";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0
}
.p24 {
display: block;
font-family: "Minion Pro";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 14px
}
.p3 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 4.5px;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: center
}
.p4 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: center
}
.p5 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 9px;
min-height: 15px;
text-align: center
}
.p6 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 4.5px;
margin-left: 0;
margin-right: 0;
margin-top: 4.5px;
text-align: center
}
.p7 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 4.5px;
text-align: center
}
.p8 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0
}
.p9 {
display: block;
font-family: "Times New Roman";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
min-height: 15px
}
.s {
font-family: "Lucida Grande";
font-size: 1em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal
}
.s1 {
letter-spacing: -0.8px
}
.s2 {
font-family: "Times New Roman";
font-size: 1em;
font-style: normal;
font-variant: normal;
font-weight: normal;
letter-spacing: -0.8px;
line-height: normal
}
.s3 {
letter-spacing: -0.8px;
vertical-align: 1px
}
.s4 {
font-family: "Lucida Grande";
font-size: 1em;
font-style: normal;
font-variant: normal;
font-weight: normal;
letter-spacing: -0.8px;
line-height: normal
}
.s5 {
letter-spacing: -0.8px;
vertical-align: -8px
}
.s6 {
font-family: Helvetica;
font-size: 2em;
font-style: normal;
font-variant: normal;
font-weight: normal;
letter-spacing: -0.8px;
line-height: normal;
vertical-align: -8px
}
.t {
border-collapse: separate;
border-spacing: 2px;
display: table;
margin-bottom: 0;
margin-top: 0;
text-indent: 0
}
.td {
display: table-cell;
padding-bottom: 1px;
padding-left: 1px;
padding-right: 1px;
padding-top: 1px;
text-align: inherit;
vertical-align: inherit
}

Turtle91
04-29-2013, 03:24 PM
Use Sigil with the preview window open. Open a chapter where the text looks too scrunched in the code view. You should see some "class=" in the opening paragraph tag, eg. <p class="..."> right click on the class and select "go to link or style". That should open up your CSS to the correct style class.

There are two things you can look for that I noticed:
letter-spacing: -0.8px;
font-family: Impact;

I would remove one or both of those and check the preview window to see if that is to your liking.

the negative value in letter-spacing causes the letters to be closer together than normal and the impact font causes a bold/scrunched appearance.

jlocicero
04-29-2013, 04:08 PM
I would remove one or both of those and check the preview window to see if that is to your liking.

Thank you very much! I removed the "letter-spacing: -0.8px;" lines, and now it looks so much better.

Thank you again for helping me with this. Now I can enjoy reading the book without so much of my OCD kicking in!

Turtle91
04-29-2013, 04:26 PM
Glad it worked!

Cheers,

jlocicero
04-30-2013, 04:29 PM
Another question: can you suggest what to add to indent the beginning of paragraphs? I tried "text-indent: 2em" and that didn't seem to work. Or maybe I didn't put it in the right place.

Can you help?

Turtle91
04-30-2013, 04:57 PM
Unfortunately when you are working with a file that has been converted using Calibre it is more difficult to determine which class does what...it doesn't use descriptive class names, just numbers.

However the process is the same. Open a chapter and find a normal paragraph that you would like to have indented. Most of those paragraphs SHOULD have the same class. Right click on the <p class="..."> and "go to link or style" you can edit or add "text-indent:1.2em;" there.

However...the styling MAY be overridden by other classes depending on several factors. You would have to really study the Spec to determine the numerical priority it determines....*shudder*...
If the first attempt doesn't cause all your normal paragraphs to indent as you wish, then you can go to the top of your css file (just below all the .calibre styles and find the .p style. (this is really a quite ridiculous name for a class just to define the style of a paragraph: <p class="p">:blink:) You can try adding your indent there.

If that still doesn't work, then add your own style to the CSS by defining all paragraphs to have an indent as default.

p {text-indent:1.2em} (notice there is no "." in front of the p)

This SHOULD not effect the other paragraphs that are not supposed to be indented, but YMMV. I can't really tell how the html calls the different classes without seeing the code.

The last thing to think of...or maybe the first thing...does your reading device (kindle) allow you to set the paragraph indent within it's properties?? I know Marvin does - tap the "aA" at the top of an open book and you can select the indent you desire by tapping on the two "Paragraph indent" buttons. That is the easiest place to fix it but it will only apply to that book on that device - it doesn't change the file itself.

Turtle91
04-30-2013, 09:40 PM
I was just looking at this again...I'm really bored - can you tell?

I don't think adjusting the .p class (below all the .calibre styles) is going to help you, because it is set to center-align the text...so, you can skip that step.

Cheers,

jlocicero
04-30-2013, 11:04 PM
Thank you very much for helping me. I am trying to learn...

But first, what program can I open a .mobi book in? I can open it in Calibre, but only to view. I can't open it in Sigil to edit...

I don't want to be a pain, so if you stop being bored, I understand!

Turtle91
04-30-2013, 11:12 PM
You wuld need to use calibre to convert the mobi to epub before you can edit it. Unfortunately calibre doesn't convert books plagued with DRM. You would have to talk to a guy named Apprentice Alf who lives on google street to go any further.

jlocicero
04-30-2013, 11:20 PM
Ah, I'm sorry. You were giving me advice on how to adjust the epub version. I thought you were giving me advice on how to fix the mobi version. So yes, I can do what you advised. I'll get back to you once I'm finished!

Turtle91
04-30-2013, 11:29 PM
All but the last post was helping you edit the ePub, the last post was letting you know that you can use calibre to change mobi to ePub.

Once you use calibre to convert mobi to ePub then you can do all the editing you desire (within legal copyright bounds of course).

JSWolf
05-01-2013, 12:01 AM
Post a small section of the XML code so we can see what class needs the text-indent.

Toxaris
05-01-2013, 03:35 AM
Should I be shocked to see that an official ePUB used Calibre for conversions? I am actually.

jlocicero
05-01-2013, 06:33 PM
Post a small section of the XML code so we can see what class needs the text-indent.

Here you go:

<body class="calibre">
<p class="chapter" id="calibre_toc_2"><span class="s1"><i class="calibre3">Chapter One</i></span></p>

<p class="p9"></p>

<p class="p13"><span class="s1">Angels were falling all over the place.</span></p>

<p class="p13"><span class="s1">Miles blinked, trying to resolve the golden streaks sleeting through his vision into mere retinal flashes, but they stubbornly persisted as tiny, distinct figures, faces dismayed, mouths round. He heard their wavering cries like the whistle of fireworks from far off, the echoes buffeted by hillsides.</span></p>

I've been trying to fix this myself. At first I used Turtle91's suggestion to add "p {text-indent:1.2em}", but this caused the centered chapter titles ("Chapter One", etc.) to be indented. So I looked a little deeper and saw that each paragraph was using "p13" and "s1". I assume "p13" refers to different paragraph styles - why there are so many is beyond me. I tried adding the indent to "p13" (what is a "span class" anyway?). And it worked!

Here is what I came up with:

.p13 {
display: block;
font-family: "Minion Pro";
font-size: 0.70588em;
font-style: normal;
font-variant: normal;
font-weight: normal;
line-height: normal;
text-indent: 1.2em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
text-align: justify
}


I assume I could have added it anywhere within the braces, right?

Here is the original:

.s1 {
letter-spacing: -0.8px
}


And I just took it out:

.s1 {
}


Done! Thank you for all your help! I still have to test it on Kindle iOS, but for that I have to take it home to convert with Calibre. I'm not scared to tweak this stuff any more, so I will try to add some space between the chapter title and the body of text.

Thanks again!

JSWolf
05-03-2013, 03:09 PM
Should I be shocked to see that an official ePUB used Calibre for conversions? I am actually.

BAEN has been using Calibre for a long time now.