[luatex] Kerning: when does it not work?

Ulrike Fischer luatex at nililand.de
Wed May 4 10:34:35 CEST 2011

Am Tue, 03 May 2011 16:58:28 +0200 schrieb Paul Isambert:

>> Regarding Till's concrete problems (\url and biblatex) I wouldn't
>> bet that they insert only penalties between the glyphs.
> I haven't been able to run the example correctly (my LaTeX installation 
> is far from maintained, let alone LuaLaTeX). For instance I haven't been 
> able to make the feature file work. Anyway I've analysed what is produce 
> by \url{http://}, and the result is (nodes are separated by space; for 
> glyphs I give the character):
> math_node h t t p glue_node : glue_node / / math_node
> So the problem here stems from glues, not penalties, between characters. 
> I suppose that's the same with biblatex (glues around the slash in e.g. 
> 6/2, to allow linebreaking). And it would be totally absurd to require 
> that kern pairs be applied across glues; on the other hand, a 
> LuaTeX-aware package should be able to mark such glues (e.g. with 
> attributes) and to insert the kerns with something similar to the code 
> I've proposed.  Yet it would seem much more logical to me to insert real 
> penalties instead of phantom spaces (I've checked, those spaces have no 
> width nor stretch nor shrink, so they're really here for the line break, 
> I suppose), 

url.sty is rather complicated. Roughly (I don't know the details)
the urls are set in mathmode. At the start url sets the mathcode of
various chars. E.g. dot and slash get the mathcode of a binary
operator, the colon of a relation. Some chars are "mathactive" (e.g.
the %). 

This means that line breaking is done with the math rules. 

I can get the wanted kerning if I remove the colon and the slash
from the break/big break list and declare them as ordinary

\setmainfont[FeatureFile=mybonum.fea]{TeX Gyre Bonum}

http:// \url{http://}




So I think the problem is that no kerning is inserted in math mode
e.g. between a relation and a normal char.

At my opinion it doesn't make much sense to try to add functions to
the kerning callback. One should try to rewrite \url for lualatex. I
doubt that with luatex all this mathcode-tweaking is necessary.
After all you only want to type a text with some catcode changes and
insert some break points. Also url does contain some encoding (OT1,
TI, LY1) specific code which could bite when you are using unicode

Context has some code which could be useful:


Ulrike Fischer 

More information about the luatex mailing list