I am using an OpenType Font (OTF) that provides a number of character variants, for example variants of B, E, H with swirls, tails etc. The variants are accessed through the OpenType features "swsh", "cv01", "cv02" etc. The usage is like this: {\addfontfeature{CharacterVariant=1}B}

The problem arises when I mix regular characters with swash variants, as in the word {\addfontfeature{CharacterVariant=1}B}ARRY, LaTeX does not apply the kerning between the B and the A, even though the font does have a kerning instruction for exactly that pair. I guess it may be because the } stops LaTeX from recognizing the whole thing as a word and it does not apply kerning.

Now you might propose that I use {\addfontfeature{CharacterVariant=1}BARRY} instead, and in fact LaTeX does apply the kerning correctly in that case. But that solution does not work unfortunately because it will display the swash versions of R and Y as well, which is not desired.

The following example shows the three cases, I. correct kerning with regular B and A, II. lack of kerning between swash-B and A, III. correct kerning between swash-B and A but undesired swash variant of R and Y:

II. {\addfontfeature{CharacterVariant=1}B}ARRY\\
III. {\addfontfeature{CharacterVariant=1}BARRY}\\

enter image description here

Am I doing something wrong here or is there really no way to get correct kerning when mixing swashes and regular characters in a word?

The font, for reference, is this one: https://github.com/lvcivs/honoria-font

(My environment: XeTeX with the Fontspec package on Ubuntu).

Edit: Found this relevant issue in the fontspec bug tracker.

  • 2
    you are effectively using two fonts, and there is not kerning between two fonts. Commented Dec 29, 2020 at 17:23
  • It is the same font, but with different features activated.
    – lvcivs
    Commented Dec 29, 2020 at 17:34
  • 1
    it is technically a different font. Imagine that you use also say Scale or Embolden, would you still think of it as the same font? Commented Dec 29, 2020 at 17:42
  • In this case, {\addfontfeature{CharacterVariant=1}BA}RRY. In general, I think for now you’d need to define a character variant that changes only B and not R. Some fonts might expose the variants in their private-use area.
    – Davislor
    Commented Dec 29, 2020 at 18:22
  • Well, I don't know how this is implemented. But if cv01 etc. are handled as different fonts internally, which then prevents kerning, it is an inadequate implementation. Using swashes for initials is a rather straight-forward use case of such OpenType features and should not prevent kerning.
    – lvcivs
    Commented Dec 29, 2020 at 18:46

2 Answers 2


Of course, you are using the same font, but technically: TeX loads each variant of (the same) font with given font features (set or unset) as single individual font instance. Each such font instance is loaded by \font primitive, i.e. the parameters of \font primitive includes name of the font plus set or unset font features.

For example, if you are loading KPfonts without swash, then the following is done internally at TeX level (roughly speaking)


If you are using the same font with swash, then following is done:


This is the same font file, but different font from TeX point of view. Now, you are doing somewhat like this:

\fntA{\fntB B}ARRY

TeX never puts kerning between letters from different fonts, \fntA and \fntB in such example.

I don't know, how actual font you are using, but you can print its full name loaded internally by \font primitive by \fontname\font:


You can see that these two names differs.

Edit The desired kern can be calculated via \setbox. We prepare the macro \specletter{<font selection>}{<letter>}<next text>:




The {\bf A} is joined with next V by kern. In your example:

  • Thank you for helping me understand this. The conclusion, then, is that it is a limitation of the way in which the (Xe)TeX/fontspec/HarfBuzz-stack implements OpenType features.
    – lvcivs
    Commented Dec 29, 2020 at 19:38
  • @Ulmo I added a macro which can solve your problem.
    – wipet
    Commented Dec 29, 2020 at 20:10

With lualatex you can access the glyph variant.



\char\directlua{tex.sprint(luaotfload.aux.slot_of_name(font.current(), "B.left", false))}ARRY



enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .