0

I found out that \someline (for getting a reference to the line number) breaks the kerning of the font.

For example, I want to adjust the kerning between the characters "," and "1", and I do this by adding a kerning rule to my font in fontforge. In this example, I added a lot of space, for the sake of better visibility.

Now, if I write twice a line containing both characters in sequence, and in the second line insert a \someline command between these characters

\startluacode
  fonts.handlers.otf.addfeature {
    name = "ktest",
    type = "kern",
    data = { [","] = { ["1"] = 500 } }
  }
\stopluacode

\definefontfeature
  [default]
  [default]
  [ktest=yes]

\setupbodyfont[modern]

\starttext

p.1,123\par
p.1,\someline[x]123\par

\stoptext

then I get the following result:

example

The space within the first line is the kerning. In the second line, obviously, this is prevented by the insertion of \someline. To me it seems as if this command produced some token of its own, so the "," and the "1" are not contiguous any more.

So how can I get a reference to the line number at a certain position and at the same time adjust the kerning of the characters at that position?

I may need to add that actually the problem is more complex, and just putting the \someline to another position is not an option.

3
  • Which font are you using? It works fine with Latin Modern
    – user226564
    Sep 14, 2021 at 17:01
  • I bet that \someline inserts a whatsit which inhibits kerning. Sep 15, 2021 at 18:59
  • Please always post MWEs. I've added one for you. Sep 15, 2021 at 19:11

1 Answer 1

2

As I've already suspected, there are additional nodes inserted by \someline in between , and 1. We can visualize it using:

\showboxbreadth=\maxdimen
\showboxdepth=\maxdimen
\tracingoutput=1
\tracingonline=1
\normalshipout\vbox{
  p.1,\someline[x]123\par
}
\tracingoutput=0
\tracingonline=0

The logfile will then contain

\vbox(7.98761+2.32672)x426.78743, direction TLT
.\hbox(7.98761+2.32672)x426.78743, glue set 389.46393fil, direction TLT
..\localpar
...\localinterlinepenalty=0
...\localbrokenpenalty=0
...\localleftbox=null
...\localrightbox=null
..\hbox(0.0+0.0)x0.0, direction TLT
..<1: lmroman10-regular @ 12.0pt> p
..<1: lmroman10-regular @ 12.0pt> .
..<1: lmroman10-regular @ 12.0pt> 1
..<1: lmroman10-regular @ 12.0pt> ,
..\hbox(0.0+0.0)x0.0, direction TLT
...\latelua0 <function reference 790>
..\hbox(0.0+0.0)x0.0, direction TLT
...\latelua0 <function reference 791>
..<1: lmroman10-regular @ 12.0pt> 1
..<1: lmroman10-regular @ 12.0pt> 2
..<1: lmroman10-regular @ 12.0pt> 3
..\penalty 10000
..\glue(\parfillskip) 0.0 plus 1.0fil
..\glue(\rightskip) 0.0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .