I'm using Emacs 28 (HEAD) on Debian Stable, compiled with HARFBUZZ and cairo (if that's important).

I'm trying to enable opentype features on the Pragmata Pro font (as shown here).

(font-spec :family "Iosevka Term SS10" :size 16 :otf '(latn nil nil (dlig))

(font-spec :family "Iosevka Term" :size 16 :otf '(latn nil nil (dlig))

I've tried both of these, with no difference. Emacs does not show me any errors but the extra ligatures don't work.


font-spec is a function defined in font.c.

(font-spec ARGS...)

Return a newly created font-spec with arguments as properties.

ARGS must come in pairs KEY VALUE of font properties.  KEY must be a
valid font property name listed below:

:family, :weight, :slant, :width

They are the same as face attributes of the same name.  See


VALUE must be a string or a symbol specifying the font foundry, e.g. misc.


VALUE must be a string or a symbol specifying the additional
typographic style information of a font, e.g. sans.


VALUE must be a string or a symbol specifying the charset registry and
encoding of a font, e.g. iso8859-1.


VALUE must be a non-negative integer or a floating point number
specifying the font size.  It specifies the font size in pixels (if
VALUE is an integer), or in points (if VALUE is a float).


VALUE must be a string of XLFD-style or fontconfig-style font name.


VALUE must be a symbol representing a script that the font must
support.  It may be a symbol representing a subgroup of a script
listed in the variable script-representative-chars.


VALUE must be a symbol whose name is a two-letter ISO-639 language
name, e.g. ja.  The value is matched against the "Additional Style"
field of the XLFD spec of a font, if it's non-empty, on X, and
against the codepages supported by the font on w32.


VALUE must be a list (SCRIPT-TAG LANGSYS-TAG GSUB [ GPOS ]) to specify
required OpenType features.

  SCRIPT-TAG: OpenType script tag symbol (e.g. deva).
  LANGSYS-TAG: OpenType language system tag symbol,
     or nil for the default language system.
  GSUB: List of OpenType GSUB feature tag symbols, or nil if none required.
  GPOS: List of OpenType GPOS feature tag symbols, or nil if none required.

GSUB and GPOS may contain nil elements.  In such a case, the font
must not have any of the remaining elements.

For instance, if the VALUE is (thai nil nil (mark)), the font must
be an OpenType font whose GPOS table of thai script's default
language system must contain mark feature.

I have tried to use GPOS / GSUB independently. Using GPOS gives me this error on startup:

Error in private config: config.el, (error invalid font property :otf latn nil dlig (nil))

Any help is appreciated!

2 Answers 2


I think emacs doesn’t currently have support for controlling otf features. Here are two things though:

You can get default ligatures of the font so long as your font is the “principal” (I don’t know what the right term is here) font of the fontset. You need to convince emacs to compose characters and by default it won’t do this for Latin characters or symbols. To do this you need an appropriate entry in composition-function-table to cause font-shape-gstring to be called to shape your ligatures. font-shape-gstring will go to the principle font of the fontset (maybe a different font, I’m not exactly sure how emacs decides it) and ask it to shape the characters, forming a ligature if the font tells it to. This is only possible if you have emacs >= 27 and harfbuzz for font shaping (check features for harfbuzz and check that your font backend is something like cairohb or xfthb).

As an extension to this there is some experimental code in emacs for turning on open type features, I think through the same mechanism. It is hidden behind a few #if 0 blocks and some warnings in font.c and you could try enabling it if you’re feeling brave.


I haven't quite gotten this to work either, but one thing I noticed: You're doing (font-spec :family "Iosevka Term" :size 16 :otf '(latn nil nil (dlig)), but the docs you quote say that the GSUB list should come before GPOS, and dlig is a GSUB kind of thing. So I would expect

(font-spec :family "Iosevka Term" :size 16 :otf '(latn nil (dlig) nil))

to be more like what you need. Do you have to enable calt as well? Does Iosevka Term even have the ligatures, or is it Iosevka Fixed that has no odd-width characters (and thus would lack the ligatures).

Like I said, this, alone, has not fixed things for me, but maybe I'm doing something else wrong that you aren't. At least this is something you can improve.

  • Oh, and you're still going to have to do stuff with composition tables to make emacs run the font-shape-gstring function on the ligatures to get harfbuzz to shape them.
    – Mark S.
    Sep 11, 2020 at 14:50
  • 3
    Ah... font-spec doesn't say it'll activate those features for you. It's just a selector. By including the OTF features you're stipulating that the font object that it finds to match this spec must have these features. Hence the line in the doc about being able to put in a nil to mean the font must not have them. I think we need something else to turn the features on.
    – Mark S.
    Sep 11, 2020 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.