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:
I. BARRY\\
II. {\addfontfeature{CharacterVariant=1}B}ARRY\\
III. {\addfontfeature{CharacterVariant=1}BARRY}\\
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.
{\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.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.