BACK TO BLOG LIST

SUBSCRIBE: RSS ATOM

Updating the Font for Physical Books

by NJB // // Silverthorne, CO

© 2024 NJB

CC-BY-SA 4.0

I am preparing to publish a new physical book, and I thought I’d share the current workflow.

The goal of my process is to use the same Shanty file to produce both e-books and physical editions. When I produced my novel November in America using Amazon’s KDP platform, I was frustrated by the need to format my book in a word processor, and then format it again in their e-book program.

The process is set up for making physical books measuring five inches wide, and eight inches tall, with hard-coded margins and line heights. I use a serif font for the headings and paragraphs. The paragraphs in the books are justified.

First, I run the Shanty file through a program I call Lone Cypress. This program breaks each paragraph into lines of the required width, and then breaks the text down into pages. One of the important features of Lone Cypress is to set hyphenations for words. The program prompts me when a word exceeds the limit on line length. If a word needs hyphenation, I set the break point. The assigning of these break points is done manually.

Lone Cypress knows, for the most part, to discount symbols associated with Shanty, like asterisks or words nested in at-signs. For syntax that represents certain characters, like two hyphens for an em-dash, it will deduct the space of the former, and add in the space of the latter.

Lone Cypress uses a table for the widths of each character to calculate how many characters fit on a line. There are tables for regular text, italic, bold, and bold-italic.

The output of Lone Cypress is a new copy of the Shanty text with line breaks added to paragraphs, split into pages. As it’s currently set up, there are 30 lines for a regular page, and 24 lines for the start of a chapter.

Lone Cypress has improved the quality of the books significantly. Before Lone Cypress, I reformatted the text by eyeballing it, setting line breaks based on total number of characters on a line. Since Lone Cypress measures the width of each character separately, which is what you want for a proportionally-spaced font, the result looks much, much better. Based on some tests I’ve run, I’m able to format a book that looks better, and do it up to three times faster.

Second, the newly formatted text is then fed through a second program which I simply call Print Shanty. This program splits the new text into an array of pages. Each page is parsed into the SVG format. A table of contents is generated from chapter headings, and page numbers are added to each page, taking the length of the table of contents into account. Copyright, ISBN, LCCN, and licensing information are loaded in from a separate JSON file, and added to the book. The SVG pages are collated for printing, and laid out in an HTML file.

This HTML file has a stylesheet designed for printing. Specifically, I wrote it to have as small a top margin as possible, which saves time when I later cut the book down to size.

This HTML file is then rendered in my browser, where I save it as a PDF file. This PDF can then be shared and printed. For a 5x8 book, I cut half an inch off each long side, and a half-inch off the bottom of the short side. Because the pages are collated, all I have to do is cut the pages down the middle, fold them together, and the pages will be in correct order.

Ideally, both programs would be combined, and there would be a way to save my place in Lone Cypress. That way, I wouldn’t have to work on a whole book in one sitting.

In the long-term, the program needs many updates. It would be nice to have it format text for multiple columns and different page widths. It’s also important that the program support Roman-numeral page numbering, for book content like forewords and introductions.

Lastly, there should be support for indexing. This would start with some additional markup for Shanty, something like @ind@. The program could then build an array of where @ind@ appears, the word or phrase associated with it, and the page number.

Why Are We Doing This?

It’s fair to ask why I don’t use a readily-available desktop publisher like Adobe InDesign or Microsoft Publisher. Within the free-software community, there’s Scribus, which the Free Software Foundation uses to produce its semiannual bulletin.

One reason is that I wanted it to be analogous to the experience with Arrowhead when making e-books. When you write in a markup language, you can focus more on the writing, and let the parser figure out how it will look. I still remember the experience of writing screenplays in the markup language Fountain. Instead of worrying about the complexities of the screenplay format, I could—write! That’s the feeling I’ve tried to bring to writing books with Shanty: write, and then create your book with one push of a button, or one command in the terminal. That’s the compass that guides this project.

A Better Font?

While working on the latest book, I had a pleasant surprise. Since I’m loading an HTML document full of SVG images, the text uses the default text of my browser. In my case, that’s Liberation Serif. While it has some issues, I felt it was good for the books.

Then, by accident, I forgot that I had set my default font to Bitstream Charter, the default serif font for Nantucket E-Books. The test book was rendered in Charter, and it looked great! Somehow, Charter looked better using the Liberation Sans width-tables I measured out than the actual Liberation Serif. I don’t know how it works, but it works. These are going to be great-looking books.

One of the best improvements is in the placing of apostrophes. Liberation Serif puts curly apostrophes too far to the right of the preceding character, while in Charter, it’s comfortably close.

This has been my update on the software that turns Shanty into physical books. I have been very excited about this work, and I look forward to sharing the book I’ve been working on.

SHOW/HIDE COMMENTS
  • No comments yet.
  • WANT TO COMMENT?

    SEND AN E-MAIL TO NJB@NANTUCKETEBOOKS.COM WITH THIS SUBJECT LINE: