Why does the footnote number change its shape in this example?

I am currently trying to format footnotes and footnote entries in my own way. I believe that am almost there, but there is a behavior that I don’t understand.

Please consider the following code and its outcome:

#set page(paper: "a9")
#show footnote.entry: it => {
  let loc = it.note.location()
  [
    #super()[#counter(footnote).at(loc).first()]
    foo
  ]
}

#v(3.2cm)
Hello footnote#footnote[]


When I now append a space character (or any other sequence of normal characters) at the end of the superscript, the footnote number changes its shape:

#set page(paper: "a9")
#show footnote.entry: it => {
  let loc = it.note.location()
  [
    // Note the space character before the closing square bracket in the following line
    #super()[#counter(footnote).at(loc).first() ]
    foo
  ]
}

#v(3.2cm)
Hello footnote#footnote[]


The footnote number in the footnote entry now looks completely different. It is taller and less bold than in the first picture.

According to the documentation, #counter(...)...first() returns a normal integer (not some sort of content or formatting). I don’t understand why appending a character to this integer does change its formatting (to be precise, the formatting of the whole superscript text).

Could somebody please help me understand this?

Thank you very much in advance!

Hi @Binarus,

the formatting is applied by super. By default typographic is set to true for super, which uses the superscript appearance of a glyph provided by the font (OpenType feature sups ). If no superscript glyph is provided, Typst synthesizes the superscript appearance.

If in the text in super contains a glyph for which the font has no superscript appearance, the whole text in super falls back to the Typst synthesized appearance for consistency.

There is an open issue about it in #7122, with discussion about the space causing a fallback.

2 Likes

Thank you very much for the fast reply and the excellent explanation!

Your are completely right. I really should have seen this myself.

But it naturally depends on the chosen font. I had already tested this with the standard font, and the outcome was that appending digits or normal letters (excluding whitespace characters) did not have that effect.

But now I have switched to Google Noto for all my documents. This font obviously has dedicated superscripts only for digits, not for letters, which worried me.

But now it’s clear. Thanks again!