Browsers
Typoteka lays your book out in the browser you use it in. Browsers measure and break text in slightly different ways, so a line, or a page break, of the same book can fall in a different place in different browsers. Typoteka evens out every difference it can; the ones below are what is left, and what it does about each.
Use one browser for a book. Write, check the pages and export the PDF in the same browser, and if you compare a book with a PDF you made earlier, make the new one in that browser too. Then nothing on this page will surprise you.
Typoteka is tested in Chrome and Firefox.
Hyphenation
Each browser breaks words with its own dictionary, and they do not agree: Chrome on a Mac splits some English words in odd places ("reg-arded"), and a word that breaks in one browser may not in another. Every line after that moves, and sometimes a page.
So Typoteka breaks words itself, with one dictionary for every browser, in the book's language (language in typoteka.json), wherever the style hyphenates. It is on by default: Project Settings → Advanced → Hyphenate in the editor. Turn it off to let the browser do it.
Typoteka has dictionaries for more than seventy languages. Text in a language without one is not hyphenated while the setting is on.
Orphans and widows
A paragraph's first line left alone at the foot of a page is an orphan; its last line alone at the top of the next, a widow. Styles say how many lines to keep together, and Chrome follows them, but Firefox does not. Typoteka keeps them itself in every browser, so the pages break in the same places. It is on by default: Project Settings → Advanced → Keep orphans and widows. Turn it off to leave it to the browser.
Numbered lists that continue on another page
When a numbered list runs onto another page, Firefox used to number the rest from 1 again. Typoteka keeps each item's number in every browser (Project Settings → Advanced → Fix numbered lists across pages, on by default).
Zoom
The editor draws the pages smaller or larger to fit your window, without laying the book out again: a line breaks in the same place at every zoom, and the same as in the PDF. A page laid out at one zoom and drawn at another could lose a line that only just fitted at its foot; Typoteka keeps it (Project Settings → Advanced → Fix pages at any zoom, on by default).
System typefaces
Some styles, such as Base, set the text in your computer's own typefaces instead of fonts of their own. Each browser picks and measures those typefaces a little differently, and so does each computer, so a book in such a style can break its lines differently from one browser, or one computer, to another. Styles with their own fonts do not have this problem.
Lines that only just fit
Browsers place text to a fraction of a pixel, each with its own rounding. A line that fits with a hundredth of a millimetre to spare in one browser can be a hair too long in another, which then carries its last word, or part of it, to the next line. It happens in about one line in a few hundred, and only now and then moves a page break.
Printing from Firefox
Firefox prints a few things differently from how it shows them on screen. Typoteka handles the two that affect every book:
- Bleed. A page with a bleed is a fraction of a pixel taller than Firefox expects, and it used to print a blank sheet after every page.
- Images in columns. Firefox lays columns out again when it prints and could split an image across two of them. Images are kept whole.
The styles that come with Typoteka print the same in every browser it is tested in. If you write your own, see Your own style for what to avoid: masks, blend modes and SVG filters show on screen but do not print from Firefox.
Columns and headings that span them
In a style with columns, a heading can run across all of them. Two things around such headings used to differ between browsers, and the styles that come with Typoteka are written so they do not:
- Before such a heading, Chrome shares the text out between the columns, and Firefox does it only if the style leaves the columns balanced, as CSS does by default.
- After such a heading, an image that does not fit at the foot of the page made Firefox carry all the text after the heading to the next page, where Chrome moved only the image.
If you write your own style with columns, see Your own style.