<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Le 04/05/2011 10:34, Ulrike Fischer a écrit :
<blockquote cite="mid:bor7b9mesxw$.dlg@nililand.de" type="cite">
<pre wrap="">Am Tue, 03 May 2011 16:58:28 +0200 schrieb Paul Isambert:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">Regarding Till's concrete problems (\url and biblatex) I wouldn't
bet that they insert only penalties between the glyphs.
</pre>
</blockquote>
<pre wrap="">
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{<a class="moz-txt-link-freetext" href="http://">http://</a>}, 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),
</pre>
</blockquote>
<pre wrap="">
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
characters:
\documentclass{article}
\usepackage{url}
\urlstyle{same}
\usepackage{fontspec}
\setmainfont[FeatureFile=mybonum.fea]{TeX Gyre Bonum}
\begin{document}
<a class="moz-txt-link-freetext" href="http://">http://</a> \url{<a class="moz-txt-link-freetext" href="http://">http://</a>}
\def\UrlBreaks{}
\def\UrlBigBreaks{}
\def\UrlOrds{\do\*\do\-\do\~\do\'\do\"\do\-\do/\do:}%
\url{<a class="moz-txt-link-freetext" href="http://">http://</a>}
\end{document}
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
fonts.</pre>
</blockquote>
<br>
As noted by Ulrike, the problem is mathmode, which I had overlooked;
but that's not the end of the story, otherwise we could kick in the
"mlist_to_hlist" callback and add our function (actually not so
easy, because of subboxes and the like). The problem is that this
code tested with<br>
<br>
$\rm V\hskip0pt e$<br>
<br>
doesn't work because a font kern is already inserted after V by the
math-to-horizontal algorithm for reasons I don't know but probably
explained in appendix G of the <i>TeXbook</i>. (Note that perhaps
it works nonetheless with a pair of slashes.)<br>
<br>
I agree with Ulrike that hacking around isn't a solution; the url
package should be rewritten to work properly with LuaTeX. Two
things, in my opinion, should be corrected: replace zero-width glues
with proper penalties, and avoid math mode. With LuaTeX, where most
aspects of TeX can be modified or at least inspected, using math
mode for material that isn't maths should be avoided, I suppose. I
don't know what the package does precisely, but rewriting it to
manipulate nodes directly should be rather easy: typeset the url in
a box (so proper kerning is added), then add penalties automatically
before/after some characters.<br>
<br>
So, Till, you're most unfortunate. On the other hand, could the fine
typography you're trying to achieve (as exemplified by your
attention to kerns) tolerate such things as urls in the main text?
Wouldn't they be better placed in a footnote of their own, with
linebreak done by hand? Oh, yes, I'm drowning the fish, as we say in
French :)<br>
<br>
Best,<br>
Paul<br>
</body>
</html>