I am using TeXlive 2016 on Ubuntu with LuaLaTex, all up to date. As of a week ago (or so), the following code worked for me. It defines a new, custom Open Type feature using Lua code, as described by others. In the Preamble:

\DeclareDocumentCommand \CreateFontFeature { m m }
    fonts.handlers.otf.addfeature {
      name = "#2",
      {type = "substitution", data = {\@fakethree},},
      "feature #2 for some fonts",
\newfontfamily\agp[RawFeature=+emda]{Adobe Garamond Pro}

Then in the document, I use that font as {\agp text}.

What it did was substutite the shorter emdash for the usual long one. Sadly, the shorter emdash is not in one of the OT feature sets.

Just today, I discovered that the above code no longer works. Apparently the +emda is not being processed and passed to the font any more.

Possibility 1: In my total code, much too long to post here as a MWE, I did something that interfered with the above.

Possibility 2: I notice that there have been some recent updates to fontspec and luaotfload. An issue?

So my question is: Are any other user doing something like this? Experience, as of today?

  • 3
    To debug whether it's a fontspec, look in the log file for the "NFSS spec" of the created family. If it has the +emda, it's not my fault... – Will Robertson Feb 9 '17 at 7:30
  • @WillRobertson Yes, +emda is there. Now look at Ulrike's reply, below. It appears that there was a syntax change. But the fontspec docs for v. 2.5c has the old code on page 57, Figure I. Update docs? – user103221 Feb 9 '17 at 17:03

It looks as if the syntax has changed. Looking at some context examples which works in a current context (e.g. http://minimals.metatex.org/current/context/test/doc/context/tests/mkiv/fonts/extensions-001.tex) the differences seems to be that data and type are no longer in a subtable, and that the explaining text has been removed. This here works for me:


    fonts.handlers.otf.addfeature {
      name = "emda",
      type = "substitution",
      data = {emdash="A"},
      %"feature for xxx" %makes it fail


 —  {\agp —}

enter image description here

| improve this answer | |
  • That saved me a LOT of digging through my own code, looking for a mystery mistake! – user103221 Feb 9 '17 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy