Using OpenType on XeTeX+LyX: Short Texts

It is quite simple to set LyX to use XeTeX instead of plain LaTeX or pdfTeX. On Document → Configuration → Fonts it is possible to select to use “non TeX typefaces” and then pick OpenType fonts for all typeface families. Then it’s enough to go to the Formats entry on that menu to choose to use PDF (XeTeX). Easy. But how could we activate a particular OpenType feature?

We can do that on several levels

  • Short texts (with code)
  • The whole document
  • Math formulae
  • Short texts (with character styles)

This is the first article on a four part miniseries. Today we’ll tackle the first point, but divided on two parts.

OpenType for the default font

If we’ve already defined a good OpenType font for the document and use XeTeX as renderer, then we just need to use the instruction “addfontfeature” the right way.

{\addfontfeature{RawFeature={+TAG1;-TAG2}} Text to receive the code }

will activate the OpenType feature called with TAG1 and deactivate the one called with TAG2 on the “Text to receive the code” string. For example

{\addfontfeature{RawFeature={+hlig}} históricas }

will activate historic ligatures on the text “históricas”.

NOTE: the first and last curly bracket are there to limit the effect of addfontfeature to the corresponding text.

On LyX this can be done through the use of “TeX boxes”: they are activated with the shortcut Ctrl-L.

Check my “Typographical concepts” series, specially part 3 and 4. And as always, a list of OpenType tags is available on Darios Taraboreli’s page.

Define a new font family

Let’s suppose we now want to define a new “font family” different from the font used on the base text. For this purpose we need to go to the LaTeX preamble: on LyX, under Document → Configuration → LaTeX Preamble we need to write something like this

\newfontfamily{\storiclig}[RawFeature={+hlig}]{EB Garamond}

This will define a new font family with the “historic ligature” feature of EB Garamond active. To use this new font family on LyX, again we need to use the “TeX boxes” with this code:

{\storiclig{ historic }}

Notice the double curly bracket at the end.

That’s enough for today. Next week we’ll discuss how to apply a particular OpenType feature to the entire document.


Numbered and bulleted lists alignment on LibreOffice Writer

This is something that generates a lot of confusion among users, both new and old on equal measure. Let’s see if I can explain it a bit better.

When you create a numbered or bulleted list on Writer, or edit a list style, on the Position tab you’ll see something like this

What’s the meaning of each field?

For each “level” on the list (left column) you can set the position and alignment of the numbering and the left margin behaviour for the paragraph.

Aligned at (1) says where the number goes, but as numbers clearly have some width you also need to indicate in which part of the number you are measuring its position, and for that you have the Numbering alignment menu: Left (default option) indicates that the number starts on the indicated position (i.e., the position marker goes to the left of the number), Right that the number ends on that position (i.e., the numbers goes before the marker) while centred is, well, centred 🙂

Number followed by (2) indicates how the numbering must be separated from the text (if you select “tab stop” you’ll be able to set the point where that tab stop ends), while Indent at (3) indicates the left indent of the whole paragraph (minus the first line, of course, which is controlled by Number followed by).

I’d set all three lists to start at 9 to make it clear how alignment works, made use of a tab stop to separate number and first line of text and I’d also set an indent different from the tab stop to show that effect too. The first list is “left aligned,” the second is “centred” and the third is “right.”

And that’s it.

Gluk’s decorative fonts

It doesn’t matter if it’s Christmas, Hanukkah, Sol Invictus or Newtonmas: end of December  is holidays time and as such a good excuse to send fancy postcards. And that’s why the first review I’m presenting to you is of a site full of decorative fonts:

Gluk Fonts

The site offers several fonts with free licenses, many of them packed with OpenType features (contextual alternates, stylistic sets, initial and terminal forms, etc.)

Some older fonts, like FoglihtenFr02, instead of OpenType features use strategic substitutions of characters to provide “special effects”

(the M used as drop cap displays the first stylistic set of Sortefax, though)

So here it is, lot of fonts to get lot of fun drawing some crazy text.

And that’s all for today and for this year. Next article is scheduled for January 8.

Happy holidays!

Using OpenType tables on LibreOffice Writer

Since version 5.3, LibreOffice (from now on, LibO) offers quite good support for OpenType. It is not exactly “user-friendly”, but it’s not that difficult to use either and provides so much typographical power that it shouldn’t be ignored.

At this point we know, from previous articles, that each OpenType table is characterized by a “tag” that can be found on Dario Taraborelli’s page. Let’s see how to use them.

To simultaneously activate “stylistic sets” 1 and 11 on Vollkorn (see screenshot below), in the font name box we need to write


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

But there is more. We can also disable any default option. For example, the Sukhumala font have some strange contextual ligatures that turn aa into ā, ii into ī and uu into ū. In order to disable contextual ligatures on Sukhumala it is enough to add to the corresponding OpenType tag, “clig”, a dash in front of it:


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

And don’t forget to use all 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 a bit of direct formatting is OK. But only in that case!

One interesting OpenType “tag” that, sadly, does not work on LibreOffice yet is “size”. The “size” feature enables the automated selection of optical sizes (we talked about them on the second part of our “typographical concepts” series): a font family offering different designs for different point sizes. Few fonts offer this option (some GUST fonts like Latin Modern or Antykwa Półtawskiego, an interesting project on its initial stages of development called Coelacant or, to a lesser extent, EBGaramond), but they are all great. Right now the only way to enjoy this property is through a more advanced layout system such as XeTeX.

But that’s a topic for future articles: as I’d said, using OpenType on XeTeX is a huge topic. Before digging on how to use OpenType on LyX we’ll start reviewing FLOSS fonts. XeTeX usage will come on small doses… stay tuned!

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

Typographical concepts, part 4

On previous articles we learnt what OpenType means so now we are ready to learn how to actually use the stuff, right?

Not so fast, my friend: not all fonts provide OpenType tables, and as many F(L)OSS advocates know “gratis” does not mean “free” so today we’ll learn how to know which OpenType tables are available on a certain font and which licence the font actually have.

We’ll do all this on a Linux system.

Everything we 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, we just need to 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 on it, we need to “scape” that space with an inverted bar.

For example, to know what Sukhumala Regular.otf offers when installed in the folder ~/.fonts/s/ it’s enough to write in the terminal

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

to obtain

afrc Alternative Fractions
c2pc Petite Capitals From Capitals
c2sc Small Capitals From Capitals
case Case-Sensitive Forms
clig Contextual Ligatures
dlig Discretionary Ligatures
dnom Denominators
fina Terminal Forms
frac Fractions
hlig Historical Ligatures
kern Kerning
liga Standard Ligatures
nalt Alternate Annotation Forms
numr Numerators
onum Oldstyle Figures
ordn Ordinals
ornm Ornaments
pcap Petite Capitals
salt Stylistic Alternates
sinf Scientific Inferiors
smcp Small Capitals
subs Subscript
sups Superscript

It is possible to know all otfinfo options with

otfinfo -h

Now that we know what’s available, we are finally ready to start using all this. But that’s a topic that I’ll touch on future articles. For now, we can start playing with some of these properties thanks to the service offered by Pablo Impallari

By dragging a font file to that page we’ll be able to test how different OpenType options looks like.

The code for this service can be downloaded from GitHub to use it locally.

So… yeah, that’s the end of the “typographical concepts” series of articles. On the future we’ll get more “specific”. In fact, next article will be about how to use OpenType in LibreOffice Writer (version 5.3 added a quite complete OpenType support) and future articles (yes, in plural form, it’s a complex topic) on XeTeX called from LyX.

Typographical concepts, part 3

On this article we start talking about digital typefaces on FLOSS systems.

Font format

Digital fonts are far more than a file format with a three letter extension: they are also a complex piece of software.

On the most basic level a digital font is a “container” for different glyphs plus some extra information about how to use them. Each glyph is represented by a series of points and some 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 we are talking about: the term OpenType refers not only to the file format, but also to the advanced properties of the typeface as a whole (i.e., the “extra information” mentioned earlier).

In fact, in addition to the file format with “OpenType” we can also refer to the 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 (it’s “contextual alternate”); or that when you write in Greek, a σ at the end of a word it must be substituted with a ς. Did you ever heard about “smart fonts”? Well, that’s what they are.

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

There is another “smart font” technology: Graphite, but it’s use never take off and it is supported by just a small group of text processors and browsers: all projects derived from the late, Apache OpenOffice (through an old implementation with some limitations that nobody else uses any more) and LibreOffice, and the Firefox web browser. That’s it. And to make things worse there is only a handful of Graphite fonts available… so let’s move on and continue to talk about OpenType.

Some examples

Each OpenType property has its own “tag” that is used to activate those “specialities”. 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 on Dario Taraborelli’s page:

Accessing OpenType font features in LaTeX

In future articles we’ll see how to actually use all this, but for now let’s see some examples of these advanced properties in use.

Cormorant with (top) and without (bottom) OpenType features enabled:

The “character variants” on EB Garamond:

Numbers on Vollkorn:

… and the list goes on and on.

More information

About font file formats: FontForge | TrueType vs. PostScript vs OpenType vs SVG fonts

Typographical concepts, part 2

While we all love a beautiful typeface, we must agree that they are used for conveying meaning on a text: if the design is so elaborated that you cannot tell apart two different characters, then it is a bad typeface, no matter how beautiful each glyph may look by themselves.

The concepts or readability and legibility are too complex to be tackled on an article like this one, so let’s go to some general but important conclusions.

Size vs. shape

Broadly speaking, text of small size (8 points or fewer) should present fewer details and be more “broad” than those of 10 points or more, while for big sizes (16 points or more) they need to be “taller” and can be more detailed.

Some fonts offer different “optical sizes”: different versions of the same typeface tailored to be used at different point sizes. One example of such fonts is Latin Modern. On the following screenshot the text on grey was created at 10 pts and zoomed at 400 % while the other text was done at 5 pts and zoomed at 800 %.


Another concept of huge importance on typography is that of kerning. The idea behind kerning is in principle simple: to adjust the distance between glyphs so the text “looks good”. In practice, of course, it is a difficult topic.

(click on the picture to go to the original comic).

The best way to learn a new ability is by performing it, so I’ll let the reader with the “kerning game”

KernType a kerning game

The idea of the game is simple: on each text presented on the different levels the first and last character are fixed while those in between can be selected and moved with the cursor arrows to try to reach an ideal distribution (it’s not that easy).

More information

If you hear a typographer talking about “colour”, be careful: most likely he or she is not talking about what you think.

Typography has a language of its own full of strange definitions. If you are curious about the topic I highly recommend you to check this great article where everything is wonderfully explained and illustrated:

A Beautifully Illustrated Glossary Of Typographic Terms You Should Know

Also, be aware of the correct use of Alternate figures.

Just be careful: typography is a highly addictive topic…

Next time we’ll talk about font formats and smart font technology. Stay tuned!

NOTE: Next three articles are an “extended edition” of an article I wrote for

Typographical concepts, part 1

First of all, a disclaimer: IANAT (I Am Not A Typographer). But I’m a typeface enthusiast and really like good-looking text, so in this series of articles I’ll try to introduce you, my dear reader, to the fascinating world of F(L)OSS typography.

So let’s start all this by talking about what is typography on the first place.

Classifying fonts

The most basic classification is the distinction between serif and sans serif.

The word serif have an obscure etymology, but simply refers to the small lines that shows at the glyphs ends.

The left picture shows some serifs on three different serif typefaces, but before talking about what tell them apart we need to talk about a key typographical concept: contrast.
Each glyph have lines of different thickness: the difference between the thinner and the thickest lines is what typographers call contrast.

OK, now we can start to differentiate those typefaces: the one on top is an “old style” or “garalda”, the one on the middle is called “transitional” and the one on the bottom is now called “didone” (it used to be called “modern”… never use the name “modern” or “new generation” or something like that to name a product, sooner than later the name will turn ridiculous!)

An Old Style typefaces like EB Garamond have low contrast, a didone like Libre Bodoni have an enormous contrast, almost exaggerated, while Transitional typefaces like Baskervaldx are on a middle ground. Everything clear, right? Wrong: there are also differences on serifs’ shape. On Garaldes serifs are tiny and delicate while on a Didone typeface they are long, thin, mainly horizontal, of constant width and well differentiated.

But there is more. Look at the “lines” defined by the contrast, specially on the “closed” glyphs like the “o”, “g”, etc.:

As you can see, these lines are tilted on garaldes while on transitional and didone typefaces they are vertical.

And yes, I’m not talking about slab serifs here. Why should I talk about slab serifs?

In principle, “Sans Serif” typefaces are easy to understand: on French, “sans” means “without”. They also can be classified on several realms (grotesque, geometric, humanist…), but I’ll skip that discussion for now (see links below).

Next article we’ll introduce more key concepts about typography. Read you later!

More information

Hello (English) World!

My name is Ricardo. I’m known to the web as RGB, RGB-es or “El pingüino tolkiano” (the tolkian penguin). For many years I’ve been writing in Spanish (and a bit in Italian) about FLOSS (Free-Libre Open Source Software) related stuff, mainly about processing text and typography, but I also have a natural tendency to digression.

From now on I’ll (try to) write in English too (sort of, I’m not a native speaker!), maybe once a week, maybe any other week. I don’t know yet.

I’m the author of “Domando al escritor” (taming the writer), a Creative Commons licensed book about LibreOffice Writer well-known to the Spanish community: its first edition dates back to 2010 and the latest edition, centred on version 5.1, is from 2016, with an Italian version also on 2016. I’m planing to release a new edition on mid 2018 centred on 6.1. Maybe (just maybe) there’ll be an English version too.

I’m also the author of a book about using XeTeX and OpenType on LyX that will be released quite soon [UPDATE: it’s been released!]. For now the book will be is available only on Spanish, but who knows! Let’s see how things unfold.

In the hope of offering something useful to my readers I’m starting to write on this blog.

Next Monday the first “real” article!