[luatex] Kerning: when does it not work?

Heilmann, Till A. till.heilmann at unibas.ch
Tue May 3 10:15:35 CEST 2011


On 30/04/2011 11:43 AM, Paul Isambert wrote:

> [...] Taco has turned your problem into a feature 
> request; in the meanwhile, here's some experimental code that add kerns 
> between glyphs even though they are separated by penalties:
> [...]
> Some remarks:
> - I use luatexbase.add_to_callback because I suppose you're using 
> luatexbase (even if you might not know that), and thus callback.register 
> (the original function) isn't available.
> - I add kerns with subtype 1, equivalent to \kern, although what you 
> really want is /font/ kerns (subtype 0); the difference is that font 
> kerns may vary in width if you use font expansion, while normal kerns 
> don't. However, if I inserted font kerns, they might disappear by the 
> same process of font expansion and never reappear precisely because TeX 
> hasn't inserted them by itself (at least that's what happened last 
> summer and I suppose that hasn't changed, since it's normal behavior).
> - Also, kerns won't be properly added in case of discretionaries. All in 
> all, Taco's implementation will be better, of course, because it won't 
> face this issue and the previous one.
> - The code hasn't been put to any stringent test.
> - Hope you haven't switched to InDesign yet.

Thank you, Paul and Taco, for your help.

Reading Paul's answer, I realize that the technical workings of font kerns are more complex than I thought. From a layman's perspective, though, fixing the issue of suppressed kerns on the most fundamental level possible (if that is possible) and offering a "transparent" solution to users would probably be best: It would, therefore, be great if adjustments to pair kerning made in OTF feature files (or by any other means) simply worked "out of the box" and like expected for every instance of the respective glyph pair. (There is, btw, still the minor bug with existing font kerns I discussed with Khaled a couple of weeks ago: http://tug.org/pipermail/lualatex-dev/2011-March/001108.html)

Paul: I must confess that I do not really understand how your experimental code works and how I am supposed to use it. Simply pasting it into the preamble of the sample document I posted earlier didn't change anything (well, I did not expect it to be that simple, either). For my real-life book project I load fonts like this:

[...]
\usepackage{fontspec}
\usepackage[sans-style=upright]{unicode-math}
\setmainfont[Renderer=Basic,Ligatures=TeX,ItalicFeatures={RawFeature=+itlc},FeatureFile=texgyrebonum-tah.fea]{TeX Gyre Bonum}
\setmathfont{TeX Gyre Bonum}
\setsansfont[Renderer=Basic,Ligatures=TeX,Scale=MatchUppercase,ItalicFeatures={RawFeature=+itlc},FeatureFile=texgyreheros-tah.fea]{TeX Gyre Heros}
\setmathfont[range=\mathsfup/{latin,Latin,num}]{TeX Gyre Heros}
\setmonofont[Scale=MatchUppercase]{Luxi Mono}
\setmathfont[range=\mathtt/{latin,Latin,num}]{Luxi Mono}
\setmathfont[range=\mathup/{greek,Greek}]{XITS Math}
\setmathfont[range={"22C5}]{XITS Math}
\setmathfont[range=\mathscr]{XITS Math}
[...]

In the text I "call" these different fonts with the usual commands for families (\rmfamily, \sffamily, \ttfamily), series and weights (\mdseries, \bfseries), and sizes (\fontsize{}{}). I am reluctant to change this because the fontspec and unicode-math packages work just fine for me and do a lot of nice things like scaling that I would not know how to achieve otherwise.

I would greatly appreciate any advice on how to make your code work, of course.

Thanks again and best regards,
--Till

PS: I have not switched to InDesign yet and will certainly not do so with my current project (it would be madness to start all over again using a completely different approach). I have been using (La)TeX for more than ten years now and am generally very happy with it. The point is that, over the years, TeX has raised my appreciation for typographic detail and I can no longer stand things like poor tracking and kerning of fonts--both issues that are not trivial to deal with in TeX.


More information about the luatex mailing list