<!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 29/04/2011 11:52, Heilmann, Till A. a écrit :
<blockquote
cite="mid:C32469D3-9F62-49ED-95CE-0A31E0E824BB@unibas.ch"
type="cite">On 28/04/2011 07:27 PM, Paul Isambert wrote:
<br>
<br>
<blockquote type="cite">Two remarks (unfortunately you haven't had
many answers...):
<br>
- Contrary to what might be implied (or simply misunderstood by
me) in your last remark, penalties (and by the way \special's
and whatever is between two glyphs) affect all font kerns, not
only those you set by yourself in a feature file;
<br>
- There exists a solution: add the kerns by yourself; this means
browsing a list of nodes, and for each pair of contiguous nodes,
insert a kern if required in the font, where /contiguous/ means
next to each other or separated by such things as penalties,
specials, etc.
<br>
</blockquote>
<br>
<br>
Thank you, Paul, for your remarks and your advice. I am afraid,
though, that what you propose is beyond my capability as a
(somewhat experienced) user since it seems to require a good
knowledge of LuaTeX and at least some programming.
<br>
<br>
I can work with the popular (La)TeX packages, not least because of
the good documentation provided and the friendly support from the
community. But actual programming is another thing. (I tried to
read the LuaTeX beta 0.66.0 manual but had to admit defeat).
<br>
<br>
It looks like I have to do without customized kerning in LuaTeX
and for my future book projects must consider (horror, horror)
switching to a commercial DTP solution like InDesign.
<br>
</blockquote>
<br>
Ah, this cannot be allowed; 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:<br>
<br>
%%%<br>
\directlua{<br>
local GLYF = node.id("glyph")<br>
local PNTY = node.id("penalty")<br>
local KERN = node.id("kern")<br>
<br>
local function add_kerns (head)<br>
node.kerning(head)<br>
for glyph in node.traverse_id(GLYF, head) do<br>
local next = glyph.next<br>
while next and next.id == PNTY do<br>
next = next.next<br>
end<br>
if next and next.id == GLYF then<br>
if glyph.font == next.font then<br>
local kerns =
font.getfont(glyph.font).characters[glyph.char].kerns<br>
if kerns and kerns[next.char] then<br>
local kern = node.new(KERN, 1)<br>
kern.kern = kerns[next.char]<br>
node.insert_after(head, glyph, kern)<br>
end<br>
end<br>
end<br>
end<br>
end<br>
<br>
luatexbase.add_to_callback("kerning", add_kerns, "add_kerns")<br>
}<br>
%%%<br>
<br>
Some remarks:<br>
- 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.<br>
- I add kerns with subtype 1, equivalent to \kern, although what you
really want is <i>font</i> 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).<br>
- 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.<br>
- The code hasn't been put to any stringent test.<br>
- Hope you haven't switched to InDesign yet.<br>
<br>
Best,<br>
Paul<br>
</body>
</html>