fonts for publications
Font handling on SC is quite complex due to the support for many languages, including non-Latin scripts.
On the web, we were an early adopter of CSS @font-face, and have prided ourselves on quality typography. Failing to find an adequate free font that would meet our uses, we used Rosetta's "skolar" font. This has evolved over the years and is—with its massive glyph set, companions in Devanagari and Hindi, its sans, and variable fonts support—one of the most capable fonts available.
To supplement it, we use other fonts, primarily from Google's Noto collection. Occasionally we use other fonts, especially when a particular local script is not great in Noto.
Support for @font-face is pretty good on the web these days, and this all works reasonably well. We'll have to consider what to do when handling publications in various languages.
EPUB
These technically support @font-face and we can bundle fonts with our EPUBs. However in real life support is sketchy, and users often override file support.
I am leaning to not adding fonts to EPUB files. I wonder what will happen with non-Latin scripts, though? I suppose that readers in those languages will already have appropriate font support on their devices?
LaTeX
We will use LuaLaTeX, which allows the use of any Unicode font. Unlike HTML/EPUB, there is no concept of "fallback" font in LaTeX. So all fonts have to be explicitly provided. LaTeX depends strongly on hyphenation (more so than CSS, where it is an afterthought), and hyphenation patterns per-language must be supplied. These means that not only must there be a language defined for the document, but each quoted term in another language must have its own markup, and fonts for these must be supplied.
We'll have to define a markup for languages. I'm not sure what the best practices might be, but one way would be to define the language and font use in the head, then use the ISO code to call that locally.
This mainly applies when quoting words from ancient texts such as \pli{pāli} or \lzh{古文}.
Support for root languages (pli, san, lzh, xct) should be added by default to all our LaTeX files.
It's not going to be easy, due to scaling issues among other things. But at least we can supply sane defaults and make sure all the characters are actually visible.
Another tricky area will be support for variable fonts. If we can get them working in LaTeX, great! If not, we'll have to figure a workaround.
styling options
While we should ensure a reasonable output, it's not the case that the fonts that work best for us on the web will necessarily be the best for a print publication. Generally speaking, the screen rewards a more robust design with tall x-height, strong serifs, and low contrast, all of which describe Skolar. In print, I prefer a more delicate design such as a Garamond.
And of course there may be many variations that people might prefer.
So we should provide an export of the raw tex files. The people can tweak the styles as they like.
method
Let's assume we won't be supplying fonts with the standalone HTML or EPUB files.
For LaTeX, let's do something like this.
- define main language per document
- use the same font(s) that are used for that language on SC.
- ensure support for root languages is supplied by default.
- perhaps we should add default support for inline quotes in English as well.
- when running LaTeX, the fonts will have to be available at a defined path; use the path where they are on SC. (suttacentral/client/files/fonts)
things needing testing
- scaling fonts
- line-height
- use of woff2 in LaTeX?
- use of variable fonts in LaTeX?
checkout
https://github.com/Fuzzypeg/Coelacanth
It's a beautiful and full-featured old-style font in free release. Awesome! But still under (slow) development.