# Debugging OpenType Feature / Substitution Problems with XeTeX [closed]

I have been sent an updated set of fonts from a professionally developed OTF typeface which I am trying to use with plain XeTeX.

When using them with XeTeX, I could not get the OpenType features to work, even most basic ones like +liga, although it seems that they are present. I have subsequently solved the problem (see at the end) by adding :script=DFLT, but I am still not sure how to debug this since I found the solution by trial-and-error.

The problem was, for example:

\font\rm"New Font" at 12pt
\rm Office \bye


Produced “Office” without the ffi ligature whilst:

\font\rm"Old Font" at 12pt
\rm Office \bye


Produced Oﬃce with the ligature. Other features (e.g. +smcp, +ornm, +hlig) work with other fonts but not the New Font (e.g. \font\rm"Old Font:+smcp" at 12pt gives me small caps, \font\rm"New Font:+smcp" at 12pt does not).

If I try otfinfo -f newfont.otf

I get

c2sc    Small Capitals From Capitals
dlig    Discretionary Ligatures
dnom    Denominators
frac    Fractions
hist    Historical Forms
hlig    Historical Ligatures
liga    Standard Ligatures
lnum    Lining Figures
medi    Medial Forms
[etc.]


So I know those features are present in the font.

I have also opened up the font with fontforge and checked the ffi substitution is there: it is.

Comparing the Old Font and the New Font, in addition to differences to the shapes of the glyphs, I notice that the new font is OS/2 Version 3 not 2. Would that make a difference? Also, I notice that there are more substitutions in the New Font (20 not 18); they appear in a different order (with +c2sm first); there are two +frac substitutions; and there is a Single Substitution related to the +frac substitution. Could any of these be causing XeTeX to choke?

Finally, if I use abiword, it carries out the ffi substitution, as well as a few less common substitutions such as Th which are present in the font as +liga.

There are no errors from XeTeX.

Could anyone advise how I might debug this problem and see what XeTeX does not like?

After some deep reading of the XeTeX Reference Guide and going through the font options one by one, I eventually found that specifying the script language solved the problem:

\font\rm"New Font:script=DFLT" at 12pt
\rm Office \bye


I am, however, still unsure why XeTeX seems not to like this font. I would have thought the DFLT scripts would be read by default... I am also not sure how to properly debug this.

-

## closed as off-topic by Joseph Wright♦Aug 5 '13 at 19:47

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  doncherry Jan 21 '13 at 21:30
What happens if you load the font with \font\foo="New Font:+liga" at 12pt? –  egreg Jan 21 '13 at 23:09
@egreg, I’ve tried that, without success. The problem seems to be that no opentype substitutions work. For example \font\foo"New Font:+smcp" at 12 does not produce anything. I’ll add some more details to the question. –  JacobH Jan 22 '13 at 22:10
I don’t think there is an easy answer, you need some level of knowledge about OpenType and how it works to do any debugging. But for comparing two version of the same font, FontForge’s sfddiff tool can be helpful. –  Khaled Hosny Jan 22 '13 at 23:56
To answer your other question, current version of XeTeX defaults to latn not DFLT, the next version is a bit smarter and should handle situations like this better. –  Khaled Hosny Jan 22 '13 at 23:58