2

Many professional fonts contain kerning instructions between the space (U+0020, the character) and other characters. These kerns help the pages achieve a more balanced typographical colour. For example, when an uppercase letter T follows a word space (i.e., <space>T), because of the extra hollow spot left to the vertical stem of the T, this word space would appear bigger/wider than other word spaces. So a font designer may want to reduce this kind of hollow spot by adding negative kern between the pair <space> and T.

But TeX doesn’t treat <space> as “character”. More precisely, a (Category 10, Character 32) token is converted into a glue node when typesetting, and such glue will have (1) normal width, (2) stretchability, and (3) shrinkability, coming from the current font. Therefore, it is impossible to auto-kern against space in classical TeX. In LuaTeX, however, something can be tried (see the post Kerning against word space in LuaTeX by @YanZhou).

My question is not about “how does one implement kerning against space in certainTeX”, but rather “if one were to insert these kerns manually, then what these kerns should be in the TeX world”.


A toy example

Let’s say there is a font with <space> designed to be 210 units wide. Here, one unit equals 1⁄1000 em. Using normal convention of TeX, the stretchability will be 105 units, and the shrinkability will be 70 units. Suppose the lowercase letter f has a large overhanging terminal, so that the combination f<space> is supposed to have a positive kern of 30 units in between, according to the font. Also, <space>T is supposed to have a negative kern of 30 units in between. Now, consider the following snippet from a text paragraph:

...f H T...

TeX will convert this into a linked list:

...
<char: f>
<glue: 210 plus 105 minus 70>
<char: H>
<glue: 210 plus 105 minus 70>
<char: T>
...

How should we treat the positive/negative 30-unit kerns?

Model 1

Insert these kerns as explicit kerns (via the \kern primitive):

<char: f>
<kern: +30>
<glue: 210 plus 105 minus 70>
<char: H>
<glue: 210 plus 105 minus 70>
<kern: -30>
<char: T>

Model 2

Insert these kerns as glues (via the \hskip primitive), but with neither stretchability nor shrinkability:

<char: f>
<glue: +30>
<glue: 210 plus 105 minus 70>
<char: H>
<glue: 210 plus 105 minus 70>
<glue: -30>
<char: T>

Model 3

Insert these kerns as glues (via the \hskip primitive), but with both stretchability and shrinkability. Reason: Since the space following f is supposed to be 210+30=240 units wide, it should have 120-unit stretchability (15 units more) and 80-unit shrinkability (10 units more).

<char: f>
<glue: +30 plus +15 minus +10>
<glue: 210 plus 105 minus 70>
<char: H>
<glue: 210 plus 105 minus 70>
<glue: -30 plus -15 minus -10>
<char: T>

Models 2 and 3 seem more superior than Model 1 when it comes to line-breaking, but I don’t know for sure. I can’t decide between Model 2 and Model 3 either, and maybe there is another alternative. Discussions welcome!

1 Answer 1

1

If I recall correctly, there is a word boundary that's part of the TeX metric model that can be kerned against (it's also used for ligatures to allow for beginning/end-of-word variant characters like in, e.g., Arabic). I would expect that a decent TeX implementation would take kerns against spaces and treat them as kerns against word boundaries which would allow them to be used even in Knuth's unmodified TeX program.

You must log in to answer this question.

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