Wednesday, August 3, 2011

Fixed Width Font with Git-scribe

‹prev | My Chain | next›

Of my three immediate problems with git-scribe's mobi formatting, I have solved all but the code formatting. I have the book cover on the mobi front page. I have the bullet points on the same line with the bulleted text. Now I would like to get the code a little smaller so that it fits better on a Kindle.

I really hope this is a quick fix.

And it turns out to be. In stylesheets/scribe.css, I change the fixed font size to 8px:
tt {
font-family:consolas, 'lucida console', 'bitstream vera sans mono',
'courier new', monospace;
font-size: 8px;
That does make things smaller. But not quite small enough.

I had targeted 50 characters width in SPDY Book for all of my code samples. I generally aim for 60 characters in real world code, so 50 characters did not seem that far-fetched. Unfortunately, any code sample in SPDY Book that were just about 50 characters ended up wrapping. Dammit.

So I try 4px and even 2px for the font-size of tt text. To no avail. It seems that there is a hard, minimum font-size for fixed width text in the Kindle because the font-size remained the same—even when set to 2px.

Ah well. Maybe for the second edition of SPDY Book I will rework the code samples to be 45 characters or less. For now, I think I can live with a few lines wrapping.

Day #102

No comments:

Post a Comment