将文本块与主网格偏移一半的行距

将文本块与主网格偏移一半的行距

在我下面的尝试中,如果不是文本块最后一行的降部,我几乎可以实现正确的偏移量。我们假设文本块中的行距与全局行距相同。

\setuplayout[grid=yes]

\showgrid


\starttext

\input ward

% Without descenders the baseline is offset by half a line :-)
\startlinecorrection
    This is a line without descenders.
    \blank[halfline]
\stoplinecorrection

\input ward

% Even for many lines :-)
\startlinecorrection
    \dorecurse{10}{This is a line without descenders. }
    \blank[halfline]
\stoplinecorrection

\input ward

% This just pushes the line down to the next grid line :-(
\startlinecorrection
    \blank[halfline]
    This is a line without descenders.
\stoplinecorrection

\input ward

% Any descender pushes the baseline up, away from the sweet spot between the grid lines :-(
\startlinecorrection
    This is a special line with descenders.
    \blank[halfline]
\stoplinecorrection

\input ward

\stoptext

类似这样的事情应该做:

  1. 确定最后一行的深度 d
  2. 插入垂直空间 = .5*\baselineskip - d

我该怎么做?有没有更好的方法来解决这个偏移问题?

相关内容