On 3/12/2020 3:16 PM, Marcel Fabian Krüger wrote:
Hi,
I found a curiosity in LuaTeX's treatment of `y_displacement` in glyph
nodes:
Take the following ConTeXt example:
\usetypescript[pagella]
\setupbodyfont[pagella,12pt]
\starttext
f\char776\char776\char776\char807\char807\char807\vrule
\stoptext
(See https://github.com/latex3/luaotfload/issues/134 for a more
practical case where this leads to issues)
Here the \vrule shows that the marks attached at the top get their
y_displacement added to their height, while for the marks added at
the bottom the additional depth is ignored. (The first \char807 is
still covered by the rule because that is the natural height of this
glyph)
This is explicitly done in texnodes.c: For glyph_height, the
displacement is always added. For glyph_depth, the displacement is only
added if it is positive:
scaled glyph_height(halfword p)
{
scaled w = char_height(font(p), character(p)) + y_displace(p);
if (w < 0)
w = 0;
return w;
}
scaled glyph_depth(halfword p)
{
scaled w = char_depth(font(p), character(p));
if (y_displace(p) > 0)
w = w - y_displace(p);
if (w < 0)
w = 0;
return w;
}
This seems inconsistant. Is there a reason why this would be required or
could it be changed to handle height and depth consistently?
It is (among some others) a known artifact that dates from the very
early days when we played with alternative par builders and such. These
offsets were introduced when we were messing around with arabic and had
to handle marks and at the same time deal with tex's perspective on line
dimensions (which it doesn't really have): prevdepth, maxdepth and
such so this is (irr) why we handled the depth differently.
Because in the process more access to node lists at various stages was
implemented one can indeed wonder if we need to keep this assymetrical
approach (as we were never really bitten by it there was not real reason
to change is, also because it can resuel in incompatible output.)
Anyway, what I can do is change it in luametatex so that for a longer
period we can see if context users run into issues and complain about a
change in output (i can then quickly revert to make it some option).
After all, context users know that they are possible victims of testing.
Just changing something in luatex right away is no option given the
demand for stability, and definitely not in code freeze time. When we
don't run into problems we can then decide to do it in luatex too
(assuming that complaints about different output don't backfire).
Another option is to introduce a parameter \characteroffsetmode:
0 = no compensation
1 = ht compensation (current and default)
2 = dp compensation
3 = ht and dp compensation
(This could be done a couple of weeks after the code freeze as there is
some more pending.)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
_______________________________________________
dev-luatex mailing list
dev-luatex@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-luatex