How the OpenType font system works

Everyone knows what fonts are, but do you know how they work? Learn the basics of digital typography.
637 readers like this.
Open source fonts

Jason Baker for Opensource.com. CC-BY-SA 4.0.

Digital typography is something that we use every day, but few of us understand how digital fonts work. This article gives a basic, quick, dirty, oversimplified (but hopefully useful) tour of OpenType— what it is and how you can use its powers with free, libre, and open source software (FLOSS). All the fonts mentioned here are FLOSS, too.

What is OpenType?

On the most basic level, a digital font is a "container" for different glyphs plus extra information about how to use them. Each glyph is represented by a series of points and rules to connect those points. I'll not delve into the different ways to define those "connections" or how we arrived there (the history of software development can be messy), but basically there are two kinds of rules: parabolic segments (quadratic Bézier curves) or cubic functions (cubic Bézier curves).

The TTF file format, generally known as TrueType Font, can only use quadratic Bézier curves, whereas the OTF file format, known as OpenType Font, supports both.

Here is where we need to be careful about what we are talking about: The term "OpenType" refers not only to the file format, but also to the advanced properties of a typeface as a whole (i.e., the "extra information" mentioned earlier).

In fact, in addition to the OpenType file format, there are also substitution tables that, for example, tell the software using that font to substitute two characters with the corresponding typographical ligature; that the shape of a character needs to change according to the characters that surround it (its "contextual alternate"); or that when you write in Greek, a σ at the end of a word must be substituted with a ς. This is what the term "smart fonts" means.

And, to make things more confusing, including OpenType tables on TrueType fonts is possible, such as what happens on Junicode.

A quick example

Let's see a quick example of smart fonts in use. Here is an example of Cormorant with (top) and without (bottom) OpenType features enabled:

Example of OpenType features

opensource.com

Each OpenType property has its own "tag" that is used to activate those "specialties." Some of these tags are enabled by default (like liga for normal ligatures or clig for contextual ligatures), whereas others must be enabled by hand.

A partial list of OpenType tags and names can be found in Dario Taraborelli's Accessing OpenType font features in LaTeX.

Querying fonts

Finding out the characteristics of an OpenType font is simple. All you need is the otfinfo command, which is included in the package lcdf typetools (on my openSUSE system, it's installed as texlive-lcdftypetools). Using it is quite simple: On the command line, issue something like:

otfinfo [option] /path/to/the/font

The option -s provides the languages supported by the font, whereas -f tells us which OpenType options are available. Font license information is displayed with the -i option.

If the path to the font contains a space, "scape" that space with an inverted bar. For example, to know what Sukhumala Regular.otf offers when installed in the folder ~/.fonts/s/, simply write in the terminal:

otfinfo -f ~/.fonts/s/Sukhumala\ Regular.otf

Using OpenType tables on LibreOffice Writer

LibreOffice version 5.3 offers good support for OpenType. It is not exactly "user-friendly," but it's not that difficult to understand, and it provides so much typographical power that it shouldn't be ignored.

To simultaneously activate "stylistic sets" 1 and 11 on Vollkorn (see screenshot bellow), in the font name box, write:

Vollkorn:ss01&ss11

The colon starts the "tag section" on the extended font name and the ampersand allows us to use several tags.

But there is more. You can also disable any default option. For example, the Sukhumala font has some strange contextual ligatures that turn aa into ā, ii into ī, and uu into ū. To disable contextual ligatures on Sukhumala, add a dash in front of the corresponding OpenType tag clig:

Sukhumala:-clig

And that's it. As I said before, it's not exactly user friendly, especially considering that the font name box is rather small, but it works!

And don't forget to use all of this within styles: Direct formatting is the enemy of good formatting. I mean, unless you are preparing a quick screenshot for a short article about typography. In that case it's OK. But only in that case.

Using OpenType on LibreOffice Writer

opensource.com

There's more

One interesting OpenType tag that, sadly, does not work on LibreOffice yet is "size." The size feature enables the automated selection of optical sizes, which is a font family that offers different designs for different point sizes. Few fonts offer this option (some GUST fonts like Latin Modern or Antykwa Półtawskiego; an interesting project in its initial stages of development called Coelacanth; or, to a lesser extent, EB Garamond), but they are all great. Right now, the only way to enjoy this property is through a more advanced layout system such as XeTeX. Using OpenType on XeTeX is a really big topic; the fontspec manual (the package that handles font selection and configuration on both XeTeX and LuaTeX) has more than 120 pages, so… not today.

And yes, version 1.5.3 of Scribus added support for OpenType (in addition to footnotes and other stuff), but that's something I still need to explore.

RGB-es, aka the Tolkian Penguin
On the web I'm known as RGB, RGB-es or el pingüino tolkiano (the Tolkian Penguin). I write, mostly in Spanish but also in English and Italian, about free software, text processing and typography.

10 Comments

The great thing about Scribus is that the detection of these OTF features is automatic. One thing you quickly find out is that not all OTF fonts have them and what they have is variable from one font to the next.
In the new Text Properties palette, there is a section for Font Features, where you have the ability to choose ligatures, old-style numerals, as well as other things when available.

Hi! Typography toolbar only works for Linux Libertine G and Linux Biolinum G and it's centred on their Graphite features. Some Graphite tags have the same name than the corresponding OpenType tags and maybe that's the reason it seems to work with other fonts, but the extension is unmaintained (as the above mentioned Graphite fonts) so be careful at using it.

Regards,
Ricardo

In reply to by JoWa (not verified)

Open Type use smart font ideas from 1990s: Apple QuickDraw GX and Adobe Multi Master fonts.

OpenType is from the 1990s. Microsoft developed TrueType Open, and released it with Windows 95. https://www.microsoft.com/typography/tt/win95tt.aspx

In 1996, Adobe joined Microsoft to develop TrueType Open further, to include support for both the curves used in TrueType (which was developed by Apple 1987–1989), and the curves used in PostScript-fonts, and they renamed it to OpenType. Adobe also began to convert their Font Folio to OpenType. OpenType is standardised as Open Font Format. https://www.iso.org/standard/66391.html

In reply to by Châu (not verified)

Hi, I am the author the the Sukhumala OpenType font, which uses Contextual Ligatures for Velthuis encoding of Pali. Pali scholars would write the word Sukhumāla as Sukhumaala using the Velthuis system.

I just updated my Sukhumala font on www.softerviews.org with a new version, which uses a Stylistic Set instead of Contextual ligatures. This avoids the problem for applications that don't allow disabling of contextual ligatures, or only allow it by disabling all ligatures.

The latest version also improves the fractions feature to support simple formulae like (a+b)/(c-d).

I am the author of Sukhumala. In the latest version 2.30, the contextual ligatures used for the Velthuis encoding of Pali have been replaced with a Stylistic Set. These are not enabled by default, so don't cause problems in applications that cannot disable Contextual Ligatures without disabling all ligatures.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.